我想在词汇表条目名称中换行,如下例所示:
特别是在以下情况下换行:
likvidatsiya posledstviy primeneniya protivnikom oruzhiya %at this position% massovogo porazheniya
\documentclass{article}
\usepackage[style=altlisthypergroup]{glossaries-extra}
\newglossaryentry{likvidatsiya-posledstviy-primeneniya-protivnikom-oruzhiya-massovogo-porazheniya}{%
name={likvidatsiya posledstviy primeneniya protivnikom oruzhiya massovogo porazheniya},%
description={Eliminating the effects of enemy use of weapons of mass destruction (decontamination) - the aggregate of measures taken to clear up the effects of enemy use of nuclear, biological, and chemical warfare. This is done to restore, in a short period, the disrupted combat efficiency of friendly troops, and to create conditions permitting successful completion of the missions assigned to them.%
}
}
\begin{document}
water is good but \gls{likvidatsiya-posledstviy-primeneniya-protivnikom-oruzhiya-massovogo-porazheniya} is better
\printglossaries
\end{document}
答案1
要打破条目名称行,我们需要插入一个\\
。
以前,条目名称必须封装在parbox
基于 的新样式中,并altlisthypergroup
进行定义。
前(需要添加 MWE\makeglossaries
才能编译)
后
\documentclass{article}
\usepackage{glossaries-extra}
\makeglossaries % added <<<<<<<<<<<<<
\newglossaryentry{likvidatsiya-posledstviy-primeneniya-protivnikom-oruzhiya-massovogo-porazheniya}{%
name={likvidatsiya posledstviy primeneniya protivnikom oruzhiya \\ massovogo porazheniya},%
description={Eliminating the effects of enemy use of weapons of mass destruction (decontamination) - the aggregate of measures taken to clear up the effects of enemy use of nuclear, biological, and chemical warfare. This is done to restore, in a short period, the disrupted combat efficiency of friendly troops, and to create conditions permitting successful completion of the missions assigned to them.%
} % \\ inserted
}
\newglossarystyle{altlisthypergroup2}{% added <<<<<<<<<<<<<
\setglossarystyle{altlisthypergroup}%
\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{##1}\glstarget{##1}
{\parbox[t]{\textwidth}{\glossentryname{##1}}}]
\mbox{}\par\nobreak
\glossentrydesc{##1}\glspostdescription\space ##2}%
}
\glossarystyle{altlisthypergroup2} % added <<<<<<<<<<<<<
\begin{document}
water is good but \gls{likvidatsiya-posledstviy-primeneniya-protivnikom-oruzhiya-massovogo-porazheniya} is better
\printglossaries
\end{document}