在術語表列表的名稱和描述之間包含 \dotfill

在術語表列表的名稱和描述之間包含 \dotfill

我試圖\dotfill在縮寫列表的術語表條目的名稱和描述之間包含使用詞彙表包裹

我已經設法獲得我想要的輸出:

\renewcommand{\glossentry}[2]{\glsentryname{#1}\dotfill\glossentrydesc{#1}\par}

但我收到了 45 個這樣的錯誤:

LaTeX Error: Something's wrong--perhaps a missing \item.

詞彙表列表在沒有該行的情況下打印得很好,只是不是我想要的格式。

這是我想要的輸出,沒有錯誤:

所需輸出

這是導致相同錯誤的範例程式碼片段:

\documentclass{article}
\usepackage[nonumberlist, nopostdot]{glossaries}

\makeglossaries

\newacronym{adl}{ADL}{Activities of Daily Living}
\newacronym{cmc}{CMC}{Carpometacarpal}
\newacronym{dip}{DIP}{Distal Interphalangeal}

\begin{document}

\renewcommand{\glossentry}[2]{\glossentryname{#1}\dotfill\glossentrydesc{#1}\par}

\printglossary[type=\acronymtype, title=List of Acronyms]



\section*{Main Body}
\acrfull{adl}, \acrfull{cmc},\acrfull{dip}

\end{document}

謝謝你!

答案1

預設詞彙表樣式本質上是一個description環境,​​因此它期望至少有一個\item.

您可以重新定義theglossary

\renewenvironment{theglossary}{\glslistinit\setlength{\parindent}{0pt}}{}

因此條目不會在description環境中排版(\setlength{\parindent}{0pt}MWE 需要進行類似的操作才能獲得一致的縮排)。

或者您可以調整預設值\glossentry,使用\items 包含\dotfillas

\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{#1}%
\glstarget{#1}{\glossentryname{#1}}]%
\dotfill%
\glossentrydesc{#1}\glspostdescription\space#2}

這將受到影響,enumitem這可能會使間距/定位更容易修改。

相關內容