# How to suppress hyphenation in figure and table captions?

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

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.)

\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}