jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.83k stars 3.39k forks source link

German quotes: csquotes: true in defaults file has no effect #10403

Open periodicpoint opened 4 days ago

periodicpoint commented 4 days ago

The goal I wanted to have German quotes: „…“ instead of English quotes: “…” when transpiling from markdown to PDF.

The problem When transpiling with pandoc and a defaults file from markdown to pdf, csquotes: true in the defaults has no effect. However if put it in the metadata file it works. The language setting lang: de-De in the metadata file seems to have no effect. The from: markdown+smart extension has no effect.

Expected behavior Localized quotes and in this case German quotes should be controlled via the lang: variable in the metadata file (solely in the best case) and/or via the csquotes: or an alternative variable in the defaults file (if necessary). The variable csquotes: loads the corresponding LaTeX package and defines a specific property of the typography of the LaTeX file and resulting PDF and hence should not be managed as metadata.

Pandoc version pandoc 3.1.11.1 Features: +server +lua Scripting engine: Lua 5.4

OS Arch Linux TeXLive: texlive-full Version: 1:2024.20240331-1

jgm commented 4 days ago

There is no --csquotes option; you control this by setting a variable or metadata (as documented). That is why it doesn't work to put csquotes: true directly in the defaults file. All of this is as documented.

periodicpoint commented 4 days ago

This might be a misunderstanding. Actually I did put csquotes: true in my defaults file but this is not working. If I put csquotes: true in the metadata file and link it in the defaults file it is working. What am I overlooking?

Regarding the documentation: I know that this is documented. Is this documented well? I do not think so TBH. All I can find in the manual is the following:

“If the mathspec variable is set, xelatex will use mathspec instead of unicode-math. The upquote and microtype packages are used if available, and csquotes will be used for typography if the csquotes variable or metadata field is set to a true value.”

Which is not that clear IMHO. I would suggest putting it explicitly in the defaults file in the docs. This is another topic though.

In any case. Thank you four you quick response. :)

jgm commented 4 days ago

It can go in your defaults file but it must be under the variables or metadata section, to set a variable.

csquotes will be used for typography if the csquotes variable or metadata field is set to a true value.

seems clear enough: it is saying that you need to set the csquotes variable or metadata field to cause csquotes to be used. It does not say that you can use csquotes as a top-level field in defaults files, nor does the documentation for defaults files suggest that...

periodicpoint commented 4 days ago

Thank you for the clarification! :) Yet, I am afraid, for me it is still not working as expected.

Case A: Working File: defaults.yaml

metadata:
  csquotes: true

Case B: Not working File: defaults.yaml

variables:
  csquotes: true

It should work in case B too (which would be the more logical case), in my opinion .

jgm commented 4 days ago

I see why it isn't working.

https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Writers/LaTeX.hs#L160-L164

Returns Nothing when the variable has a Boolean value, as it would get from a defaults file like this.

I'll reopen this issue to fix this.