5

I am using the LNCS springer class in its newest version.

MWE1:

\documentclass[runningheads]{llncs}[2018/03/10]
\usepackage{blindtext}
\begin{document}
\maketitle
\blindtext[10]
\end{document}

Output:

MWE1 output

MWE2:

\documentclass[runningheads]{llncs}[2018/03/10]
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\maketitle
\blindtext[10]
\end{document}

Output:

enter image description here

Reproduce it by:

 docker run --rm -it -v "$(pwd):/home" danteev/texlive pdflatex paper-min.tex

Works on Linux and on PowerShell. System configuration: https://github.com/dante-ev/docker-texlive/blob/master/Dockerfile

*File List*
  llncs.cls    2018/03/10 v2.20 
LaTeX document class for Lecture Notes in Computer Science
article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
multicol.sty    2017/04/11 v1.8q multicolumn formatting (FMi)
aliascnt.sty    2009/09/08 v1.3 Alias counter (HO)
remreset.sty    
  babel.sty    2018/02/14 3.18 The Babel package
english.ldf    2017/06/06 v3.3r English support from the babel system
blindtext.sty    2012/01/06 V2.0 blindtext-Package
  xspace.sty    2014/10/28 v1.13 Space after command names (DPC,MH)
***********

On MiKTeX it also happens:

*File List*
  llncs.cls    2018/03/10 v2.20 
LaTeX document class for Lecture Notes in Computer Science
article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
multicol.sty    2018/04/20 v1.8s multicolumn formatting (FMi)
aliascnt.sty    2009/09/08 v1.3 Alias counter (HO)
remreset.sty    
  babel.sty    2018/06/05 3.22 The Babel package
bblopts.cfg    2005/09/08 v0.1 add Arabic and Farsi to "declared" options of b
abel
english.ldf    2017/06/06 v3.3r English support from the babel system
blindtext.sty    2012/01/06 V2.0 blindtext-Package
  xspace.sty    2014/10/28 v1.13 Space after command names (DPC,MH)
***********

Similar problems happen with German and French.

egreg
  • 1,121,712
koppor
  • 3,252
  • 1
    I added the similar patches for French and German. Please, don't invalidate existing answers. You should have first asked in a comment to my answer about German. – egreg Jul 15 '18 at 14:34

3 Answers3

6

It's a bug in llncs.cls, namely, missing % at end of lines 79-114. which should be:

\def\switcht@albion{%
\def\abstractname{Abstract.}%
\def\ackname{Acknowledgement.}%
\def\andname{and}%
\def\lastandname{\unskip, and}%
\def\appendixname{Appendix}%
\def\chaptername{Chapter}%
\def\claimname{Claim}%
\def\conjecturename{Conjecture}%
\def\contentsname{Table of Contents}%
\def\corollaryname{Corollary}%
\def\definitionname{Definition}%
\def\examplename{Example}%
\def\exercisename{Exercise}%
\def\figurename{Fig.}%
\def\keywordname{{\bf Keywords:}}%
\def\indexname{Index}%
\def\lemmaname{Lemma}%
\def\contriblistname{List of Contributors}%
\def\listfigurename{List of Figures}%
\def\listtablename{List of Tables}%
\def\mailname{{\it Correspondence to\/}:}%
\def\noteaddname{Note added in proof}%
\def\notename{Note}%
\def\partname{Part}%
\def\problemname{Problem}%
\def\proofname{Proof}%
\def\propertyname{Property}%
\def\propositionname{Proposition}%
\def\questionname{Question}%
\def\remarkname{Remark}%
\def\seename{see}%
\def\solutionname{Solution}%
\def\subclassname{{\it Subject Classifications\/}:}%
\def\tablename{Table}%
\def\theoremname{Theorem}}

babel attempts to fix this kind of bug, but doesn't always succed (in this particular case because this macro is being added to \extrasenglish, not to \captionsenglish).

Also \switcht@francais and \switcht@deutsch have unprotected end-of-lines, although quite well concealed.

Javier Bezos
  • 10,003
  • Although I also agree, \switcht@deutsch is correctly defined, it does not work with ngerman. I updated my question accordingly. – koppor Jul 15 '18 at 14:27
4

Javier Bezos has nailed it and credit should be given to him.

Until Springer fixes the bug related to \switcht@albion that, by the way, can be seen with the simple

\documentclass{llncs}
\usepackage[english]{babel}
\begin{document}
X\selectlanguage{english}X
\end{document}

which prints “X<several spaces>X”, you can recursively patch the faulty macro once and for all:

\documentclass[runningheads]{llncs}
\usepackage[english]{babel}
\usepackage{etoolbox}

\makeatletter
\def\recursivepatch{%
  \ifpatchable\switcht@albion{ \def}
    {%
     \patchcmd\switcht@albion{ \def}{\def}{}{}%
     \recursivepatch
    }
    {\undef\recursivepatch}%
}
\recursivepatch
\makeatother

\begin{document}

\maketitle

X\selectlanguage{english}X
\clearpage
X\selectlanguage{english}X

\end{document}

enter image description here

Alternatively, prepend \relax to the macro and use \xpatchcmd* for doing all patches in one step.

\documentclass[runningheads]{llncs}
\usepackage[english]{babel}
\usepackage{regexpatch}

\makeatletter
\edef\switcht@albion{%
  \relax\unexpanded\expandafter{\switcht@albion}%
}
\xpatchcmd*{\switcht@albion}{ \def}{\def}{}{}
\xpatchcmd{\switcht@albion}{\relax}{}{}{}
\makeatother

\begin{document}

\maketitle

X\selectlanguage{english}X
\clearpage
X\selectlanguage{english}X

\end{document}

Actually the same problem happens for French and German. One has to repeat the patches also for those languages:

\makeatletter
\edef\switcht@albion{%
  \relax\unexpanded\expandafter{\switcht@albion}%
}
\xpatchcmd*{\switcht@albion}{ \def}{\def}{}{}
\xpatchcmd{\switcht@albion}{\relax}{}{}{}
\edef\switcht@deutsch{%
  \relax\unexpanded\expandafter{\switcht@deutsch}%
}
\xpatchcmd*{\switcht@deutsch}{ \def}{\def}{}{}
\xpatchcmd{\switcht@deutsch}{\relax}{}{}{}
\edef\switcht@francais{%
  \relax\unexpanded\expandafter{\switcht@francais}%
}
\xpatchcmd*{\switcht@francais}{ \def}{\def}{}{}
\xpatchcmd{\switcht@francais}{\relax}{}{}{}
\makeatother
egreg
  • 1,121,712
2

The bug has been fixed in llncs.cls, version 2.21.