Thanks to a number of great texindy questions here on stackexchange, I have imakeidx working nicely within xelatex using splitindex and custom xindy style files. However, I've run across one formatting issue that I haven't found asked or described anywhere.
I have one index where all the terms are grouped under a small number (~7) of headings. When these headings begin with a different letter, they have some extra space between the groups. However, if the headings begin with the same letter, there is no extra space (see the example image and code below).
My question is, how to I modify my generalstyle.xdy file to get extra space between the main entries?
I don't want extra space between the sub-entires, I just want a consistent format and the lack of space between some groups looks awkward. I realize I could use the un-elegant approach of something like
\index{B@\textbf{\large Danish Tales}|nopage}
\index{C@\textbf{\large Danish Titles}|nopage}
instead of
\index{danish@\textbf{\large Danish Tales}|nopage}
\index{danish titles@\textbf{\large Danish Titles}|nopage}
to force xindy to consider these as being listed under different letters. Or, I could even define "danish" and "danish titles" as separate letters with special sorting rules in an xdy file (far more painful than I want to deal with), but all of this feels so hacked and ugly. Surely there's a simple way to simply define that main group entries, even under the same letter, should get an extra space? (Keep in mind that I'm very new to xindy/texindy/imakeidx - I've only been using them for 1 week at this point...)
Anyhow, here's my working example. It's carved out of a much large document, so apologies if it's not as minimal as it could be.
First, the .tex file:
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
% this allows us to use real characters like æ instead of macros like \ae
%% PREAMBLE
%Set the document type
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}
%Provide standard TeX shortcuts in xelatex
\usepackage{xunicode}
%Extra customizations for XeLateX
\usepackage{xltxtra}
%XeLateX can't use babel, so use polyglossia instead
%(primarily to get proper hyphenation in the other languages)
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguages{icelandic,danish,norsk,swedish}
%Setup the indexing
\usepackage[xindy,splitindex]{imakeidx}
%default index
\makeindex[title=Index of Tale Information,program=texindy,intoc,columns=2,options=-L icelandic -C utf8 -M lang/icelandic/utf8 -M generalstyle]
%I want to suppress page number on group headings, define \noidxpage so it eats the argument
%the idstyle.xdy defines the formatting option nopage = \noidxpage
\newcommand{\noidxpage}[1]{}
\begin{document}
\mainmatter
Dummy text here (really several chapters with lots of stuff indexed\ldots)
%setup the category headers
\index{danish@\textbf{\large Danish Tales}|nopage}
\index{icelandic@\textbf{\large Icelandic Tales}|nopage}
\index{danish titles@\textbf{\large Danish Titles}|nopage}
\index{icelandic titles@\textbf{\large Icelandic Titles}|nopage}
\index{collectors@\textbf{\large Collector}|nopage}
\index{storytellers@\textbf{\large Storyteller}|nopage}
\index{location@\textbf{\large Location Collected}|nopage}
%dummy index info to show what I see
\index{danish!Jesper the Rabbit Herder}
\index{danish titles!Jesper Harehyrde}
\index{collectors!Kristensen, Evald Tang}
\index{storytellers!Futtrup, Rasmus}
\index{location!DK, Lemvig}
\index{danish!The Little Horse}
\index{danish titles!Det Lille Øg}
\index{collectors!Grundtvig, Svend}
\index{storytellers!Krag-Juel-Vind, Elisa}
\index{location!DK, Horsens}
\index{icelandic!Mori, the Hound}
\index{icelandic titles!Hundurinn Móri}
\index{collectors!Árnason, Jón}
\index{icelandic!Bukolla}
\index{icelandic titles!Búkolla}
\index{collectors!Einarsson, Magnús}
\index{storytellers!Renessee, Ingibjörg}
\index{storytellers!Skúlason, Hrund}
\index{storytellers!Þorgrímsson, Sigrún}
%Create the index
\printindex
\end{document}
Here's the xindy style file:
;Allow removing page numbers (e.g. for group headings)
; this requires putting the comma in the default formatting
; of the page number so that the default seperator is blank
(define-attributes (("nopage")) )
(markup-locref :attr "nopage" :open "\noidxpage{" :close "}")
(markup-locref :attr "default" :open ", \textbf{" :close "}")
;
;(markup-locclass-list :open "\dotfill " :sep ", ")
(markup-locclass-list :open "" :sep "")
;
;(markup-locref-list :sep ", ")
(markup-locref-list :sep "")
;
(markup-range :sep "--")
(markup-index :open "\begin{theindex}~n
\providecommand*\lettergroupDefault[1]{}
\providecommand*\lettergroup[1]{%
\nopagebreak
}"
:close "~n~n\end{theindex}~n"
:tree)
;; The indexentries (item_<..> specifiers)
(markup-indexentry :open "~n \item " :depth 0)
(markup-indexentry :open "~n \subitem " :depth 1)
(markup-indexentry :open "~n \subsubitem " :depth 2)
And this is an image of the resulting index: