/setcounter를 사용한 후 용어집의 하이퍼참조로 인해 잘못된 페이지가 표시됩니다.

/setcounter를 사용한 후 용어집의 하이퍼참조로 인해 잘못된 페이지가 표시됩니다.

아래에 추가한 코드가 포함된 문서가 있습니다. 문서의 처음 두 페이지는 제목 페이지와 목차 페이지입니다. 콘텐츠 자체가 세 번째 페이지에서 시작되므로 이 두 페이지는 포함되지 않습니다. 따라서 세 번째 페이지에는 숫자 1이 있어야 합니다. 그러기 위해 "Content"-pagestyle에 \setcounter{page}{1}를 추가했습니다. 그렇게 한 후 용어집의 페이지 번호도 예상대로 1로 변경되었습니다. 해당 1을 클릭하여 용어집에 설명된 단어가 쓰여 있는 페이지로 이동하면 hyperref가 문서의 첫 페이지인 제목 페이지로 이동합니다. 이것은 잘못된 것입니다. 페이지 번호가 1로 매겨진 문서의 세 번째 페이지로 연결되어야 하기 때문입니다. 이 문제를 해결할 수 있는 방법이 있습니까?

내 문서의 코드는 다음과 같습니다.

\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}

답변1

첫 번째 페이지(숨겨진 페이지 번호가 있는 페이지)에는 다른 번호 매기기 시스템을 사용합니다.

\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}

추가 참고 사항: 페이지 스타일 설정에서 페이지 카운터 값을 변경하지 마십시오 Content.

관련 정보