LaTeX manuals are full of examples such as Fig.~5
or Thm.~10
. The tilde prohibits a line break after the abbreviation completely, to make sure that the reader doesn't see a period at the end of a line and think that the current sentence is over and the next line is numbered. However, sometimes it's better to break after the period because other alternatives would be worse, e.g., when a long Probl.~1.2.3.4.5.6
runs into the margin, to which the publisher rightfully says it quits the print area or the visible area.
What would be an elegant way to tell LaTeX to make a break after the full stop only if otherwise the typesetting gets really nasty? E.g., is there any better, short, elegant way of saying Probl.\@\penalty5000\ 1.2.3.4.5.6
? I randomly took 5000 here; please feel free to adjust this number accordingly (and say why you take a different value if you adjust it). Of course, we would like the solution to work regardless of whether we use French or English spacing and, ideally, with cleveref. My attempts:
\documentclass{article}
\usepackage{float}
\usepackage{cleveref}
\crefname{figure}{Fig.\@\penalty5000}{Figs.\@\penalty5000}
\showoutput
\begin{document}
\nonfrenchspacing%% to have the most general solution
See Fig.\@\penalty5000\ \labelcref{figure_label}\@.%% Not elegant at all
\begin{figure}[H]
\caption{No, this has nothing to do with the manual ``See Figure 1''. Don't search for it online, please.}
\label{figure_label}
\end{figure}
See \cref{figure_label}. %% Produces \penalty5000\penalty10000 in the output :-(.
Consider the last \namecref{figure_label}%%% Let's say the sentence is logically over. In this case, having a huge \penalty5000\penalty10000 here is simply wrong.
\end{document}