链接到命名法未到达正确的页面

链接到命名法未到达正确的页面

我已附上pdf 输出问题本质上是什么。在文档的末尾我有一个命名法。命名法包含定义,并带有指向文档中第一次出现条目的超链接。这些链接运行良好,单击它们会将我发送到正确的位置。

每个定义在正文中以两种方式出现。第一次出现时,它将以洋红色文本显示,并链接到命名法(同样,这也是命名法所链接的位置)。每次出现后,文本将变为黑色,但仍可点击,并将读者引导至命名法(然后,读者可以点击链接找到它首次定义的位置,以获得比命名法提供的更多详细信息)。

命名法中的链接完美地引导读者第一次看到该条目的定义。但是,正文中的链接均未正确链接到命名法(在 pdf 文档中,如果您单击其中一个,则会进入第 7 章)。

基本上,用户命令定义的洋红色文本(和黑色文本链接)应该链接到命名法,但它失败了,我不知道原因!

我认为关键是

\usepackage[intoc, refpage]{nomencl}
    \renewcommand{\nomname}{Notation index}
    \renewcommand*{\pagedeclaration}[1]{\unskip, page \hyperpage{#1}}
    \makenomenclature

然后我如何定义与命名法的联系

\printnomenclature{}\hypertarget{abbr}

或者

\hypertarget{abbr}{\printnomenclature{}}

两者都不起作用。

\documentclass[11pt]{book}
\usepackage[a4paper,twoside,top=2cm, bottom=2cm, outer=2cm, inner=4cm]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}
\usepackage{chngcntr}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[subfigure]{tocloft}     % makes table of contents
\usepackage[toc,page]{appendix}   
\usepackage{tocbibind}              % ads toc to toc
\usepackage{subfigure}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% HYPERLINKS
\usepackage[hidelinks, pageanchor]{hyperref}    % Load after fancyhdr, float, fncychap; before algorithm, cleveref
    \hypersetup{colorlinks,linkcolor=blue,urlcolor=blue,citecolor=red}
\usepackage[noabbrev]{cleveref}     % Must load after hyperref
    \crefformat{section}{\S#2#1#3}  % See manual of cleveref, section 8.2.1

% GNOMES
\usepackage[intoc, refpage]{nomencl}
    \renewcommand{\nomname}{Notation index}
    \renewcommand*{\pagedeclaration}[1]{\unskip, page \hyperpage{#1}}
    \makenomenclature

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%this is for gnomes
\newcommand{\gnome}[1]             {    \hyperlink{abbr}{ \textcolor{black}{ #1}}   }
\newcommand{\gnomedef}[3] {     \hyperlink{abbr}{\textcolor{magenta}{#1}}\nomenclature{#2}{#3}   }


\begin{document}
    
    
\tableofcontents

\chapter{chapter 1}
\gnomedef{something}{something}{something} 

\gnome{something} 

\chapter{chapter 2}
\chapter{chapter 3}
\chapter{chapter 4}
\chapter{chapter 5}
\chapter{chapter 6}
\chapter{chapter 7}


\fancypagestyle{plain}{}
\setlength{\cftbeforetoctitleskip}{-1.2em}
\hypertarget{abbr}{\printnomenclature{}}

%\printnomenclature{}\hypertarget{abbr}
\cleardoublepage
    

\end{document}

编辑 - 找到解决方案。针对目录问题

\AtBeginDocument{%
    \addtocontents{toc}{\protect\afterpage\protect\cleardoublepage}%
    \addcontentsline{toc}{chapter}{\protect\textbf{Contents}}
}

\fancypagestyle{style1}{ 
    \pagestyle{fancyplain}
    \renewcommand{\headrulewidth}{1pt}          % 0pt no header rule; 0.4pt standard header rule
    \fancyhead[RO,LE]{\thepage      \hypertarget{toc}}
    \fancyhead[LO]{}
    \fancyhead[RE]{}
    \cfoot{}
}

作品。

对于命名法链接问题,解决方案似乎是不使用命名法而是使用词汇表包。

相关内容