8

I Have createt a minimal example of my document. I want to create a Index, but the letters Æ, Ø and Å it considered as symbols instead of letters as shown: enter image description here

\documentclass[10pt,a4paper]{report}
 \usepackage[utf8]{inputenc}
 \usepackage[english]{babel}
 \usepackage{lmodern}
 \usepackage{imakeidx}
 \makeindex[columns=3, title=Index, intoc,options=-s Index.ist]
\begin{document}
\chapter{First Chapter}
\index{Børge}
\index{Børge!Hej med dig}
\index{Børge!Hey with you}
\index{A}
\index{hej}
\index{Cykel}
\index{wow}
\index{hn}
\index{$\sigma$}
\chapter{Second chapter}
\index{hesj}
\index{AA}
\index{Åse}
\index{æse}
\index{øse}
\index{Yrsa}
\index{Yrsa!Carla}
\index{hejsas}
\index{heASDASDj}

\printindex
\end{document}

The ist file I'm uisng called Index.ist is this:

 headings_flag 1
 heading_prefix "\\textbf\{\\color\{black\}"
heading_prefix "\n\\centering\\large\\sffamily\\textbf{\\color\{black\}}%
\\noindent\\textbf{"heading_suffix "}\\par\\nopagebreak\n"
heading_suffix "\}\\nopagebreak\n"
item_0 "\n \\item \\small \\color\{black\}"
delim_0 " \\dotfill "
delim_1 " \\dotfill "
delim_2 " \\dotfill "

Any Idea how to solve this

4
  • MakeIndex does not deal with other alphabets (like Danish or Swedish); you have to use Xindy for that.
    – egreg
    Oct 10 '15 at 10:49
  • How do I do that. Is it just to load the package Xindy ?
    – Simon
    Oct 10 '15 at 10:52
  • xindy isn't a package but the processor; you use it instead og the makeindex command. But as you use the imakeidx-package you can instruct it to call xindy for you -- it is described quite well in it's manual.
    – Florian
    Oct 10 '15 at 10:59
  • 1
    xindy is the way to go for a complete index in, say, Danish. But if you are writing a document in English with only a few words with foreign letters, a quick fix would be to fix the sorting for these few manually e.g. \index{Azse@Åse}
    – Florian
    Oct 10 '15 at 11:34
6

![ ]1xindy is more than just a package, you have to run it. From the CTAN short description:

Xindy can be used to pro­cess in­dexes for doc­u­ments marked up us­ing (LA)TEX, Nroff fam­ily and SGML-based lan­guages.

A workaround I used years ago when I wasn't using utf-8 is to divide your index entry in two parts, one with the ansii entry that will be alphabetically sorted, the second with what will be printed. For instance, in French or Polish

 \index{Conde-sur-l'Escaut@Cond\'e-sur-l'Escaut}
 \index{Dazbrowa Gornicza@D\cog abrowa G\'ornicza}

You can see on the second entry that I added a "z" after "Da" since ą should be sorted after az according to polish alphabet. D\cog abrowa G\'ornicza will be printed as Dąbrowa Górnicza.

This should work with makeindex, and might be worth trying if your index is short and you don't have time to learn xindy. Very (too?) old-fashioned indeed…

0
4

You have to use Xindy as the index processor. How to make it work with symbols is something I can't understand, though. :-(

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{imakeidx}
\makeindex[
  columns=3,
  title=Index,
  intoc,
  program=truexindy,
  options=-M texindy -C utf8 -L danish,
]
\begin{document}
\chapter{First Chapter}
Text
\index{Børge}
\index{Børge!Hej med dig}
\index{Børge!Hey with you}
\index{A}
\index{hej}
\index{Cykel}
\index{wow}
\index{hn}
\index{sigma@$\sigma$}

\chapter{Second chapter}
text
\index{hesj}
\index{AA}
\index{Åse}
\index{æse}
\index{øse}
\index{Yrsa}
\index{Yrsa!Carla}
\index{hejsas}
\index{heASDASDj}

\printindex
\end{document}

Compile with the -shell-escape option, as explained in the manual. For changing the index formatting you need to use Xindy methods.

This is the result; I can see a wrong entry for æse, but that's a problem with Xindy.

Here's a hack for getting it to work:

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{imakeidx}
\makeindex[
  columns=3,
  title=Index,
  intoc,
  program=truexindy,
  options=-M texindy -C utf8 -L danish,
]

\makeatletter
\AtBeginDocument{%
  \renewcommand\index[2][\imki@jobname]{%
    \@bsphack
    \begingroup\edef\x{\endgroup\noexpand\@index[#1]{\detokenize{#2}}}\x
  }%
}
\makeatother


\begin{document}
\chapter{First Chapter}
Text
\index{Børge}
\index{Børge!Hej med dig}
\index{Børge!Hey with you}
\index{A}
\index{hej}
\index{Cykel}
\index{wow}
\index{hn}
\index{sigma@$\sigma$}

\chapter{Second chapter}
text
\index{hesj}
\index{AA}
\index{Åse}
\index{æse}
\index{øse}
\index{Yrsa}
\index{Yrsa!Carla}
\index{hejsas}
\index{heASDASDj}

\printindex
\end{document}

enter image description here

Not really the best, though. Possibly a better sanitization method is necessary. Of course, using a Unicode engine should solve all problems.

10
  • In this context, what do you mean by symbols?
    – daleif
    Oct 10 '15 at 12:09
  • @daleif The \sigma, for instance.
    – egreg
    Oct 10 '15 at 12:23
  • Yeah, xindy ignores the \
    – daleif
    Oct 10 '15 at 14:37
  • 1
    @daleif And also doesn't honor \ae, for instance. It's able to see that \r A is an A, but it doesn't sort correctly anyway. There should be a good method. :(
    – egreg
    Oct 10 '15 at 14:38
  • I think I have a config file for that somewhere. Will see on Monday. It is sad that many of these things does not get fixed. Primarily because hardly anyone knows how xindy works. See see the hassle that had to be done to get it to work with utf8
    – daleif
    Oct 10 '15 at 14:43

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.