3

The documentclass langscibook (based on scrbook) provides the option booklanguage . Default is english. I have successfully used french, portuguese, and german in the past.

Internally, the option value is passed to babel.

This sets hyphenation and changes "Contents" to "Table des matières", "Conteúdo", "Inhaltsverzeichnis" and so on.

When I say booklanguage=spanish I do get "Índice general" for the table of contents, but compilation stops after that.

...
Runaway argument?
! Forbidden control sequence found while scanning use of \language@active@arg~.
<inserted text> 
                \par 
l.6 \maketitle
              
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
...

The following works

\documentclass[booklanguage=german]{langscibook}
\author{John Doe}
\title{The test}
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
\chapter{test}
123
\end{document}

When "german" is changed to "spanish", it does not work any longer:

\documentclass[booklanguage=spanish]{langscibook}
\author{John Doe}
\title{The test}
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
\chapter{test}
123
\end{document}

The relevant portions of the code in langscibook.cls are

Line 165ff

\DeclareStringOption{booklanguage}[english]
    \define@key{langscibook}{booklanguage}{%
        \renewcommand{\lsBookLanguage}{#1}}

line 1392

    \usepackage[\lsBookLanguage]{babel}

When I switch to {scrbook} , I can \usepackage[spanish]{babel} without problems.

To sum up, {scrbook} + babel works with all languages, but {langscibook} + babel works with english, german, french, portuguese, and chinese, but not with spanish. I fail to see the reason for this behaviour. Any hints are appreciated.

A minimal working example containing also the langscibook.cls file can be found here

https://www.overleaf.com/read/tdrjbmxxhbrp

1 Answer 1

7

spanish redefines the tilde ~ to be an accent. But the class uses it all over the place in the standard meaning of a space, and this clashes. You can tell babel-spanish to leave the tilde alone:

\documentclass[booklanguage={spanish,es-notilde}]{langscibook}

\author{John Doe}
\title{The test}
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
\chapter{test}
123
\end{document}
1
  • Thanks a lot. This solved the issue. I ran into another issue with < and >, which are probably also redefined somewhere. I used \textrangle and \textlangle to circumvent this.
    – Snord404
    Jun 22, 2021 at 13:35

You must log in to answer this question.

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