jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.97k stars 3.35k forks source link

LaTeX template: fontfamily and mainfont #8017

Open bernardjoseph opened 2 years ago

bernardjoseph commented 2 years ago

The mainfont, sansfont, monofont etc. variables should only be used in the LaTeX template if no fontfamily package is used. Various fontfamily packages like newpxtext set the mainfont etc. in lualatex. In this case it is not necessary to set the mainfont variable explicitly. But the mainfont variable is also used in the HTML template. That means that there is still a point to set the mainfont variable even if the mainfont is already set by the fontfamily package. I think the mainfont, sansfont, monofont etc. variables should be respected in the LaTeX template only if no fontfamily is given. For example:

fontfamily: newpxtext
mainfont: TeX Gyre Pagella

In LaTeX output, TeX Gyre Pagella is set as the mainfont by newpxtext and by the mainfont entry. In HTML output, TeX Gyre Pagella is set by the mainfont entry; therefore the mainfont entry is not superfluous.

Regards Bernd

jgm commented 2 years ago

OK, do you want to suggest a specific change to the template?

bernardjoseph commented 2 years ago

My first opinion was to enclose the mainfont things in the latex template with $if(fontfamily$$else$...$endif$. But then one depend on the fontfamily package setting the mainfont when used with luatex.

bernardjoseph commented 2 years ago

Another solution would be to use different variables in the HTML template instead of mainfont and monofont.