
MWE について考えてみましょう。
\documentclass[12pt]{article}
\usepackage{imakeidx}
\makeindex
\newcommand\pagedot[1]{#1.}
\usepackage{idxlayout}
\begin{document}
This is a sentence.\index{\textbf{Corresponds to the first sentence}|pagedot}
This is another sentence.\index{\textbf{Corresponds to the second sentence}}
This is another sentence.\index{\textbf{Corresponds to the third sentence}}
\idxlayout{columns=1}
\printindex
\end{document}
これにより、次のインデックスが生成されます。
ご覧のとおり、新しく定義したコマンドを呼び出して、最初のエントリのページ番号の後にピリオドを追加しました。pagedot
ただし、すべてのインデックス エントリに対して同様の操作を実行したいと思います。
質問: 各索引項目の最後のページ番号の後にピリオドを自動的に追加するにはどうすればよいですか?
ありがとう。
答え1
この質問は、他の投稿のコメントで既に回答されていると思います。スタイル ファイル ( ) を使用してキーを に*.ist
設定し、最後のページ番号の後の各エントリの後にピリオドを生成する実例を作成しました。delim_t
"."
\begin{filecontents*}{style.ist}
delim_t "."
\end{filecontents*}
\documentclass[12pt]{article}
\usepackage{imakeidx}
\makeindex[options=-s style.ist]
\usepackage{idxlayout}
\idxlayout{columns=1}
\begin{document}
This is a sentence.\index{\textbf{Corresponds to the first sentence}}
This is another sentence.\index{\textbf{Corresponds to the second sentence}}
This is another sentence.\index{\textbf{Corresponds to the third sentence}}
\clearpage
This is a sentence.\index{\textbf{Corresponds to the first sentence}}
This is another sentence.\index{\textbf{Corresponds to the second sentence}}
\clearpage
This is a sentence.\index{\textbf{Corresponds to the first sentence}}
\printindex
\end{document}