当我制作包含多列的索引并且某个单词被索引了很多次时,有时它会在索引中出现两行或更多行。但在第一行之后的行中,左侧有一个很大的边距,这不美观并且浪费了一些空间。我希望显示每个页码时,第一行之后的左侧没有任何边距。
以下是 MWE:
\documentclass{scrbook}
\usepackage{imakeidx}
\makeindex[name=index1, title=XXX, columns=3, columnsep=150pt]
\begin{document}
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
\printindex[index1]
\end{document}
这是边缘的图片。
谢谢您的回答。
答案1
试试这个代码。已添加补丁来删除左边距。
这是完整的代码。(还添加了更多内容来验证代码。)
\documentclass{scrbook}
\usepackage{imakeidx}
\makeindex[name=index1, title=XXX, columns=3, columnsep=150pt]
% ******************************** added <<<<<<<<<<<<<<<<
\usepackage{xpatch}
\tracingpatches
\xpatchcmd{\theindex}
{\let\item\@idxitem}
{\let\item\space}
{}{}
% ********************************
\begin{document}
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
toto\index[index1]{toto}
\clearpage
tata\index[index1]{tata}
\clearpage
totox\index[index1]{totox}
\clearpage
tatax\index[index1]{tatax}
\clearpage
totox\index[index1]{totox}
\clearpage
tatax\index[index1]{tatax}
\clearpage
totox\index[index1]{totox}
\clearpage
totox\index[index1]{totox}
\clearpage
tatax\index[index1]{tatax}
\clearpage
totox\index[index1]{totox}
\clearpage
tatax\index[index1]{tatax}
\clearpage
totox\index[index1]{totox}
\clearpage
tatax\index[index1]{tatax}
\clearpage
\printindex[index1]
\end{document}