我在使用 idxlayout 格式化索引时遇到了一些麻烦。
正如我的 MWE 所证明的那样,垂直的条目之间的间距不一致。例如,条目组 A 中的条目之间的垂直间距比 D 中的大。组本身的间距是可变的:D 和 E 的间距正常,而 A 和 B 的间距则不正常。
我的真实示例(太大)甚至更糟。有时中间列只填充了 6 行,不规则地分布在整个列中,而其他行则填充了更多条目。
如何防止橡胶间隙并使用固定的一?
可选:我如何设置惩罚以防止只有组长单独出现?
非常感谢您的帮助!
% !TEX encoding = UTF-8 Unicode
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[%
12pt,a4paper,twoside,parskip=never,ngerman,headings=normal,]{scrbook}
\setlength\parindent{0pt}
\usepackage[english,main=ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents*}{xindystyle.xdy}
(define-location-class "Roman-page-numbers" ("roman-numbers-uppercase"))
(define-location-class "arabic-page-numbers" ("arabic-numbers")
:min-range-length 1)
(define-attributes (("definition" "usage" "default" "hyperpage")))
(define-crossref-class "see")
(markup-crossref-list :class "see" :open "\seelinkk{" :sep "; " :close "}{}")
(define-crossref-class "seealso")
(markup-crossref-layer-list :sep ", ")
(markup-crossref-list :class "seealso" :open "\seealsolinkk{" :sep "; " :close "}{}")
(markup-range :class "arabic-page-numbers" :close "\,f." :length 1 :ignore-end)
(markup-range :class "arabic-page-numbers" :close "\,ff." :length 2 :ignore-end)
(markup-range :class "arabic-page-numbers" :sep "--")
(define-crossref-class "hyperindexformat")
(markup-crossref-list :class "hyperindexformat" :open
"\hyperindexformat{" :sep "; " :close "}{}")
(define-location-class-order (
"Roman-page-numbers"
"arabic-page-numbers"
"see"
"seealso"))
(sort-rule "-" "")
(markup-index :open "~n\begin{theindex}
\providecommand*\lettergroupDefault[1]{}
\providecommand*\lettergroup[1]{%
\par\textbf{#1}\par
\nopagebreak
}
\newcommand{\targetindexentryy}[1]{\hypertarget{index:#1}{#1}}
\newcommand{\seelinkk}[1]{\see{\hyperlink{index:#1}{#1}}}
\newcommand{\seealsolinkk}[1]{\seealso{\hyperlink{index:#1}{#1}}}
~n"
:close "~n~n\end{theindex}~n"
:tree)
(markup-indexentry :open "~n \item " :depth 0)
(markup-indexentry :open "~n \subitem " :depth 1)
(markup-indexentry :open "~n \subsubitem " :depth 2)
(markup-locref-list :sep ", ")
(markup-locclass-list :open "\dotfill " :close "" :sep ", ")
(markup-locref :open "\hyperpage{" :close "}")
(markup-locref :open "\hyperpage{" :close "}" :attr "hyperpage")
(markup-keyword-list :open "\targetindexentryy{" :close "}" )
\end(filecontents)
\usepackage[
]{imakeidx}
\makeindex[
columns=3,
name=person,
title={Personenverzeichnis},
program=truexindy,
options=-M texindy -M page-ranges -M xindystyle -C utf8 -L german-duden,
]
\usepackage[%
totoc=true,
columns=3,
itemlayout=abshang,
unbalanced=true,
indentunit=0.5cm,
]{idxlayout} % Index layout
\newcommand{\person}[2][]{%
\ifstrempty{#1}{%
\textsc{#2\index[person]{#2}}}{%
\textsc{#2\index[person]{#1}}{}}%
}
\usepackage[%
hyperindex=false,hypertexnames=true,plainpages=false,breaklinks=true,hidelinks,pageanchor=true,
]{hyperref}
\begin{document}
\raggedbottom
\person{A} \person{Aa} \person{Ab} \person{Ae} \person{B} \person{ba} \person{bbA} \person{bcA} \person{dc} \person{d} \person{ce} \person{dee} \person{fe} \person{ff} \person{few} \person{z} \person{h} \person{eh} \person{erhy} \person{jr} \person{rty} \person{gh} \person{bn} \person{sh} \person{shs} \person{ert} \person{ll} \person{l} \person{fyu} \person{io} \person{erys} \person{syh} \person{yy} \person{ty} \person{jl} \person{ui} \person{pi} \person{oi} \person{m} \person{mn} \person{ji} \person{fh} \person{nn} \person{A} \person{A} \person{A} \person{ttt} \person{tA} \person{eyA} \person{hA} \person{mA} \person{gnA} \person{nnA} \person{nnnA} \person{Amm} \person{Adf} \person{Azds} \person{ssdfA} \person{sdfA} \person{dfghA} \person{dhA} \person{asdas} \person{dsf} \person{d} \person{asdaA} \person{dddaA} \person{asdas} \person{a} \person{asdA} \person{A2} \person{A23} \person{A1} \person{A123} \person{eAf32} \person{A323} \person{A123} \person{A12f3} \person{A123f} \person{A12f3} \person{eA112}\person{etA} \person{ewewA} \person{eeeweA} \person{werA} \person{erwA} \person{eeeA} \person{Asaa} \person{nnnA} \person{iA} \person{iiA} \person{iiiA} \person{iuA} \person{yiA} \person{dd2A} \person{adA} \person{guA224}
\backmatter
\idxlayout{columns=3}
\printindex[person]
\end{document}
答案1
您正在使用的 idxlayout 将 \parskip 设置为具有一定延伸的值。您可以\theindex
使用(在加载 idxlayout 之后)进行修补
\usepackage{xpatch}
\makeatletter
\xpatchcmd\theindex{\z@ \@plus 0.3\p@}{0pt}{}{\fail}
\makeatother
字母组之间的一般间距由 设定,\indexspace
您可以根据需要重新定义。但是字母组之间的大间距是由超目标触发的,这似乎会抑制分页符。\leavevmode
在 的定义中插入\targetindexentryy
:
\newcommand{\targetindexentryy}[1]{\leavevmode\hypertarget{index:#1}{#1}}