
注: インデックス生成パッケージに関する回答は有益です。たとえば、splitidx
またはデフォルトmakeidx
。
本の索引ページに説明文が載っている本を見たことがあります。索引タイトルですが、実際のインデックス リストの前にあります。.idx
または.ind
ファイルを手動で変更せずにこれを行うにはどうすればよいですか? コマンドはprintindex
まったく不可能のようです。
ここに適切だが残念ながら小さな例を示します。
以下は、パッケージを使用する MWE ですmakeidx
。
\documentclass[12pt]{book}
\usepackage{makeidx}\makeindex
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\index{1@One makeidx entry!With a subentry}
%How to put text on the following index page?
\printindex
%Be sure to run: makeindex <filename>
\end{document}
splitidx
以下は、パッケージを使用して2 つのインデックスを作成するMWE です。
\documentclass[12pt]{book}
\usepackage[split]{splitidx}\makeindex
\newindex{firstindex}
\newindex{secondindex}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\sindex[firstindex]{1@One splitindex entry!Using firstindex}
\sindex[secondindex]{Another splitindex entry!Using secondindex}
%How to put text on the following index pages?
\printindex[firstindex][A splitindex: firstindex]
\printindex[secondindex][A splitindex: secondindex]
%Be sure to run: makeindex <filename>-firstindex; makeindex <filename>-secondindex
\end{document}
答え1
パッケージを使用するimakeidx
の代わりに を使用makeidx
します。このパッケージはより堅牢で、次のことが可能です。
複数の列にインデックスを付ける
\makeindex[columns=n]
前のテキスト索引そしてその後タイトルと併用してください
\indexprologue{Text ...}
。このコマンドは の直前に置く必要があります\printindex
。自動的に実行します
makeindex
。splitindex
Markus Kohm によるスクリプトのサポート。その他のオプションについては、ドキュメンテーション。
MWEの例
\documentclass[12pt]{book}
\usepackage{imakeidx}\makeindex
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\index{1@One entry!With a subentry}~\index{a@Other entry}
\indexprologue{\noindent How to put text on the following index page?}
\printindex
\end{document}
このパッケージを使用して複数のインデックスを生成することもできます。この場合、オプションを使用してパッケージをロードsplitindex
しmakeindex
、<filename>-firstindex
および<filename>-secondindex
(firstindex
およびがインデックスの名前である場合) で実行する必要があります。または、またはオプションを使用してsecondindex
実行してこれを自動的に行います。pdflatex
--enable-write18
-shell-escape
注記:すべてのインデックスに名前を付ける必要はありません( のようにsplitidx
)。単に「メイン」インデックスに名前を付けず、他のインデックスに名前を付けます。そして、\makeindex
(引数なしで)を使用します。主要インデックス)と\makeindex[name=...,title=...]
他のインデックスについて見てみましょう。例を見てください
\documentclass[12pt]{book}
\usepackage[splitindex]{imakeidx}
\makeindex
\makeindex[name=secondindex,title=Second Index]
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\index{1@One splitindex entry!Using firstindex}
\index[secondindex]{Another splitindex entry!Using secondindex}
\indexprologue{\noindent How to put text on the following index pages?}
\printindex
\indexprologue{\noindent How to put text on the following index pages in the second index?}
\printindex[secondindex]
%Be sure to run: makeindex <filename>-splitindex; makeindex <filename>-secondindex
%Only if you didn't run pdflatex with the `--enable-write18` option.
\end{document}
そこで、ファイルが作成され<filename>-splitindex.idx
ます主要インデックスと<filename>-secondindex.idx
2番目のインデックスです。主要\indexname
インデックスのタイトルに使用します。
走る
pdflatex --enable-write18 <filename>
これを自動的に実行します。
\documentclass[12pt]{book}
\usepackage[splitindex]{imakeidx}
\makeindex[name=firstindex,title=First Index]
\makeindex[name=secondindex,title=Second Index]
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\index[firstindex]{1@One splitindex entry!Using firstindex}
\index[secondindex]{Another splitindex entry!Using secondindex}
\indexprologue{\noindent How to put text on the following index pages?}
\printindex[firstindex]
\indexprologue{\noindent How to put text on the following index pages in the second index?}
\printindex[secondindex]
%Be sure to run: makeindex <filename>-firstindex; makeindex <filename>-secondindex
\end{document}