2

The \foreignlanguage babel command introduces weird horizontal space at the beginning of the foreign text when used inside a document using the LLNCS (https://ctan.tetaneutral.net/macros/latex/contrib/llncs/llncsdoc.pdf) class. The problem doesn't appear with the default article class.

Minimal reproducible example:

\documentclass{llncs} \usepackage[main=french,english]{babel} \begin{document} Ceci est \foreignlanguage{english}{a test}. \end{document} 

Rendering of the minimal example

How it renders with the regular article class:

\documentclass{article} \usepackage[main=french,english]{babel} \begin{document} Ceci est \foreignlanguage{english}{a test}. \end{document} 

Rendering of the working example

Is there something I can do to remove that space other than negative vspaces?

2
  • the class adds a \switcht@albion command to the language switch which contains lots of spurious spaces. Commented Nov 23, 2022 at 16:27
  • this has come up before, you could add a lot of % to ends of lines in llncs.cls Commented Nov 23, 2022 at 16:30

2 Answers 2

3

The class is buggy and adds lots of spurious space. Redo the relevant definition and report the bug:

\documentclass{llncs} \usepackage[main=french,english]{babel} \makeatletter \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}} \makeatother \begin{document} Ceci est \foreignlanguage{english}{a test}. \end{document} 
1
  • Vendoring the class and adding those percent characters fixed it, thanks! Commented Nov 24, 2022 at 13:44
2

If you want to avoid editing a local copy you could ignore ends of lines while reading the class

\endlinechar=-1 \documentclass{llncs} \endlinechar=13 \usepackage[main=french,english]{babel} \begin{document} Ceci est \foreignlanguage{english}{a test}. \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.