考虑一下代码
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.mst}
%delim_0 "\\IndexDotfill "
%delim_1 "\\IndexDotfill "
headings_flag 1
heading_prefix " \\IndexHeading{"
heading_suffix "}\n"
\end{filecontents*}
\documentclass{book}
\usepackage{xcolor}
\let\cleardoublepage\clearpage
\usepackage{imakeidx}
\makeindex
\usepackage{idxlayout}
\usepackage[tikz]{bclogo}
\usetikzlibrary{calc,shapes.callouts,shapes.arrows}
\newcommand*{\IndexDotfill}{%
\nobreak\dotfill\ \nobreak
}
\renewcommand*{\indexspace}{%
\par
\vspace{25pt plus 6pt minus 4pt}%
}
\newcommand*{\IndexHeading}[1]{%
\vspace{27pt}
\hfil \tikz\node[
rounded corners=5pt,
draw=red,
fill=red!65,
line width=1.3pt,
inner sep=10pt,
align=center,
font=\sffamily\bfseries\Large,
minimum width=1.25in
] {#1};%
\nopagebreak
\par
\vspace{2mm}%
\hfil }
% Make all page numbers in index bold
\let\oldindex\index
\renewcommand{\index}[1]{%
\oldindex{#1|textbf}%
}%
\begin{document}
\LARGE
\newpage A sentence.\index{Entry Heading@\textbf{\textcolor{black}{Entry Heading}}!Statement containing a subentry}
\index{Entry Heading@\textbf{\textcolor{black}{Entry Heading}}!Statement containing another subentry}
\index{Entry Heading@\textbf{\textcolor{black}{Entry Heading}}!Statement containing yet another subentry}
Another sentence.\index{Second Entry Heading@\textbf{\textcolor{black}{Second Entry Heading}}!Statement containing a subentry}
\index{Second Entry Heading@\textbf{\textcolor{black}{Second Entry Heading}}!Statement containing another subentry}
\index{Second Entry Heading@\textbf{\textcolor{black}{Second Entry Heading}}!Statement containing yet another subentry}
\idxlayout{columns=1}
%\idxlayout{columns=1,notesep=50pt}
\printindex
\end{document}
生成索引
我希望能够调整条目标题和后续子条目之间的间距。在查阅了 Idxlayout 文档后,我认为注释ep命令可能是我想要的,但是当我取消注释%\idxlayout{columns=1,notesep=50pt}
并使用它运行代码时--尽管值大到50pt,但每个主条目和其子条目之间的空间并没有明显变化。
问题:有人能告诉我如何调整(i)主条目和第一个子条目之间的间距;(ii)大写字母 E 和第一个条目之间的间距;以及(iii)给定类别的最后一个子条目和下一个大写字母之间的间距?
评论我正在寻找一种方法来做到这一点选项和命令的idxlayout package
;例如,
谢谢。
答案1
您或许可以将一些内容放入\vspace
.mst 文件中。不过,我不知道这是否真的是个好做法。
我标记了可以调整垂直间距的不同行。我稍微整理了一下你的代码,删除了本例中不必要的内容。
\documentclass{book}
\begin{filecontents*}{\jobname.mst}
item_x1 "\n\\vspace{20pt}\\subitem " % <-- spacing between level 0 and level 1 entry
headings_flag 1
heading_prefix "\\IndexHeading{"
heading_suffix "}\n"
\end{filecontents*}
\usepackage{xcolor}
\let\cleardoublepage\clearpage
\usepackage{imakeidx}
\makeindex
\usepackage{idxlayout}
\usepackage[tikz]{bclogo}
\usetikzlibrary{calc,shapes.callouts,shapes.arrows}
%\renewcommand*{\indexspace}{%
% \par
% \vspace{25pt plus 6pt minus 4pt}% % <-- spacing between index groups
%}
\newcommand*{\IndexHeading}[1]{%
\vspace{10pt}% % <-- spacing before heading box
\hfil
\tikz\node[
rounded corners=5pt,
draw=red,
fill=red!65,
line width=1.3pt,
inner sep=10pt,
align=center,
font=\sffamily\bfseries\Large,
minimum width=1.25in
] {#1};%
\nopagebreak
\par
\vspace{5pt}% % <-- spacing after heading box
\hfil }
% Make all page numbers in index bold
\let\oldindex\index
\renewcommand{\index}[1]{%
\oldindex{#1|textbf}%
}%
\begin{document}
\LARGE
\newpage A sentence.\index{Entry Heading@\textbf{Entry Heading}!Statement containing a subentry}
\index{Entry Heading@\textbf{Entry Heading}!Statement containing another subentry}
\index{Entry Heading@\textbf{Entry Heading}!Statement containing yet another subentry}
Another sentence.\index{Second Entry Heading@\textbf{Second Entry Heading}!Statement containing a subentry}
\index{Second Entry Heading@\textbf{Second Entry Heading}!Statement containing another subentry}
\index{Second Entry Heading@\textbf{Second Entry Heading}!Statement containing yet another subentry}
\idxlayout{columns=1}
%\idxlayout{columns=1,notesep=50pt}
\printindex
\end{document}