You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}.
:::
$ 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.)
The text was updated successfully, but these errors were encountered:
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:
The resulting tex file contains these lines:
This causes xelatex to fail:
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 collectingbabel-otherlangs
.Pandoc version?
The pandoc 3.1 docker container, which is the newest available. (It contains pandoc 3.1.1 atm.)
The text was updated successfully, but these errors were encountered: