5

I'm using xindy to make an index for my book, which is in Icelandic. 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. See my previous question. There is a solution (see the answer), but it only works for utf-8-encoded files, and my document is in ANSI. I cannot change the encoding to utf-8 without creating some errors because there are labels with special characters.

What I'm hoping for is a solution analogous to the previous question that works for non-utf-8 files. Alternatively, if there was some easy way to change the alphabetical order xindy uses, that would be great. I can't seem to find any documentation for xindy that I can understand.

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
Peter
  • 369
  • 1
    You don't say how you tried changing the encoding. Nor, for that matter, do you mention the encoding you are using or tell us how you are informing TeX of that encoding. Are these characters in T1? If not, how are you producing them? – cfr Jul 12 '15 at 00:20
  • @cfr I'm afraid I don't know the encoding, all I know is that the document compiles and all the characters display correctly. Is there any way to check? I converted to utf-8 using the editor vim. – Peter Jul 12 '15 at 00:22
  • 1
    The thing is, to even test your MWE, I have to do something to specify the encoding. Otherwise it compiles, but the special characters it includes are... well, I suppose 'special' would be one description but 'screwed up' would be another. So I use \usepackage[utf8]{inputenc} and it all comes out nicely. (Since my test file is saved in this encoding.) But now I'm not reproducing your situation at all. How to find the encoding? On Linux/OS X, I would use file <filename>.tex and it will tell me the file type, including encoding. If I 'save as...' my editor will show me the encoding, too. – cfr Jul 12 '15 at 00:29
  • @cfr Notepad suggests that the encoding is ANSI. I'll edit my question. – Peter Jul 12 '15 at 00:31
  • Hmm... well, my editor doesn't even have that option. At least, not by that name. Probably needs a Windows user, I would guess.... (Don't worry - there are plenty around!) – cfr Jul 12 '15 at 01:19
  • 1
    As you use non-ASCII chars you certainly must load inputenc. Try \usepackage[ansinew]{inputenc} . – Ulrike Fischer Jul 12 '15 at 09:25
  • @UlrikeFischer Strangely, my document compiles perfectly well without loading inputenc. When I added \usepackage[ansinew]{inputenc} compilation fails and I get a lot of missing \endcsname inserted and Extra \endcsname errors. I also get warnings like Command \" invalid in math mode on input line N and the lines in question aren't in math mode at all. Also, all the citations and references are undefined. I think this may be due to labels that contains non-ASCII characters. Since there are hundreds of labels I'd rather avoid changing them. – Peter Jul 12 '15 at 10:22
  • I should clarify: When I run pdflatex the document compiles and in the resulting pdf all the characters are displayed correctly. However, I get these aforementioned errors and I also get errors when I run xindy afterwards. – Peter Jul 12 '15 at 10:33
  • 2
    Without inputenc non-ascii chars gives the correct output only for a subset of the possible input. Try "Grüße" to see the problem. If you get errors when using inputenc then your document is faulty -- labels shouldn't use non-ascii chars. You should better correct your document instead of wasting time (or hoping that someone else spend the time) to find some workarounds. – Ulrike Fischer Jul 12 '15 at 10:43
  • I guess that's the most reasonable way to fix this. Should I flag the question for closure since it's most likely hopeless? – Peter Jul 12 '15 at 11:01

0 Answers0