Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel language imported twice #8925

Closed
frederik-elwert opened this issue Jun 28, 2023 · 0 comments
Closed

Babel language imported twice #8925

frederik-elwert opened this issue Jun 28, 2023 · 0 comments
Labels

Comments

@frederik-elwert
Copy link
Contributor

Explain the problem.

If a span/div has a lang attribute that matches the main document language, the language gets imported twice in the LaTeX template. In certain situations, this can cause an error that prevents the document from compiling.

The issue seems to be in the collection of babel-otherlangs: It appears to collect all languages that are set in the document body. But this might include the main document language. In this case, babel imports the language twice: Once as the main document language, and once as an additional language.

Minimal example:

---
lang: en
---

An English sentence.

::: {lang=de}

Ein Absatz auf Deutsch, aber ein Teil ist trotzdem [English]{lang=en}.

:::

The resulting tex file contains these lines:

\babelprovide[main,import]{english}
\babelprovide[import]{ngerman}
\babelprovide[import]{english}

This causes xelatex to fail:

$ docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/latex:3.1-ubuntu  --pdf-engine xelatex 001_otherlangs.md -o 001_otherlangs.pdf
Error producing PDF.
! LaTeX Error: Command \englishdate  already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.50 \babelprovide[import]{english}

Interestingly, xelatex actually runs fine on my local Ubuntu 22.04, but fails in the docker container. I assume (but am not sure) that this has to do with the different TeXLive installs/versions. But regardless, this seems to be a pandoc error: The main language babel-lang should be excluded when collecting babel-otherlangs.

Pandoc version?

The pandoc 3.1 docker container, which is the newest available. (It contains pandoc 3.1.1 atm.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant