6

I'm using Xindy to make an index for my book. It sorts the words mostly correctly, but it doesn't sort accented characters (i.e. á é í ó ú ý) after the corresponding non-accented characters (a e i o u y), unless the words are otherwise identical. For example, Xindy will sort 'ís' after 'is', but it will sort 'auga' after 'ás'. I would like it to sort ás after auga, and in general I want it to sort the accented characters after the corresponding non-accented character. For the record, this is the correct sort order:

a, á, b, c, d, ð, e, é, f, g, h, i, í, j, k, l, m, n, o, ó, p, q, r, s, t, u, ú, v, w, x, y, ý, z, þ, æ, ö

Here's my MWE:

% filename alphabet.tex
\documentclass[a4paper,11pt]{book}
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage{makeidx}
\makeindex

\title{My book}
\author{Me}
\begin{document}
\chapter{Stafrófið}

Ananas\index{ananas}, ás\index{ás},
banani\index{banani}, dagblað\index{dagblað}, epli\index{epli}, ég\index{ég}, flugvél\index{flugvél}, gíraffi\index{gíraffi}, hús\index{hús}, indíáni\index{indíáni}, ís\index{ís}, jörðin\index{jörðin}, kisa\index{kisa}, lykill\index{lykill}, mús\index{mús},
nef\index{nef}, ormur\index{ormur}, óbó\index{óbó}, píanó\index{píanó}, rós\index{rós}, skæri\index{skæri}, tré\index{tré}, ugla\index{ugla}, úr\index{úr}, varir\index{varir}, yddari\index{yddari}, ýta\index{ýta}, þvottavél\index{þvottavél}, æð\index{æð}, ör\index{ör}, auga\index{auga}, eyra\index{eyra}.

\printindex
\end{document}

I compile it using

pdflatex alphabet.tex
texindy -L icelandic alphabet.idx
pdflatex alphabet.tex

(you may have to update Xindy, as I had to do). What I'm hoping for is some kind of command, either in my .tex document or in some file that Xindy reads, but other solutions are appreciated.

This question is similar and has an answer that seems to work but it uses LuaTex while I use LaTeX (switching is not an option). It's also very long and technical for such a (seemingly) simple change.

Edit: I failed to mention that my LaTeX file is not utf-8 encoded and I'm not using \usepackage[utf8]{inputenc}, which I think might matter. I'm working on a 300+ book and I'm afraid that changing the encoding might have unexpected effects, so if there's a solution that doesn't require utf-8, that would be preferred.

3
  • Have you tried to change encoding to utf-8?
    – chejnik
    Jul 11, 2015 at 21:40
  • @chejnik I have tried, and I get a lot of errors and warnings concerning labels being multiply defined or missing \endcsname inserted. Some of them are probably due to special characters being used as labels (not very smart of those who worked on the document before me).
    – Peter
    Jul 11, 2015 at 21:53
  • I guess you might rename the question to the original title, so that the answer reflects the question.
    – chejnik
    Jul 12, 2015 at 18:16

1 Answer 1

7

The solution can be found at question Texindy sorting Icelandic - Edit 2 A minimalistic version and LuaTex is not required to obtain the solution.

Download the first file using a terminal and place it inside your LaTex folder:

wget http://striz7.fame.utb.cz/tex-sx/is-min/icelandicmalmin.xdy  

Update: Download iec2utf and place all files inside your LaTex folder:

https://github.com/michal-h21/iec2utf

Run the following commands:

pdflatex alphabet
texlua iec2utf.lua <alphabet.idx >mal-temp.idx
xindy -M texindy -M icelandicmalmin-test -M mal-style -o alphabet.ind mal-temp.idx
biber alphabet
pdflatex alphabet
pdflatex alphabet

Example of index sorting Icelandic characters with accents:

enter image description here

5
  • Do I need to download the file iec2utf.lua? The second step (the texlua step) just results in a file with the text "Scriptfile iec2utf.lua not found". Also, I don't think my file in in utf-8. Will this solution still work?
    – Peter
    Jul 11, 2015 at 18:24
  • I have updated my answer with the link to the iec2utf files.
    – chejnik
    Jul 11, 2015 at 18:32
  • This method doesn't seem to work unless the file is encoded with utf-8 and with \usepackage[utf8]{inputenc} in the preamble. Is there any way to do this for a non-utf-8 encoded file? Also, in the xindy step, I get multiple warnings such as WARNING: define-letter-group: prefix "ä" now maps to letter group "├É" and one error: ERROR: replacing location-reference-class `"see"' is not allowed !. I also got these errors when I tried changing my file to utf-8 first, but in that case pdflatex could compile without error afterwards, and the index was correct,
    – Peter
    Jul 11, 2015 at 19:39
  • 1
    I suggest to ask a new question regarding indexing a non-utf-8 encoded file.
    – chejnik
    Jul 11, 2015 at 21:38
  • 1
    I took your advice and asked a new question here.
    – Peter
    Jul 11, 2015 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .