4

I am looking for a way to change the way in which author (or editor) names are sorted in Biblatex-generated indexes.

In French, we use accented letters such as é or è, which should be sorted with the main letter, in this case e. Whenever a name contains such an accented letter, it gets sorted out of order, so we need to index entries using: no accents@with accents. I understand how to get Biblatex to use an @ in the index, but not how to feed it the proper string.

How can I make sure that Biblatex either:

  • converts such special characters to their equivalent basic latin letter before printing the name into the index (with Biber or any string manipulation package)
  • uses a special name field such as indexauthor, which would contain a list of names using only basic latin characters
  • tweak the index so that it properly sorts all special characters without having to use @ (my base class is using memoir, so makeidx is the preferred engine)
  • or anything else that works

The solution from this answer works partially, as shown in the following example:

\documentclass{article}

\usepackage[french]{babel}
\usepackage[indexing=true]{biblatex}
\usepackage{makeidx}
\makeindex

\begin{filecontents}{\jobname.bib}
@article{testcite,
  author = {Éliot, William and Doé, John},
  title = {Test Title},
  year = {2018},
  usera = {Eliot, William and Doe, John}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\renewbibmacro*{citeindex}{%
    {\indexnames{labelname}}{}}

\renewbibmacro*{index:name}[5]{%
  \usebibmacro{index:entry}{#1}
    {\iffieldundef{usera}{}{\thefield{usera}\actualoperator}\mkbibindexname{#2}{#3}{#4}{#5}}}

\makeindex

\begin{document}

\printindex

\cite{testcite}

\end{document}

The first name gets indexed properly, as an E letter, but the second name also gets indexed as such, because we are using a literal field instead of a name field for the indexauthor name (in this case, usera).

Would it be possible to use a name field instead and make sure both names get indexed properly? I realise that this may be impossible due to the way in which fields work.

In that event, how could I convert the special characters on the fly? Or tweak the indexing process itself so that it sorts accented letters properly?

ienissei
  • 6,223
  • Now I don't have much experience with indices, but maybe you are better off using an index tool that can deal with UTF-8. xindy springs to mind, maybe xindy can sort your entries properly without manual intervention. – moewe Jan 07 '18 at 12:59
  • See https://tex.stackexchange.com/q/22785/35864, https://tex.stackexchange.com/q/131334/35864 – moewe Jan 07 '18 at 13:14
  • @moewe Thanks a lot. I have to look into xindy more in depth… It seems to need some configuration before it prints things in the right order. – ienissei Jan 07 '18 at 13:33
  • Maybe https://tex.stackexchange.com/q/118724/35864 can also help. The code of the question in https://tex.stackexchange.com/q/175511/35864 might also be interesting. – moewe Jan 07 '18 at 17:55

1 Answers1

4

You need an index tool that can handle UTF8 correctly, then there is no need at all to manipulate the sorting manually. This is not really a biblatex problem, its an issue of the indexing tool.

You can use xindy together with imakeidx

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[indexing=true,style=authoryear]{biblatex}
\usepackage[xindy, noautomatic]{imakeidx}
\def\xindylangopt{-M texindy -L french -C utf8}
\makeindex[options=\xindylangopt]

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{testcite,
  author = {Éliot, William and Doé, John},
  title = {Test Title},
  year = {2018},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\printindex

\index{hallo}
\cite{testcite}
\printbibliography
\end{document}

compiled with

pdflatex document
biber document
pdflatex document
texindy -M texindy -L french -C utf8 document.idx
pdflatex document
pdflatex document

gives

enter image description here

moewe
  • 175,683