4

If I write:

\index{axioms!Zermelo–Fraenkel}

LaTeX generates

axioms, 184
    ZermeloFraenkel, 203, 208

How do I stop the hyphen from disappearing?

EDIT: MWE...

\documentclass{article}
\usepackage{makeidx}
\makeindex

\begin{document}
\printindex
\index{axioms!Zermelo–Fraenkel}axioms
\end{document}

(also (MiKTeX version 2.9); compiled via WinEdt's pdftexify option)

4

You're using the "en-dash" character, Unicode U+2013, without setting the input to interpret Unicode as UTF-8. This is different from a hyphen.

By compiling your code, the contents of the .idx file is

\indexentry{axioms!Zermelo<E2><80><93>Fraenkel}{2}

where I use the "byte" representation for non ASCII (0-127) characters. The .ind file contains

\begin{theindex}

  \item axioms
    \subitem Zermelo<E2><80><93>Fraenkel, 1

\end{theindex}

and, not so surprisingly, the .log file reports

 (./mohan.ind
Missing character: There is no <E2> in font cmr10!
Missing character: There is no <80> in font cmr10!
Missing character: There is no <93> in font cmr10!

Adding \usepackage[utf8]{inputenc} corrects the problem:

enter image description here

2

Seems to be a code problem with your given - in your code snippet.

The following MWE compiles without problems (errors and warnings) on my system and gives the print you want:

%http://tex.stackexchange.com/questions/75242/hyphens-in-index-entries
\documentclass{book}

\usepackage{makeidx}   % load package
\makeindex             % make file(s) *.idx

\begin{document}
Test\index{Test} Text\index{Text|textbf} 
test\index{axioms!Zermelo-Fraenkel} % - should be printed

\printindex            % print index here
\end{document}

(MiKTeX version 2.9)

  • Ah... by 'code problem' , I thought you meant, 'a problem with your code'. Just figured it out. Thank you. – Mohan Oct 4 '12 at 10:08

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.