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.

I'm currently writing a larger document, which will also contain an index. Unfortunetely, the index produces a lot of bad boxes. Plase find a small example at the bottom.

My simple (but hopefully not too stupid) question is whether there is a way to avoid this. Rephrasing the index entries is not really an option as there are several long words.

Another possibility would be to just 'filter out' warning messages that appear in the index. Is there a way to do this?

\documentclass[paper=A4, fontsize=11pt, draft]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage[onehalfspacing]{setspace}
\usepackage{makeidx}
\usepackage[fleqn]{amsmath}
\usepackage{amsthm,amssymb}
\usepackage{tikz}
\usepackage{xspace}
\usepackage{booktabs}

\clubpenalty=9999
\widowpenalty=9999
\displaywidowpenalty=9999

\makeindex

\begin{document}

\emph{automata learning}\index{Automata learning|see{Algorithmic learning}}

\printindex

\end{document}
share|improve this question
    
Welcome to TeX.sx! It depends on what you do in your document (class, language, babel or not, two columns index, ...?). Can you please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Kurt Feb 7 '13 at 14:47
    
Please excuse my noobish question. You're of course right, I'll update my question asap. Thanx. –  Dan Feb 7 '13 at 15:26
add comment

2 Answers

up vote 8 down vote accepted

Loading the microtype package should reduce the number of ("underfull hbox") warnings. Another (or an additional) option is to set the index \RaggedRight (still allowing hyphenation) using my idxlayout package (which internally uses ragged2e).

\documentclass{article}

\usepackage{microtype}

\usepackage{makeidx}
\makeindex

\usepackage[justific=RaggedRight]{idxlayout}

\usepackage{lipsum}

\begin{document}

Some text.\index{\lipsum*[1]}

\printindex

\end{document}​

enter image description here

EDIT: In your added example, the actual problem is an "overfull hbox" not prevented by microtype. Using \RaggedRight is still an option; as an alternative, you may set \emergencystretch to a positive value (say, 1em) for the index.

\documentclass[draft]{scrbook}

\usepackage{microtype}

\usepackage{makeidx}
\makeindex

\begin{document}

\emph{automata learning}\index{Automata learning|see{Algorithmic learning}}

\begingroup
\emergencystretch=1em

\printindex

\endgroup

\end{document}
share|improve this answer
add comment

in my opinion, book indexes should almost always be set ragged right; indexes with justified material are "justifiable" only under very special conditions (see the texbook, pp.392-394 in appendix d for one such situation -- and even here, ragged right alternates with ragged left to avoid really bad spacing that would result from full justification).

scrbook.cls shows no evidence of using a ragged setting, so my advice would be to add it. i would probably do it by redefining theindex; see the definition of \theindex in amsbook.cls for an idea on where best to incorporate it.

whether you use the original \raggedright or the modified version from ragged2e doesn't really make a lot of difference in this situation.

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