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

Adding a variable romanfont #4665

Merged
merged 2 commits into from
Nov 3, 2018
Merged

Adding a variable romanfont #4665

merged 2 commits into from
Nov 3, 2018

Conversation

OvidiusCicero
Copy link
Contributor

It would be nice to have a possibility to set the romanfont in xelatex/lualatex over a variable since mainfont actually oversets sansfont in headings

It would be nice to have a possibility to set the romanfont in xelatex/lualatex over a variable since mainfont actually oversets sansfont in headings
Changed stupid mistake
@jgm
Copy link
Owner

jgm commented Nov 3, 2018

MANUAL.txt should also be updated (search for mainfont and mainfontoptions).

@jgm jgm merged commit 6beb1fc into jgm:master Nov 3, 2018
@adunning
Copy link
Contributor

@OvidiusCicero Would you mind providing an example of how you're using this? I can't reproduce the situation that you describe in the original commit, and am wondering if there is a better way to solve it.

There is no documentation of romanfont in the fontspec manual. Setting both mainfont and romanfont with the standard classes gives unexpected results, with romanfont overwriting mainfont but only after inheriting its scale, which isn't likely the desired effect.

screen shot 2019-01-11 at 16 06 10

pandoc -o test.pdf --pdf-engine=xelatex << EOT

---
title: Font Family Test
fontsize: 12pt
mainfont: Helvetica
romanfont: Palatino
sansfont: Gill Sans
monofont: Courier
---

# Fonts

The quick fox --- \the\fontdimen6\font\relax

\normalfont

The quick fox --- \the\fontdimen6\font\relax

\rmfamily

The quick fox --- \the\fontdimen6\font\relax

\sffamily

The quick fox --- \the\fontdimen6\font\relax

\ttfamily

The quick fox --- \the\fontdimen6\font\relax

EOT

@jgm
Copy link
Owner

jgm commented Jan 12, 2019

@adunning if you think this was a misguided change, then (after getting clarification from @OvidiusCicero) it would be good to open a new issue or PR, so this doesn't get lost.

@OvidiusCicero
Copy link
Contributor Author

OvidiusCicero commented Jan 12, 2019

@adunning @jgm You're right in so far that the problem seems to be burried in the pandoc template and not within fontspec which is what I seemingly misunderstood 9 months ago

Giving the whished result:

test.tex

\documentclass{scrartcl}

\usepackage{fontspec}

% Both work
%\setromanfont{Linux Libertine}
\setsansfont{Linux Biolinum}
\setmainfont{Linux Libertine}

\begin{document}

\section{Test should be in Linux Biolinum}
Text, should be in Linux Libertine

\end{document}

In Linux Biolinum
grafik

Hopefully reproducible minimum example:

test2.md

# Test should be in Linux Biolinum}

Text, should be in Linux Libertine

Compile with

pandoc test2.md -o test2.pdf --pdf-engine=xelatex --variable=mainfont:"Linux Libertine" --vari
able=sansfont:"Linux Biolinum"

Not in Biolinum
grafik

I ended up hardcoding it in my own temlpate

I'm on a Windows 10 machine. The fonts are installed on the system. Probably using old version of pandoc

pandoc.exe 2.0.5
Compiled with pandoc-types 1.17.3, texmath 0.10, skylighting 0.5
Default user data directory: C:\Users\Christian\AppData\Roaming\pandoc
Copyright (C) 2006-2017 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

@adunning
Copy link
Contributor

You're seeing that because the scrartcl document class sets its headings in the sans-serif font, but by default Pandoc uses the article document class. You can set the document class as a variable to get the same result as your LaTeX file:

pandoc -o libertine.pdf -V mainfont="Linux Libertine" -V sansfont="Linux Biolinum" -V documentclass="scrartcl" --pdf-engine=xelatex << EOT

# Test should be in Linux Biolinum

Text, should be in Linux Libertine

EOT

If that solves your problem, I hope you wouldn't have any objections to removing the romanfont variable?

@OvidiusCicero
Copy link
Contributor Author

Ah okay, that makes sense

I find romanfont to have clearer semantics in some cases but I do not object

@adunning
Copy link
Contributor

Thank you! This will prevent it from unexpectedly changing the font size on someone.

There's no question that romanfont certainly does sound better, and makes much more sense with KOMA-Script in particular. It's strange that the option is completely undocumented.

jgm pushed a commit that referenced this pull request Jan 13, 2019
Simplify the approach of #5212, ensuring that `mainfont` is used as the base font for scaling and that LuaLaTeX does not display the mono font with TeX ligatures (as it does not use the `Mapping=tex-ansi` option).

With a modified version of `\defaultfontfeatures`, fontspec will continue to report scaling against the old default font in the log, but it nonetheless displays main font at the specified size. Using this rather than setting `Scale=MatchLowercase` for each family individually means that users will not lose scaling when upgrading to the new template if they were using other font options. Scaling can be disabled for an individual family by adding the option `Scale=1` to `sansfontoptions`, `monofontoptions`, etc.

Remove the `\setromanfont` command added in #4665, as this is not documented in the fontspec manual and appears to be a deprecated alias for `\setmainfont`.

For the release notes, I should also add that one can imitate the previous appearance with `-V mainfontoptions="Scale=MatchLowercase"`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants