
我真的很喜歡術語表中的 altlist-style,但我沒有找到一種方法來處理多行名稱,所以我尋找一種替代方案,並提出了索引樣式,它允許多行名稱名字,但在我看來很難看。基本上,我想要的不是縮排的名稱,而是描述,以及名稱和描述之間的一些空格(如 altlist 樣式)。
透過使用“\glstreepredesc”,這應該很容易實現,但我做不到。如果有人能幫忙那就完美了。 (或者,作為替代方案,是否有解決方案可以在 altlist 樣式中擁有多行名稱?)
這是一個 MWE
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass[fontsize=10pt]{scrbook}
\usepackage{geometry}
\geometry{
paperheight=213mm,
paperwidth=140mm,
left=16mm,
right=16mm,
top=21mm,
bottom=16mm,
heightrounded,
}
\usepackage[
nopostdot]{glossaries}
\makeglossaries
\newglossaryentry{long-long-long-argument}
{
name={The Name for the Very Long and the Most Important Argument in the Text},
text={The Name for the Very Long and the Most Important Argument in the Text},
description={The Very Long Description of the Very Long and the Most Important Argument in the Text. The Very Long Description of the Very Long and the Most Important Argument in the Text.}
}
\newglossaryentry{short-argument}
{
name={Very Short argument.},
text={Very Short argument.},
description={Description of a very short argument. Description of a very short argument.},
}
\renewcommand{\glstreepredesc}{%
\glstreeitem\parindent\hangindent}
\begin{document}
\gls{long-long-long-argument} \gls{short-argument}
\printglossary[style=index,nonumberlist]
\end{document}
答案1
list
(因此altlist
)僅使用description
列表來排版術語表,因此我們可以使用它enumitem
來調整其行為。加載此包並使用後altlist
,我們只需說即可獲取要破壞的名稱
\setlist[description]{style=unboxed}
為了使名稱的所有行左對齊(我不確定這是一個好主意),我們可以定義自訂對齊方式。
\SetLabelAlign{horstfuchs}{\parbox[b]{\textwidth}{#1}}
\setlist[description]{style=unboxed, align=horstfuchs, labelsep=0pt}
為了不改變定義全部 description
在清單中的文件中,您應該建立適當的術語表樣式,而不是只更改全域設定。
\SetLabelAlign{horstfuchs}{\parbox[b]{\textwidth}{#1}}%
\newglossarystyle{horstfuchs}{%
\setglossarystyle{altlist}%
\renewenvironment{theglossary}%
{\glslistinit\begin{description}[style=unboxed, align=horstfuchs, labelsep=0pt]}%
{\end{description}}%
}