当我使用该glossaries
包处理我的符号时,hyperref
文本中的符号不起作用。每个引用都转到我的文档的第一页。
我该如何解决超链接链接到我的符号页面的问题?
还有一个小问题:我可以按字母顺序对符号进行排序吗?谢谢大家。
这里是 MWE:
\documentclass[
ngerman,
11pt,
]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[
hidelinks,
breaklinks
]{hyperref}
\usepackage{longtable}
\usepackage{siunitx}
%% Glossaries
\usepackage[
automake,
nonumberlist,
acronym,
toc,
]{glossaries}
%% Symbolverzeichnis
\newglossary[slg]{symbols}{syi}{syg}{Symbolverzeichnis}
\makeglossaries
\newif\ifsubhead
\renewcommand*{\glspostdescription}{}
\glssetnoexpandfield{useri}
\newglossarystyle{mysymbols}{
\renewenvironment{theglossary}%
{\renewcommand*{\arraystretch}{1.5}
\begin{longtable}[l]{@{}csp{\glsdescwidth}p{\glspagelistwidth}@{}}}
{\end{longtable}}%
\renewcommand*{\glossaryheader}{}
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}%
\ifglshassymbol{##1}{
\global\subheadfalse
\glossentrysymbol{##1}%
}{%
\global\subheadtrue
\glstarget{##1}{%
\rule{0pt}{2pc}
\makebox[0pt][l]{\glossentryname{##1}}
\hphantom{\textbf{Symbol}}
}
} &
\glsentryuseri{##1} &
\glossentrydesc{##1}
\glspostdescription & ##2
\ifsubhead
\tabularnewline[1pc]
\bfseries Symbol & \bfseries Einheit & \bfseries Beschreibung\tabularnewline[1pc]
\else
\tabularnewline
\fi
}%
\renewcommand{\subglossentry}[3]{
\glossentry{##2}{##3}
}%
\renewcommand*{\glsgroupskip}{\relax}
}
\renewcommand{\glsnamefont}[1]{\textbf{#1}}
\newglossaryentry{romanletter}{name={\textbf{\large Lateinische Buchstaben}},description={}}
\newglossaryentry{greekletter}{name={\textbf{\large Griechische Buchstaben}},description={}}
\newglossaryentry{symb:c}{
name=Lichtgeschwindigkeit,
description={Lichtgeschwindigkeit},
symbol={$c$},
type=symbols,
user1={\meter\per\second},
parent=romanletter
}
\newglossaryentry{symb:freq}{
name=Frequenz,
description={Frequenz},
symbol={$f$},
type=symbols,
user1={\per\second},
parent=romanletter
}
\newglossaryentry{symb:eta}{
name=Wirkungsgrad,
description={Wirkungsgrad},
symbol={$\eta$},
type=symbols,
user1={-},
parent=greekletter
}
\usepackage{blindtext}
\begin{document}
\blindtext[5]
\newpage
\printglossary[title=Symbolverzeichnis,type=symbols,style=mysymbols] \newpage
\gls{symb:c} and \gls{symb:eta} and \gls{symb:freq}
\end{document}
答案1
您的样式定义中缺少目标命令
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}%
\ifglshassymbol{##1}{
\global\subheadfalse
\glstarget{##1}{\glossentrysymbol{##1}}% <-------------
}{%