As tomorrow is April 1, I'd like to send a somewhat special interim version of my thesis to my supervisor. In the TeXbook, there is a chapter that is set up to make TeX fall in love with hyphenation. I like how it manages to hyphenate nearly every end-of line.

However, applying this to my document, I ended up with something like this:

\usepackage[hang,small,bf]{caption} % not loading this "fixes" my problem

%\captionsetup{singlelinecheck=false} % this also causes the problem to disappear, but I like the singlelinecheck

% handy commands from the TeXbook to apply all the best typographical rules regarding hyphenation


        \caption{Figure Caption that Should not Be Hyphenated}



Note how the text is nice and readable, but the caption is broken at every discetionary hyphen.

Apparently, this is somehow related to the way caption checks whether the caption fits into a single line and should be centered. Also, if I don't load the package at all, the problem disappears.

Is there a better way to fix this or to configure caption to use the normal hyphenation settings?

  • (not tested) you can try, within the figure environment, to add \hyphenpenalty=10000 \exhyphenpenalty=10000. figure gives a local group, so these settings should not persist outside that environment. (but the same rules wouldn't carry over to a list of figures, if you have one.) – barbara beeton Mar 31 '16 at 15:34
  • @barbarabeeton: Actually, the list looks fine. I was mostly wondering if there was an automatic way to do this, but of course I could use \AtBeginEnvironment for that. I just tested your suggestion and it works. – wrtlprnft Mar 31 '16 at 15:40
  • 1
    @wrtlprnft \DeclareCaptionFont{nohyphen}{\hyphenpenalty=10000 \exhyphenpenalty=10000\relax}\captionsetup{font+=nohyphen} (in the document preamble) should do the trick as well. – Axel Sommerfeldt Mar 31 '16 at 20:21
  • @AxelSommerfeldt thanks, that was the trick I was looking for! – wrtlprnft Apr 1 '16 at 7:12
  • Another way: \let\svcaption\caption \renewcommand\caption[1]{\bgroup\pretolerance=10000\relax\svcaption{#1}\egroup} – Steven B. Segletes Jun 2 '17 at 17:28

Your Answer

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

Browse other questions tagged or ask your own question.