I have some trouble formatting my index with idxlayout.

As my MWE demonstrates, the vertical spacing between the entries is inconsistent. For example the vertical spacing among the entries of entrygroup A is larger than in D. The group themselves are spaced varaibly: D and E are spaced ok, A and B are not.

My real example (which is too large) is even worse. Sometimes the middle column is filled only with 6 lines spread erratically over the column whereas the other lines are filled with more entries.

How do I prevent the rubber spacing and use a fixed one?

Optionally: How do I set a penalty which prevents only the group heading from apperaring alone?

Your help is greatly appreciated!

This is the vertically inconsistent index

% !TEX encoding = UTF-8 Unicode
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]



(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 (

(sort-rule "-" "")

(markup-index :open  "~n\begin{theindex}
    :close "~n~n\end{theindex}~n"

(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 "}" )
        options=-M texindy -M page-ranges -M xindystyle -C utf8 -L german-duden,
]{idxlayout} % Index layout



    \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} 


Using a real world example the problem becomes more apparent. I've marked the erratic spaces in red: real world index example


The idxlayout you are using set \parskip to a value with some stretch. You could patch \theindex with (after loading idxlayout)


\xpatchcmd\theindex{\z@ \@plus 0.3\p@}{0pt}{}{\fail}

The general space between the letter groups are set by \indexspace which you could redefine if you want. But the large spaces between the letter groups are triggered by the hypertargets which seems to suppress pagebreaks. Insert a \leavevmode in the definition of \targetindexentryy:

  • Thanks a lot! Your answer fixed the rubber spacing between the entries. I've added the missing xindystyle.xdy. Do you see any styling inside the .xdy file that influences the spacing before the \lettergroup? I see \indexspace preceeding \lettergroup – kabauter Jun 21 '17 at 8:14
  • You didn't try your example. Don't use filecontents for this, it adds text at the begin that confuse xindy, use filecontents* instead. Beside this: you document doesn't show a problem with the headers or the letter groups. Without a real failing document I can't help you. – Ulrike Fischer Jun 21 '17 at 8:23
  • Sorry. That was a typo. I included the .xdy file without filecontents. Maybe the real world example I added makes the problem clear. – kabauter Jun 21 '17 at 11:02
  • Ah, you have spaces before the headings. You will have to provide the code of the real world example. – Ulrike Fischer Jun 21 '17 at 11:46
  • Still you can see the spaces before the headings in the MWE, albeit not to the same extreme extent. How do I prevent this 'holes'? – kabauter Jul 3 '17 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.