
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}