0

I'm using Imakeidx to auto-generate an author index for my bibentries, but I have a problem with the sorting of some special characters such as umlauts. As suggested, I tried to use xindy as a engine for the sorting, but the only result I got is that I have to process also the .idx file (without xindy I didn't need to), but the sorting is still wrong.

In my example, I need first Döllinger and then Dull.

I'm dying on it, really.

MWE:

% !BIB TS-program = biber
% !BIB program = biber
% !TEX encoding = UTF-8 Unicode
% !TeX TS-program = xelatexmk

\begin{filecontents}{archivio.bib}

@book{Dull,
    Address = {Cambridge},
    Author = {Mark Dull},
    Publisher = {Amazon KDP},
    Title = {Hello world},
    Year = {1999}}

@book{Dol2,
    Address = {Moskwa},
    Author = {Philip Döllinger},
    Publisher = {Sinodal'naja tip.},
    Title = {Sistematičeskoe opisanie rukopisej moskovskoj Sinodal'noj (patriaršej) biblioteki},
    Year = {1894}}


\end{filecontents}

\documentclass[11pt, openany]{book}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{latin, english, french}

\usepackage[]{csquotes}
\usepackage{xpatch}
\usepackage[style=verbose-trad2,
            language=auto,
            ibidpage=true,
            autolang=other,
            useprefix=true,
            giveninits=true,
            indexing=true,
            dateabbrev=false,
            backend=biber,
        ]{biblatex}



\addbibresource{archivio.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usepackage[xindy]{imakeidx}
\makeindex[program=xindy, name=nomi, intoc=true, title=Indice dei nomi]

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\ifnameundef{namea}{\indexnames{labelname}}{\indexnames{namea}}}
    {}}

\DeclareIndexNameFormat{default}{%      Formato del nome dell'autore
  \usebibmacro{index:name}
    {\index[nomi]}
    {\namepartfamily}
    {\namepartgiveni}
    {\namepartprefix}
    {\namepartsuffix}}


\begin{document}


I should like to sort properly \cite{Dull} and \cite{Dol2}.



\printindex[nomi]       % Indice dei nomi   
\end{document}
Teodoro
  • 587
  • 2
  • 9
  • I guess this is at least somewhat related to https://tex.stackexchange.com/q/426811/35864 As I mentioned in my comment under that question it would be good to know which exact sorting rules/algorithm you intend to follow, not just the outcome of your MWE – moewe Jun 04 '18 at 18:37
  • simply alphabetic, ignoring the umlauts at all – Teodoro Jun 04 '18 at 19:11
  • I'm also open to any other possible solution for an automated author name index that runs the sorting properly – Teodoro Jun 04 '18 at 19:33
  • How do you compile your document? Do you actually run xindy? (I use latexmk and that did not run xindy automatically for me. I had to enable shell escape as mentioned in the imakeidx manual). – moewe Jun 04 '18 at 20:14
  • 1
    Do you actually have a latexmkrc file that defines makeindex as xindy with the proper encoding? – Herb Schulz Jun 05 '18 at 00:40
  • I'm on a Mac, and I use Texshop. ATM I'm running XeLaTeX - Biber - XeLaTeX, but with xindy I have to run also the .idx with makeindex (I do it with texworks, I don't know how to do it with texshop), I don't know what is a latexmkrc file. Please forgive my ignorance, I'm still a noob on many things! – Teodoro Jun 05 '18 at 07:20
  • 1
    You don't have to run the .idx with makeindex you have to run it with xindy! It works if you run makeindex and you get an index, but you don't get xindy's features. If you want xindy you need to run xindy. – moewe Jun 05 '18 at 08:20
  • 3
    imakeidx tries to run texindy through the shell escape, but if it can't, it writes the command you need to call in the transcript. In this case texindy nomi.idx, but you also need to specify the language as well. For example texindy -L german-din5007 -C utf8 nomi.idx. To incorporate it into TeXshop, try Adding a new engine in TeXShop. In this case, you need to explicitly use nomi.ist rather than appending .ist to the basename. – Nicola Talbot Jun 05 '18 at 08:57
  • It worked running texindy -L german-din5007 -C utf8 nomi.idx. Honestly incorporating xindy in texshop is too difficult (exoteric!) for me. If it doesn't exist any simpler way I'll use this one :) BTW I find rather surprising that LaTeX doesn't have a simple way to automate an author index able to sort names with umlauts or special characters. – Teodoro Jun 05 '18 at 18:03
  • 1
    If you run XeLaTeX with shell escape enabled (latexmk -xelatex -shell-escape) xindy will be run automatically for you. TeX predates Unicode and does not really do non-ASCII-characters in general. The first indexing tools for LaTeX (indexing is best done externally, LaTeX isn't great at sorting strings, see BibTeX) were also not great with non-ASCII. xindy is the go-to solution for non-ASCII indices and it seems to work very well, but latexmk does not support it out of the box, so you either have to write your own rule, use shell escape or arara. – moewe Jun 05 '18 at 19:54
  • An easy solution is to enable shell-escape with the method described by Egreg here: https://tex.stackexchange.com/questions/45648/how-to-customize-the-default-xelatex-command-in-texshop-for-osx and to set xindy with \def\xindylangopt{-M lang/german/din5007-utf8-lang}. Also, the option options=\xindylangopt must be enabled. It worked much better for me. – Teodoro May 09 '20 at 15:46

0 Answers0