
我正在處理一個定義清單(LOD),本質上,它是下面程式碼中呈現的定義(編號除外)。我遇到的問題是,對於大量數字,LOD 上的編號和標題有一些重疊。我想增加 LOD 的所有定義(項目)的編號和標題的間隔。我嘗試使用 ussing \setlength{\cftdefnumwidth}{}
(我在一個類似的問題上發現了它),但它不起作用(“未定義控制序列”)。如何增加 LOD 中每個項目的編號和標題的分離度?
接下來是我的 LOD 的 MWE,其中包含五個項目,每個第 n 個項目的編號為 10^(n-1),以顯示我遇到的問題。稍後會附上一張圖來顯示根據程式碼產生的 PDF。
\documentclass{report}
\usepackage{tocloft}
\newlistof{definitions}{def}{Definitions} %making of the list
\newcommand{\defil}[1] %creating the command for adding definitions to the list (and numbering them)
{%
\refstepcounter{definitions}
\addcontentsline{def}{definitions}
{\protect\numberline{\thedefinitions}#1}\par
}
\begin{document}
\listofdefinitions %including the list
\defil{lorem ipsum} %adding element "lorem ipsum" to the list of definitions
\addtocounter{definitions}{8} %adding one digit to the numbering
\defil{lorem ipsum} %adding element "lorem ipsum" to the list of definitions
\addtocounter{definitions}{89} %adding one digit to the numbering
\defil{lorem ipsum} %adding element "lorem ipsum" to the list of definitions
\addtocounter{definitions}{899} %adding one digit to the numbering
\defil{lorem ipsum} %adding element "lorem ipsum" to the list of definitions
\addtocounter{definitions}{8999} %adding one digit to the numbering
\defil{lorem ipsum} %adding element "lorem ipsum" to the list of definitions
\end{document}
答案1
我透過在序言中加入以下文字來解決這個問題:
\makeatletter
\renewcommand\l@definitions{\@dottedtocline{1}{5em}{3em}}
\makeatother
第三個參數(包含「3em」的參數)對應於 numwidth,即包含編號的 boox 的大小。增加該參數的值將增加所需的分離。這裡您可以找到建立自己的[空白]清單問題的完整解決方案。透過在網站上搜尋“numwidth”,您將找到一篇文章,其中更詳細地描述了此程式碼的用途。