Hyperref de un glosario conduce a una página incorrecta después de usar /setcounter

Hyperref de un glosario conduce a una página incorrecta después de usar /setcounter

Tengo un documento con el código que agregué a continuación. Las dos primeras páginas del documento son la página de título y la página con el índice. Estas dos páginas no deben contarse porque el contenido en sí comienza en la tercera página. Por eso, la tercera página debería tener el número 1. Para hacer eso, agregué \setcounter{page}{1} a mi estilo de página "Contenido". Después de hacer eso, también el número de página en mi glosario cambió a 1, como debería. Cuando hago clic en ese 1 para llegar a la página donde está escrita la palabra que se describe en mi glosario, hyperref me lleva a la página de título, como la primera página del documento. Esto está mal, porque debería llevarme a la tercera página del documento, que está numerada con el número de página 1. ¿Hay alguna forma de solucionar este problema?

Este es el código de mi documento:

\documentclass{article}

\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\usepackage{graphicx,xcolor}
\usepackage[margin=38mm,includeheadfoot]{geometry}
\usepackage{setspace, fontspec, hyperref}
\usepackage[acronym]{glossaries}    
\pagenumbering{arabic}

\DeclareNewLayer[
    background,
    topmargin,
    mode=picture,
    contents={\includegraphics[height=\layerheight,width=\layerwidth]{Picture1.png}}
]{top}

\DeclareNewLayer[
    background,
    bottommargin,
    mode=picture,
    contents={\includegraphics[height=\layerheight,width=\layerwidth]{Picture2.png}}
]{bottom}

\defpairofpagestyles{Titlepage}{}

\AddLayersToPageStyle{Titlepage}{top,bottom}

\newpairofpagestyles[scrheadings]{Tableofcontents}
{
    \clearscrheadfoot
    \ihead{Author}
    \chead{Title}
    \ohead{\includegraphics{Logo.png}}
}

\newpairofpagestyles[scrheadings]{Content}
{
    \clearscrheadfoot
    \setcounter{page}{1}
    \ihead{Author}
    \chead{Title}
    \ohead{\includegraphics{Logo.png}}
    \cfoot{Page \pagemark}
}

\makeglossaries
\newglossaryentry{Test}
{
    name=Test,
    description={Test}
}

\begin{document}
    \begin{titlepage}
      \KOMAoption{headsepline}{false}
      \KOMAoption{footsepline}{false}
      \begin{center}
        \thispagestyle{Titlepage}        
        Titlepage
      \end{center}
    \end{titlepage}

    \thispagestyle{Tableofcontents}
    \tableofcontents
    \clearpage
    
    \thispagestyle{Content}
    This is a \gls{Test}

    \printglossary
 \end{document}

Respuesta1

Utilice un sistema de numeración diferente para las primeras páginas (páginas con números de página ocultos).

\documentclass{article}
\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\usepackage{graphicx}
%\usepackage{xcolor}% not used in the example
\usepackage[margin=38mm,includeheadfoot]{geometry}
%\usepackage{setspace}% not used in the example
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage[acronym]{glossaries}

\DeclareNewLayer[
    background,
    topmargin,
    mode=picture,
    contents={\putLL{\includegraphics[height=\layerheight,width=\layerwidth]{example-image-a}}}
]{top}

\DeclareNewLayer[
  background,
  bottommargin,
  mode=picture,
  contents={\putLL{\includegraphics[height=\layerheight,width=\layerwidth]{example-image-b}}}
]{bottom}

\DeclarePageStyleByLayers{Titlepage}{top,bottom}

\newpairofpagestyles[scrheadings]{Tableofcontents}
{
  \clearpairofpagestyles% <- replace outdated command
  \ihead{Author}
  \chead{Title}
  \ohead{\smash{\includegraphics[height=1cm]{example-image}}}% use \smash to hide the height of the image
}

\newpairofpagestyles[scrheadings]{Content}
{
  \clearpairofpagestyles% <- replace outdated command
  \ihead{Author}
  \chead{Title}
  \ohead{\smash{\includegraphics[height=1cm]{example-image}}}% use \smash to hide the height of the image
  \cfoot{\pagemark}
}
\renewcommand*{\pagemark}{{\usekomafont{pagenumber}Page~\thepage}}

\newcommand*{\Content}{%
  \cleardoublepage
  \pagenumbering{arabic}% resets the page number to 1
  \pagestyle{Content}%
}

\makeglossaries
\newglossaryentry{Test}
{
  name=Test,
  description={Test}
}

\begin{document}
\pagenumbering{roman}
\begin{titlepage}
  \thispagestyle{Titlepage}
  \begin{center}
    Titlepage
  \end{center}
\end{titlepage}

\pagestyle{Tableofcontents}
\tableofcontents

\Content
This is a \gls{Test}
\printglossary
\end{document}

Observación adicional: no cambie el valor del contador de páginas en la configuración del estilo de página Content.

información relacionada