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

Passing american to \babelfont produces LaTeX error when realscript is used #8728

Closed
fiapps opened this issue Mar 28, 2023 · 3 comments
Closed
Labels

Comments

@fiapps
Copy link

fiapps commented Mar 28, 2023

Explain the problem.
MWE (test.md):

---
lang: en-US
mainfont: cochineal
header-includes: | 
    ```{=latex}
    \usepackage{realscripts}
    ``` 
---

test^[this]

Command line: pandoc test.md --pdf-engine=xelatex -o test.pdf
Error:

Error producing PDF.
! LaTeX Error: Key 'fontspec-opentype/Language' accepts only a fixed set of
(LaTeX)        choices.

For immediate help type H <return>.
 ...                                              
                                                  
l.74 test\footnote{

Environment: pandoc 3.1.1, macOS 12.6.3, TeXLive 2023

The error depends on the line \babelfont[american]{rm}{cochineal}. If american is changed to english, xelatex completes the required two passes without error. With american, it fails on the second pass. Also if [american] is deleted, two XeLaTeX passes complete without error. I know 3.1.2 has been released, but it's not yet available through Homebrew, and the LaTeX template looks like it would still produce this line.

The bug here may be in babel, because specifying [american] works with TeXLive 2021, but I don't think pandoc should be passing any language here in the template. As I read the babel documentation, one passes a language to \babelfont in order to use a different font for a specific language. So this first invocation should not pass a language, because it's setting the default font. It's only with the new babelfonts variable that a language should be passed, to override the default \babelfont for a specific language or languages.

So I propose changing line 366 of data/templates/default.latex from
\babelfont[$babel-lang$]{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
to
\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}

@fiapps fiapps added the bug label Mar 28, 2023
@jgm
Copy link
Owner

jgm commented Mar 28, 2023

You're probably right. We can try it. See #8538 -- I want to make sure we don't break what we fixed there.

@jgm
Copy link
Owner

jgm commented Mar 28, 2023

OK, seems to work in both cases. I'll make the change.

@jgm jgm closed this as completed in a5159c2 Mar 28, 2023
@fiapps
Copy link
Author

fiapps commented Mar 29, 2023

Thanks for the quick fix. I'll just use the corrected template with --template until the next release.

dragonstyle added a commit to quarto-dev/quarto-cli that referenced this issue Jul 8, 2023
jjallaire added a commit to quarto-dev/quarto-cli that referenced this issue Jul 10, 2023
* initial import for pandoc 3.1.5

* changes to typst templates for pandoc 3.1.5

* Update template to match pandoc 3.1.5

(Fix for this issue jgm/pandoc#8728)

* remove unused

* Adapt format typst for Pandoc 3.1.5 new behavior.

Typst own citation is still used by default, so citeproc by Pandoc needs to be activated explicitly using `citeproc: true`. In that case, we add `-citations` extensions if not set already by the users.

What has changed since #5575:

- Patch to set a variables for Pandoc template is no more needed as Pandoc will do that now when `+citations` is passed (default for `--to typst` in Pandoc) -> change in Pandoc 3.1.5

- Short syntax to typst labels is used now so test needs to be adapted -> change in Pandoc 3.1.3

* typst: remove footnote filter (now handled by pandoc)

* remove call to render-typst

* update changelog

---------

Co-authored-by: Charles Teague <[email protected]>
Co-authored-by: Christophe Dervieux <[email protected]>
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

2 participants