Friends, I'm struggling for some time with this disturbance in the TeX force:
I have a set of words in Portuguese which are accented. When sorting these words, we treat accented letters the same way as their accentless counterparts. So, a list with these words:
abacate
ábaco
alavanca
árvore
arte
ácaro
aba
is sorted as
aba
abacate
ábaco
ácaro
alavanca
arte
árvore
When using these words as index entries, the accented letters are sorted via makeindex
as symbols:
\begin{filecontents*}{mystyle.ist}
headings_flag 1
heading_prefix "\\textit{"
heading_suffix "}\\nopagebreak\n"
delim_0 " \\dotfill "
delim_1 " \\dotfill "
delim_2 " \\dotfill "
\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[name=words,columns=1,options=-s mystyle]
\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}
Marco Daniel brilliantly suggested me in the chat to try xindy
instead of makeindex
. So
xindy -M texindy -C utf8 -L portuguese filename.idx
produces the "correct" sorting (in Portuguese of course, I'm aware that other languages have different rules).
Unfortunately, I use some custom styles for my indices (we can see one of them above). For my despair, xindy
works quite differently than makeindex
, and that .ist
style of mine is not supported AFAIK.
It would be fine for me to move to xindy
if I could also port my .ist
styles as well.
The workaround I'm using right now is to provide an accentless word before the "correct" one:
\index[words]{abacate}
\index[words]{abaco@ábaco}
\index[words]{alavanca}
\index[words]{arvore@árvore}
\index[words]{arte}
\index[words]{acaro@ácaro}
\index[words]{aba}
This one works. :)
Is it possible to provide a sorting rule to makeindex
, or maybe providing similar .ist
styles to xindy
? I'm fine with the current workaround, but it's quite painful to remove every single accent from my index entries. I'd prefer to stick with makeindex
, if possible. :)
makeindex
, what special things does your.ist
do? Note thattexindy
adds a lot of things people have to add manually withmakeindex
texindy
before, this is actually my first try.:)
My.ist
's are not complex, they are very similar to the one from my question, I usually have some TikZ in the header parts. I'd be glad to try other approaches.:)
.ind
) file thattexindy
provide? It make use of two macros to typeset the header parts,\lettergroupDefault
(the non-alfabetical one) and\lettergroup
, both are defined in the.ind
file if not already defined by the user. The\dotfill
part should not be that hard to add using a custom style.esindex
to Portuguese (it's intended for Spanish). It uses makeindex and there are options for setting how accented letters (or italics) are sorted, particles to be removed from the key sort, letter-by-letter vs. word-by-word, and more. But as I've said, it's intended for Spanish, so I presume vowels with tilde doesn't work as you could expect.\index{abaco@ábaco}
as introduced in the MakeIndex manual. But probably the proposed solutions with Xindy are more reliable for future projects.