-
It is very common to have academic documents with more than one language. In latex we would add: \usepackage[american, brazil]{babel} But this is hardcoded! I want the possibility of setting different languages with metadata. #...
babeloptions:
- american
- brazil |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
If you control the Pandoc template (that is, you're creating new ones), then your template can get information directly from the metadata, like we describe here: https://quarto.org/docs/journals/templates.html#template-partials. That's probably the best option if you're going to use custom LaTeX packages anyway. |
Beta Was this translation helpful? Give feedback.
-
@fredguth Just to give some context on how Pandoc is handling multiple langue by default - interesting as we are based on Pandoc's template and leveraging such features.
---
format: pdf
lang: en
keep-tex: true
---
This is in English
::: {lang=fr}
Mais cela est écrit en Français
:::
And another [ejemplo]{lang=es} In the generated TeX, we get \ifLuaTeX
\usepackage[bidi=basic]{babel}
\else
\usepackage[bidi=default]{babel}
\fi
\babelprovide[main,import]{english}
\babelprovide[import]{french}
\babelprovide[import]{spanish} You see that mutliple languages are correctly defined for babel using The specific syntax with Divs or Spans will also make sure that correct LaTeX command is used
I believe this mechanism work in Quarto, including Books. Anyway, this is how Pandoc supports mutliple languages with babel. Did you try this already ? Hope it helps |
Beta Was this translation helpful? Give feedback.
-
For reference: |
Beta Was this translation helpful? Give feedback.
@fredguth Just to give some context on how Pandoc is handling multiple langue by default - interesting as we are based on Pandoc's template and leveraging such features.
lang
in YAML is used to defined main language to use, and any other language needed for other content in a document is to be set on block or inline basis usinglang
attributes on Divs or Spans created. This is explain in https://pandoc.org/MANUAL.html#language-variables and here is an exampleIn the generated TeX, we get