![/setcounter を使用した後、用語集からのハイパー参照が間違ったページにつながる](https://rvso.com/image/420748/%2Fsetcounter%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%9F%E5%BE%8C%E3%80%81%E7%94%A8%E8%AA%9E%E9%9B%86%E3%81%8B%E3%82%89%E3%81%AE%E3%83%8F%E3%82%A4%E3%83%91%E3%83%BC%E5%8F%82%E7%85%A7%E3%81%8C%E9%96%93%E9%81%95%E3%81%A3%E3%81%9F%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%AB%E3%81%A4%E3%81%AA%E3%81%8C%E3%82%8B.png)
下記に追加したコードを含むドキュメントがあります。ドキュメントの最初の 2 ページは、タイトル ページと目次のページです。コンテンツ自体は 3 ページ目から始まるため、これらの 2 ページはカウントされません。そのため、3 ページ目の番号は 1 にする必要があります。そのために、\setcounter{page}{1} を "Content" ページスタイルに追加しました。これを実行すると、用語集のページ番号も 1 に変更されました。用語集で説明されている単語が書かれているページに到達するためにその 1 をクリックすると、ハイパーリファレンスによってドキュメントの最初のページであるタイトル ページに移動します。これは間違っています。ページ番号 1 で番号付けされたドキュメントの 3 ページ目に移動するはずです。この問題を解決する方法はありますか?
これは私のドキュメントのコードです:
\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
。