Hyperref 将词汇表链接指向首页而不是词汇表

Hyperref 将词汇表链接指向首页而不是词汇表

我的词汇表/超链接有问题。我文本中使用的词汇表是链接,但仅指向第一页,而不是“缩写”或“符号”。代码分布在多个文件中,我已尽可能简化它以重现问题。

有人对这个问题有什么想法吗?我在谷歌上找到的所有方法都无法解决我的问题。

感谢每一个有帮助的回复。

\documentclass[
    twoside,
    open=right,
    a4paper,
    pdftex,
    toc=bibliography,
    12pt,
    DIV=14,
    BCOR=6mm,
    headsepline
    ]{scrbook}
        \usepackage[a4paper]{geometry}
        \usepackage[english]{babel}
        \usepackage{blindtext}
        \usepackage{amsmath}
        \usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = black, urlcolor = blue]{hyperref}
        \usepackage[capitalise, nameinlink]{cleveref} 
        \usepackage[nonumberlist, toc, nomain, nopostdot, acronym, nogroupskip,automake]{glossaries}
        \usepackage[stylemods=longextra]{glossaries-extra}
        \newglossary[sym]{symbolslist}{syt}{syn}{Symbols}
        \newglossary[alg]{Abbreviations}{acr}{acn}{Abbreviations}
        \newglossarystyle{symunit}{%  
            \setglossarystyle{long-name-desc-sym}
                \renewenvironment{theglossary}
                {\begin{longtable}[l]{@{}lp{\glsdescwidth}lp{\glsdescwidth}}}
                {\end{longtable}}
            \renewcommand*{\glossaryheader}{
                \bfseries Symbol & \bfseries Description & \bfseries Unit  
                                    \\\endhead}
            \renewcommand*{\glossentry}[2]{
                \glsentryname{##1}
                & \glossentrydesc{##1}
                & \glossentrysymbol{##1}
                \tabularnewline
            }%
                                    } 
        \newglossarystyle{abbre}{ 
            \setglossarystyle{long-name-desc}
                \renewenvironment{theglossary}
                {\begin{longtable}[l]{@{}lp{\glsdescwidth}lp{\glsdescwidth}}}  
                {\end{longtable}}
            \renewcommand*{\glossaryheader}{
                \bfseries Abbreviations & \bfseries Description  
                                    \\\endhead}
                \renewcommand*{\glossentry}[2]{
                \glossentryname{##1}
                & \glossentrydesc{##1}
                \tabularnewline
            }
                                    }

        \makeglossaries
    \newglossaryentry{abr:bet}{name=BET,
        description={Brunauer-Emmett-Teller},
        first={Brunauer-Emmett-Teller (BET)},
        sort = BET,
        type = Abbreviations}

    \newglossaryentry{abr:bjh}{name=BJH,
        description={Barrett-Joyner-Halenda},
        first={Barrett-Joyner-Halenda (BJH)},
        sort = BJH,
        type = Abbreviations}


    \newglossaryentry{abr:xps}{name=XPS,
        description={X-ray photoelectron spectroscopy},
        first={X-ray photoelectron spectroscopy (XPS)},
        sort = xps,
        type = Abbreviations}

    \pdfminorversion=7
    \begin{document}
    \frontmatter
    \pagenumbering{Roman}
    \begin{titlepage}
    \pdfbookmark{Titelblatt}{Titelblatt}
    \hypertarget{Titelblatt}{}

    \blindtext
    \cleardoubleemptypage

    {\Large \textbf{Abstract}}\\
    \blindtext
    \end{titlepage}
    \printglossary[type=Abbreviations,title=Abbreviations,style=abbre]

    \tableofcontents
    \mainmatter
    \chapter{Introduction}
    \blindtext
    \gls{abr:bjh}
    \gls{abr:bet}
    \gls{abr:xps}


\end{document}

答案1

您的样式定义错误。在条目定义中,您应该使用 \glstarget,以便 hyperref 找到链接的锚点。例如:

       \renewcommand*{\glossentry}[2]{%
          \glstarget{##1}{\glossentryname{##1}}%<--------------
           & \glossentrydesc{##1}
          \tabularnewline}

相关内容