在撰写关于现象 X 的文章时,我在整个文档中使用了太多次首字母缩略词 X。我还使用了许多其他首字母缩略词。似乎我不应该为首字母缩略词 X 包含一长串页码,而是可以在索引上方的一段话中说明,但最好在索引的脚注中说明类似“由于文档的主题是 X,并且提到次数太多,因此未将其包含在索引中”的内容。
希望能够帮助更改下面的 MWE,以便在索引下方打印脚注(首选),或在索引上方打印一段文本。
\documentclass{memoir}
\usepackage{makeidx}
\makeindex
\begin{document}
This document is about X. But it also mentions Y\index{Y}, Z\index{Z}, as well as A\index{A}, B\index{B} and C\index{C}.
% As this document is about X and it is used too many times throughtout the text, it is not included in the index.
\printindex
\end{document}
答案1
有一个钩子\preindexhook
,可以重新定义为在索引标题和索引条目之间插入内容:
\documentclass{memoir}
\usepackage{makeidx}
\makeindex
\begin{document}
This document is about X. But it also mentions Y\index{Y}, Z\index{Z}, as
well as A\index{A}, B\index{B} and C\index{C}.
\renewcommand*{\preindexhook}{%
As this document is about X and it is used too many times throughout the
text, it is not included in the index.\par
\indexspace
}
\printindex
\end{document}
我认为索引附加文本的最佳位置是索引标题和条目之间。作为脚注,文本只会扰乱条目列表。
由于默认索引使用双列布局,因此脚注有点棘手。以下示例将脚注作为单列脚注放在索引的第一页上。双列条目由multicols
具有平衡列的环境设置:
\documentclass[a5paper]{memoir}
\usepackage{multicol}
\makeatletter
\newif\ifindex@multicols
\renewenvironment{theindex}{%
\clearforchapter
\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\ifonecolindex
\onecolumn
\chapter*{\indexname}
\preindexhook
\else
\setlength{\columnseprule}{\indexrule}%
\setlength{\columnsep}{\indexcolsep}%
%\twocolumn[
\@makeschapterhead{\indexname\footnotemark}%
\footnotetext{\indexfootnotetext}%
\preindexhook
%]
\index@multicolstrue
\begin{multicols}{2}%
\fi
\indexmark
\ifnoindexintoc\else
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}%
\fi
\thispagestyle{indextitlepagestyle}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\let\item\@idxitem
}{%
\ifindex@multicols
\end{multicols}%
\else
\if@restonecol\onecolumn\else\twocolumn\fi
\fi
}
\makeatother
\makeindex
\newcommand*{\indexfootnotetext}{%
As this document is about X and it is used too many times throughout the
text, it is not included in the index.%
}
\begin{document}
\chapter{First chapter}
This document is about X. But it also mentions Y\index{Y}, Z\index{Z}, as
well as A\index{A}, B\index{B} and C\index{C}.
\printindex
\end{document}