5

Imagine you told your friend who likes to write novels as a hobby about the great typesetting which is possible with TeX so often that now he asked you to typeset his new novel with TeX. After studying Bringhurst you decided that computer modern will be the best possible font, that a4paper is the best possible paper format, that 10pt is the best possible font size for the project and that you want to let KOMA-script compute the text area for you. Now that the content is fixed because it's your friend's words and the layout is fixed because you don't want to mess with Bringhurst, you start typing:

\documentclass[DIV=calc]{scrbook}

\begin{document}
    Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\end{document}

You compile, and then the shock: An overfull hbox in the very first line:

enter image description here

Now, what are all the options to avoid the overfull hbox and in which order should you try to apply them?

Note that

  • You cannot rearrange the sentence.
  • You cannot change the global layout of the document.

I know that there are several discussions on how overfull hboxes arise on this site and several ways of avoiding them are mentioned. But as far as I know there is no practical set of rules for an un-experienced user (like I am) to follow. So I hope this question won't be a duplicate.

3
7

Not all of these are really suitable on this example, but they show a range of possible ways of attacking the problem

enter image description here

\documentclass[DIV=calc]{scrbook}

\begin{document}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).

\begin{sloppypar}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\end{sloppypar}


{\emergencystretch=20pt
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).

}


    Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arc}\)\-\(\mathrm{tanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).



{\spaceskip3pt plus 1pt minus 2.1pt 
    Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).

}


\end{document}

or with microtype

enter image description here

\documentclass[DIV=calc]{scrbook}

\usepackage{microtype}

\begin{document}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).



\end{document}
6
  • The last one is pure gold. – Alan Munn Mar 26 '18 at 20:34
  • you didn't try microtype. don't think it will help a great deal here, but would be worth looking at. – barbara beeton Mar 26 '18 at 20:36
  • @AlanMunn I had to squeeze the space beyond reasonable limits in this case , but as a tool sometimes squeezing the space can give a better result than the spacy results of \sloppy and \emergencystretch, On this example the best looking result is hyphenation, but I probably wouldn't use that on mathematics, but if the real example is a novel.... – David Carlisle Mar 26 '18 at 20:37
  • okay, that's the same result as with sloppypar. just pure bad luck. (but thanks for humoring me.) – barbara beeton Mar 26 '18 at 20:46
  • 1
    @ShreevatsaR -- sometimes the result from microtype is the same as with sloppypar. it depends on how much "slop" is available, and in this case the flexibility of the spaces just isn't enough to allow that last long word to be included i the relevant line. if the "offending" word is later in the paragraph, there's a better chance; the first line is always the hardest to accommodate. (experience with tugboat is excellent with respect to improved line breaking.) – barbara beeton Mar 27 '18 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy