2

To suppress hyphenation in section names I use \hyphenpenalty=10000 in \titleformat command.

Is there any similar way to suppress hyphenation in figure and table (and longtable) captions?

  • \captionsetup{justification=raggedright} makes unnecessary spaces at the end of line. \DeclareCaptionJustification{nohyphen}{\hyphenpenalty=10000} doesn't work. – kostr22 May 13 '14 at 11:11
2

The codes you put in the comment work to produce the effect that I think you want.

This image shows the default hyphenated layout in a table and longtable then the same again after declaring captions should be justified with no hyphenation (which gives TeX no choice but to over-stretch the space between Table and the number.)

enter image description here

\documentclass{article}

\usepackage{caption,longtable,ltcaption}
\setlength\textwidth{.4\textwidth}

\DeclareCaptionJustification{nohyphen}{\hyphenpenalty=10000}
\captionsetup{justification=nohyphen}

\begin{document}

\begin{table}
\centering
XXX
\caption{verylongwordverylongword verylongwordverylongword }
\end{table}

\begin{longtable}{ll}
aa&bb\\
\caption{verylongwordverylongword verylongwordverylongword }
\end{longtable}

\end{document}

Your Answer

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

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