LaTeX:如何在書的中間包含索引

LaTeX:如何在書的中間包含索引

我需要在一本書的中間包含一個索引,因為我正在寫一個多卷的作品,將一個大的pdf分成5卷,索引應該出現在第一卷的末尾。

如果我\printidex在想要索引的地方執行此操作,則只會顯示到該點為止的索引項目。其餘的\indexentry只是由 LaTeX 寫入標準輸出,因此永遠不會進入索引。

有一個簡單的解決方案嗎?

一個MWE:

\documentclass[12pt]{article}
\usepackage{imakeidx}
\makeindex
\begin{document}
aaa\index{aaa}
\printindex
\clearpage % with this in, the index omits bbb; otherwise it's ok :(
bbb\index{bbb}
\end{document}

相關內容