Sorting index entries with accented words
Here's the simple solution. Well, not so simple, after all. :)
One small problem, that I'll solve in a next release of imakeidx
: for some reason (that I don't remember now) we decided that program=xindy
called texindy
anyway. But unfortunately, it seems that the calls
xindy -M texindy -M mystyle -C utf8 -L portuguese words.idx
and
texindy -M mystyle -C utf8 -L portuguese words.idx
are not equivalent, as the latter throws up an incomprehensible error (probably a bug in the texindy
script).
Thus the following document will require to run manually xindy
(but you have Arara, so it's not a problem), until the small problems are corrected.
Notice that xindy
provides two commands for the letter groups, which should be redefined in the preamble to do what's wanted.
\begin{filecontents*}{mystyle.xdy}
(markup-locclass-list :open "\dotfill " :sep "\dotfill ")
\end{filecontents*}
\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}[2012/05/09]
\newcommand*{\lettergroupDefault}[1]{}
\newcommand*\lettergroup[1]{%
\par\textit{#1}\par
\nopagebreak
}
\def\pfill{\unskip~\dotfill\penalty500
\strut\nobreak\dotfil~\ignorespaces}
\def\efill{\hfill\nopagebreak}
\def\dotfil{\leaders\hbox to.6em{\hss.\hss}\hfil}
\makeindex[name=words,columns=1,program=xindy,options=-M texindy -M mystyle -C utf8 -L portuguese]
\begin{document}
Hello world.
\index[words]{abacate}
\index[words]{ábaco}
\index[words]{alavanca}
\index[words]{árvore}
\index[words]{arte}
\index[words]{ácaro}
\index[words]{aba}
\printindex[words]
\end{document}
Here a solution using only a style file.
The style consists only of two line:
(markup-locclass-list :open " \dotfill\ " )
(markup-letter-group :open-head "\textit{" :close-head "}" )
Here a complete MWE which needs shell-escape.
\RequirePackage{filecontents}
\begin{filecontents*}{mystyle.xdy}
;;; xindy style file
;;;dotted line between name and page number
(markup-locclass-list :open " \dotfill\ " )
(markup-letter-group :open-head "\textit{" :close-head "}" )
\end{filecontents*}
\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}[2012/05/09]
\def\pfill{\unskip~\dotfill\penalty500
\strut\nobreak\dotfil~\ignorespaces}
\def\efill{\hfill\nopagebreak}
\def\dotfil{\leaders\hbox to.6em{\hss.\hss}\hfil}
\makeindex[program=texindy,options=-M mystyle.xdy,name=words,columns=1]
\begin{document}
Hello world.
\index[words]{abacate}
\index[words]{ábaco}
\index[words]{alavanca}
\index[words]{árvore}
\index[words]{arte}
\index[words]{ácaro}
\index[words]{aba}
\printindex[words]
\end{document}
I need a little more space, but something like this:
\newcommand\lettergroup[1]{%
\par\textit{#1}\par
\nopagebreak}
\newcommand\lettergroupDefault[1]{\lettergroup{#1}}
and a new module (mystyle.xdy
):
(markup-locclass-list :open "\dotfil ")
Then invoke texindy
via
texindy -M mystyle.xdy ....
that seems to do the same as your MWE, just with texindy
instead