
imakeidx
我知道我可以將包與包結合起來更改索引字體大小,idxlayout
如下所示:
\usepackage{imakeidx}
\usepackage[font=footnotesize]{idxlayout}
但是我想知道是否可以僅使用該imakeidx
包(也許使用命令othercode
的鍵\indexsetup
)。
答案1
可以使用 修改索引格式\indexsetup
,它將鍵值對列表作為參數;在你的情況下關鍵是othercode
:
\indexsetup{othercode=\small}
作為鍵值給出的程式碼是在索引正文排版之前插入的,因此這不會影響標頭。
但請注意,該影響是全球性的,將影響所有指數。
答案2
雖然可以只使用 來減少索引字體大小imakeidx
,但索引標題和第一個條目之間的空間將比「正常」標題之後的字體大小切換所產生的空間稍大。如果使用idxlayout
,間距將相同。以下 MWE 包含這兩種變體;註解/取消註解對應的行並進行比較。
\documentclass{article}
\usepackage{imakeidx}
\makeindex
% Variant A
\usepackage[font=footnotesize]{idxlayout}
% Variant B
% \indexsetup{othercode=\footnotesize}
\begin{document}
\section*{Unnumbered section}
\footnotesize
foo, 1\index{foo}
\clearpage
\normalsize
\printindex
\end{document}