1

Cleveref formats a long list of references to theorem-like environments as "Thm. 1, Prop. 2, ..., and Cor. 3". Is there a way to generally allow a line break after "and"? The line breaks between "Thm.", "Prop.", "Cor.", etc., and the following numbers should stay forbidden.

For example, in the code below, the line

No sex, but an overly, very clever space-filling text. (Thm. 1.1.1 and Cor. 1.2.1.10).

runs into the page margin, which is not what I wish.

\documentclass{article}
\usepackage{cleveref}
\usepackage{lipsum}
\newtheorem{thmSS}{Theorem}[subsection]
\newtheorem{corSSS}{Corollary}[subsubsection]
\crefname{thmSS}{Thm.}{Thms.}
\crefname{corSSS}{Cor.}{Cors.}
\begin{document}
\section{Clever section title}
\lipsum[1]
No sex, but an overly, very clever space-filling text. (\cref{mythm,mycor}).
\lipsum[1]
\subsection{Clever subsection title}
\begin{thmSS}\label{mythm}Clever theorem\end{thmSS}
\subsection{Another clever subsection title}
\subsubsection{Clever subsubsection title}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}\label{mycor}Clever corollary\end{corSSS}
\end{document}

I would not like to use \begin{sloppypar}...\end{sloppyppar}, since it introduces a line break before "and", making the spaces between the words visually too long.

1

The conjunction between both is a command that you can redefine (\crefpairgroupconjunction). It should be done after \begin{document} (or through \AtBeginDocument), if babel is involved you should do it in the language settings. But redefining it and so removing the nonbreakspace won't help much in your case, TeX will still not break, you need e.g. some \emergencystretch too:

\documentclass{article}
\usepackage{cleveref}
\usepackage{lipsum}
\newtheorem{thmSS}{Theorem}[subsection]
\newtheorem{corSSS}{Corollary}[subsubsection]
\crefname{thmSS}{Thm.}{Thms.}
\crefname{corSSS}{Cor.}{Cors.}
\begin{document}
\renewcommand\crefpairgroupconjunction{ and  }
\section{Clever section title}
\lipsum[1]
{\emergencystretch2em No sex, but an overly, very clever space-filling text. (\cref{mythm,mycor}).\par}
\lipsum[1]
\subsection{Clever subsection title}
\begin{thmSS}\label{mythm}Clever theorem\end{thmSS}
\subsection{Another clever subsection title}
\subsubsection{Clever subsubsection title}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}Clever corollary\end{corSSS}
\begin{corSSS}\label{mycor}Clever corollary\end{corSSS}
\end{document}

enter image description here

  • 1
    Yes and no (spaces are imho needed but the number don't matter). – Ulrike Fischer May 18 '17 at 23:06
1

For the occasional unbreakable space to remove, you can redefine locally \crefpairgroupconjunction:

No sex, but some overly, very clever space-filling text.
\begingroup\renewcommand\crefpairgroupconjunction{ and }(\cref{mythm,mycor})\endgroup.

enter image description here

  • 1
    @LeonMeier Finer control introduced – egreg May 18 '17 at 22:30
  • 1
    @LeonMeier I get the same output as before. – egreg May 18 '17 at 22:50
  • 1
    @LeonMeier No other change. – egreg May 18 '17 at 23:12

Your Answer

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