Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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

share|improve this answer
add comment

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)

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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