8

Is there an easy way to get BibLaTeX to sort "ä" as "ae", "ö" as "oe" and "ü" as "ue"?

Here's an example:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
  @article{sturm, author = {Sturm}}
  @article{stutzel, author = {Stützel}}
\end{filecontents}

\usepackage{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

Sturm appears before Stützel, while I want the opposite. I know I can handle this with fields like sortkey, but I was hoping for a more automatic solution I could add to my own custom style.

Also, it would be nice if this could be done conditionally depending on the langid field (and I think that should be the default behavior for German), but that might be too ambitious, I'd be satisfied with a way to do it regardless of the entry's language.

2
  • 2
    Try \usepackage[sortlocale=de_DE_phonebook]{biblatex} – David Purton Apr 2 '18 at 4:28
  • @DavidPurton Perfect, thank you! If you want to add that as an answer I'll accept it as correct. :) – dbmrq Apr 2 '18 at 4:34
10

You can specify this style of sorting by loading biblatex with the sortlocale=de_DE_phonebook option:

\usepackage[sortlocale=de_DE_phonebook]{biblatex}

I'm not sure about doing it on a per-entry basis using locales though. You could do it using a source map, but that seems like a bad idea.

2
  • Yes, that seems like overkill. This is already great, thank you! – dbmrq Apr 2 '18 at 4:54
  • sortlocale can not be set on a per-entry basis, it can only be used as a global option. That makes sense because using different sorting rules could lead to undecidable situations. Sorting rules can not (always) be expressed in the form "sort letter x as letter combination abc", sometimes letters may be sorted in other places entirely and then different sort schemes may expect conflicting things. – moewe Apr 2 '18 at 8:46
7

It is probably better to sort all entries with the same global scheme as in David's answer. Using different sorting rules can massively confuse a reader (whom you should not expect to know the sorting quirks of all cited authors' native languages), this might not become apparent in short list where the different sorting rules only impact letters that are not word initial, but it can be quite confusing if two "Ü"s get sorted at different ends of the bibliography because one is German and one is Estonian.

But theoretically you can restrict the conversion of umlauts to German entries (as marked in the langid field). For these entries we do the 'ä'->'ae' etc. conversions ourselves and store the result in the sortname field.

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{sturm, author = {Sturm}}
@book{stutzel, author = {Stützel}, langid={ngerman}}
@book{basel, author = {Basel}}
@book{bassel, author = {Baßer}, langid={ngerman}}
@book{basta, author = {Basta}}
@book{oesel, author = {Ösel}, langid={ngerman}}
@book{pinguino, author = {Pingüino}}
@book{pingufin, author = {Pingufin}}
@book{pinguzzo, author = {Pinguzzo}}
\end{filecontents}

\usepackage{biblatex}
\addbibresource{\jobname.bib}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[foreach={author,editor,translator}]{
      \step[fieldsource=langid, match=\regexp{\A(n)?((swiss)?german|austrian)\Z}, final]
      \step[fieldsource=\regexp{$MAPLOOP}, 
            match=\regexp{(([aouAOU]\x{0308})|\x{00df})},
            final]
      \step[fieldset=sortname, origfieldval, final]
      \step[fieldsource=sortname, match=\regexp{(a|o|u|A|O|U)\x{0308}}, replace={$1e}]
      \step[fieldsource=sortname, match=\regexp{\x{00df}}, replace={ss}]
    }
  }
}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

Note how Baßer's "ß" is sorted as "ss" so it ends up before Basta. Stützel's "ü" is sorted as "ue" and thus it goes before Sturm. Pingüino is Spanish and not touched, so it sorts after Pingufino (and not before as if it were converted to Pingueino).

9
  • 1
    Is Pinguzzo Sicilian? :):):) – CarLaTeX Apr 2 '18 at 6:31
  • @CarLaTeX I suppose one of the fine Sicilian fisherfolk... If you pronounce the ending French "Pinguifin" could be French, so I made a bit of a mess with my Romance languages there, I'm afraid. – moewe Apr 2 '18 at 6:47
  • 1
    Many words in Sicilian dialect end with -uzzo, which usually means "little" (in an affectionate sense). So pinguzzo = little penguin (but I don't think they eat penguins in Sicily) :):):) – CarLaTeX Apr 2 '18 at 6:55
  • @moewe Thank you, that’s exactly what I had in mind! – dbmrq Apr 2 '18 at 15:21
  • 1
    @CarLaTeX No :-( I'm sorry. I call it: "pinguinu". :-) – Sebastiano Apr 2 '18 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.