在 中glossaries
,使用选项listhypergroup
,当字母列表太长而页面太窄时会出现问题:由于它不会折叠,它会超出页面宽度,从而产生
该问题有解决办法吗?
\documentclass{article}
\usepackage[left = 8cm, right = 8cm, showframe]{geometry}
\usepackage{hyperref}
\usepackage[nogroupskip]{glossaries}
\newglossaryentry{Almond}{ name=Almond, description={A fruit},
sort={Almond} }
\newglossaryentry{Berry}{ name=Berry, description={Another fruit},
sort={Berry} }
\newglossaryentry{Cherry}{ name={Cherry}, description={Yet another fruit},
sort={Cherry} }
\newglossaryentry{Date}{ name={Date}, description={Yet another fruit},
sort={Date} }
\newglossaryentry{Elderberry}{ name={Elderberry}, description={Yet another fruit},
sort={Elderberry} }
\newglossaryentry{Flour}{ name={Flour}, description={Not a fruit but useful for cakes}, sort={Flour}}
\newglossaryentry{Grenade}{ name={Grenade}, description={Only the one that does not blow up is a fruit}, sort={Grenade} }
\newglossaryentry{Hammer}{ name={Hammer}, description={Definitely not a fruit}, sort={Hammer} }
\newglossaryentry{Tomato}{ name={Tomato}, description={Again another fruit},
sort={Tomato} }
\newglossaryentry{Strawberry}{ name={Strawberry}, description={Not a fruit},
sort={Strawberry} }
\newglossaryentry{Walnut}{ name={Walnut}, description={Shell fruit},
sort={Walnut} }
\makenoidxglossaries
\begin{document}
\gls{Almond}, \gls{Berry}, \gls{Cherry}, \gls{Elderberry}, \gls{Grenade}, \gls{Walnut} and \gls{Tomato} are fruits, unlike \gls{Strawberry}, \gls{Hammer} and \gls{Flour}.
%\renewcommand{\glssymbolsgroupname}{Non-fruits}
\printnoidxglossary[sort=standard,style=listhypergroup]
\end{document}
答案1
导航线没有断开的原因是(由于某种原因)它是在description
环境中排版的,代码是:
\item[<navigation line>]
我不知道为什么会这样,但事实证明,由于导航线是通过命令设置的,因此可以轻松修复。这里唯一的技巧是,由于我们处于描述环境中,我们希望避免与此环境相关的缩进,这就是为什么我在下面的解决方案\glossaryheader
中用一个包围导航线的原因。\parbox
\documentclass{article}
\usepackage[
hmargin=8cm,
showframe
]{geometry}
\usepackage{hyperref}
\usepackage[
style=listhypergroup,
]{glossaries}
\renewcommand{\glossaryheader}{\item \parbox{0.9\textwidth}{\glsnavigation}}
\newglossaryentry{A}{name=A, description={Letter of the alphabet}}
\newglossaryentry{B}{name=B, description={Letter of the alphabet}}
\newglossaryentry{C}{name=C, description={Letter of the alphabet}}
\newglossaryentry{D}{name=D, description={Letter of the alphabet}}
\newglossaryentry{E}{name=E, description={Letter of the alphabet}}
\newglossaryentry{F}{name=F, description={Letter of the alphabet}}
\newglossaryentry{G}{name=G, description={Letter of the alphabet}}
\newglossaryentry{H}{name=H, description={Letter of the alphabet}}
\newglossaryentry{I}{name=I, description={Letter of the alphabet}}
\newglossaryentry{J}{name=J, description={Letter of the alphabet}}
\newglossaryentry{K}{name=K, description={Letter of the alphabet}}
\newglossaryentry{L}{name=L, description={Letter of the alphabet}}
\newglossaryentry{M}{name=M, description={Letter of the alphabet}}
\newglossaryentry{N}{name=N, description={Letter of the alphabet}}
\newglossaryentry{O}{name=O, description={Letter of the alphabet}}
\newglossaryentry{P}{name=P, description={Letter of the alphabet}}
\newglossaryentry{Q}{name=Q, description={Letter of the alphabet}}
\newglossaryentry{R}{name=R, description={Letter of the alphabet}}
\newglossaryentry{S}{name=S, description={Letter of the alphabet}}
\newglossaryentry{T}{name=T, description={Letter of the alphabet}}
\newglossaryentry{U}{name=U, description={Letter of the alphabet}}
\newglossaryentry{V}{name=V, description={Letter of the alphabet}}
\newglossaryentry{W}{name=W, description={Letter of the alphabet}}
\newglossaryentry{X}{name=X, description={Letter of the alphabet}}
\newglossaryentry{Y}{name=Y, description={Letter of the alphabet}}
\newglossaryentry{Z}{name=Z, description={Letter of the alphabet}}
\makeglossaries
\begin{document}
\glsaddall
\printglossary
\end{document}
最后,如果您想|
用其他东西替换分隔符,则必须重新定义\glshypernavsep
:
\renewcommand*{\glshypernavsep}{\space}