4
  • I have a bilingual document.
  • The main language is English.
  • Throughout the document, I switch between the two languages.
  • I have noticed that babel writes language-specific commands in the toc file (e. g. \babel@toc {english}{}).
  • I provide an artificial MWE, see below. The actual document is Chinese and English.
  • Where the trouble begins...: In my real use case I use \today in the footline of the document.
  • Problem: In the footline of the toc chapter, the \today command produces (randomly) different outputs (language-specific).
  • Question: Can I prevent that \babel@toc is written to the toc file?

Content of the toc file.

\babel@toc {english}{}
\babel@toc {english}{}
\contentsline {section}{\numberline {1}English}{1}% 
\babel@toc {spanish}{}
\contentsline {section}{\numberline {2}Spanish}{1}% 
\babel@toc {english}{}
\contentsline {section}{\numberline {3}English}{1}% 

\documentclass{article}

\usepackage[spanish, english]{babel}

\begin{document}

\tableofcontents

%% English -------------------------
\selectlanguage{english}

\section{English}

Test \today

%% Spanish -------------------------
\selectlanguage{spanish}

\section{Spanish}

Test \today

%% English -------------------------
\selectlanguage{english}

\section{English}

Test \today

\end{document}

Even when I use

\begin{otherlanguage}{english}
    Text.
\end{otherlanguage}

and

\begin{otherlanguage}{spanish}
    Text.
\end{otherlanguage}

the problem occurs.

  • 4
    that is the wrong question. You don't want to prevent the commands in the toc but to force the right language in the footline. Use \selectlanguage{english}\today there. – Ulrike Fischer Dec 29 '19 at 12:20
  • @UlrikeFischer Thanks! I was just surprised that this has not caused other questions until now (at least I did not find any). It took me a while to understand the side effect that caused my weird observation :). – Dr. Manuel Kuehner Dec 29 '19 at 13:58
  • 4
    I’m voting to close this question because solven in comments. – Dr. Manuel Kuehner Mar 27 '21 at 02:39

0 Answers0