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