
考慮 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}