7

Consider the following example:

\documentclass{article}

\usepackage[french]{babel}
\usepackage{amsthm}

\begin{document}

Some text

\begin{proof}
\end{proof}
\begin{proof}
\end{proof}

Some text

\begin{proof}
\end{proof}
\selectlanguage{french}%
\begin{proof}
\end{proof}

Some text

\end{document}

which resulted in:

enter image description here

As one can see, the use of \selectlanguage{French} in the middle of two proof environments causes some extra whitespace. I think this is probably because some missing % in the definition of \selectlanguage, but how can I fix this on my side?

1 Answer 1

5

It is not triggered by spurious spaces--if you use \selectlanguage between words you can see that it is doesn't produce a space--, the problem is that \selectlanguage contains \write commands, this is a whatsits and change spacing. You would get a similar effect e.g. with \addcontentsline.

hyperref which creates lots of whatsits too has some code to save and restore spacing, see also https://tex.stackexchange.com/a/578793/2388 and https://github.com/latex3/babel/issues/114.

\documentclass{article}

\usepackage[french]{babel}
\usepackage{amsthm}
\usepackage{hyperref}
\begin{document}

Some text

\begin{proof}
\end{proof}
\begin{proof}
\end{proof}

Some text

\begin{proof}
\end{proof}
%
\makeatletter
\Hy@SaveLastskip
\selectlanguage{french}%
\Hy@RestoreLastskip
\makeatother
\begin{proof}
\end{proof}



\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .