4

I have a paragraph which starts with

\documentclass[a4paper,11pt,twoside]{book}
\setlength{\textwidth}{14.6cm}       
\hyphenation{MnTPPCl  CoTPP}
\begin{document}

We studied surface doping with the following molecules:
2,3,5,6-tetrafluoro-7,7,8,8-tetra\-cyano\-quino\-dimethane
(F$_4$TCNQ), manganese(III)-tetra\-phenyl\-porphyrin-chloride
(MnTPPCl), cobalt(II)-tetra\-phenyl\-porphyrin (CoTPP), and
fullerene (C$_{60}$).
\end{document}

which ends up to give an overlong line at "(MnTPPCl)"

enter image description here

Even giving possibilities for hyphenation, it gives me the overlong line with "(MnTPPCl)" sticking out. Why doesn't it just make a line break before "(MnTPPCl)"? How can I prevent it?

1 Answer 1

9

Without a full example, it is impossible to test but presumably breaking the line (MnTPPCl) would require stretching the white space more than the specified values.

You can use \sloppy to tell LaTeX to allow white space to stretch more than its usual limits.

or as egreg suggested set \emergencystretch which is a less aggressive change to teh typesetting quality:

\documentclass[a4paper,11pt,twoside]{book}
\setlength{\textwidth}{14.6cm}       
\hyphenation{MnTPPCl  CoTPP}
\begin{document}
\setlength\emergencystretch{2em}

We studied surface doping with the following molecules:
2,3,5,6-tetrafluoro-7,7,8,8-tetra\-cyano\-quino\-dimethane
(F$_4$TCNQ), manganese(III)-tetra\-phenyl\-porphyrin-chloride
(MnTPPCl), cobalt(II)-tetra\-phenyl\-porphyrin (CoTPP), and
fullerene (C$_{60}$).
\end{document} 

enter image description here

5
  • I updated it with a minimal example producing the mentioned overlong line.
    – Tanja
    Sep 8, 2013 at 13:48
  • 2
    Rather than \sloppy, something like \setlength{\emergencystretch}{.3\textwidth} might give better results, reserving \sloppy or (better) the sloppypar environment to very tough cases.
    – egreg
    Sep 8, 2013 at 14:01
  • @egreg true but I was thinking chemical names with hyphenation patterns designed for natural language probably is a "tough case" so reached straight for the sledgehammer. Sep 8, 2013 at 14:39
  • @user2758804 see update Sep 8, 2013 at 14:47
  • 1
    @user2758804 -- the line you would like broken has only two spaces in it. tex can distribute the stretch needed for breaking a line only at the existing spaces, so there is almost no flexibility in this example. applying \emergencystratch as suggested by egreg really requires some attention to the particular circumstance. sloppypar is probably the most appropriate action here, as its effect is more "surgical" than global. Sep 8, 2013 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .