-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
latex template: set fonts after Beamer theme #8316
Conversation
I'm slightly nervous about the way in which this breaks up the current font settings, moving some of them after the beamer theme options and leaving some where they are. That adds complexity. Wouldn't it be simpler just to move the block concerning beamer themes before all the font settings? Or is there some reason that won't work? |
I agree splitting the font-related code is unfortunate. I did it this way to minimize the risk of introducing problems or changing current behavior: Moving some Now looking in more details at what the themes actually do, I don't see anything obvious that should cause troubles. I also just tested a template with beamer theme loading moved upwards together with other beamer commands, and was able to compile a few presentations without issue. Shall I amend this PR accordingly? |
Yes, I think it's desirable if possible to keep the font stuff together in the template. |
I used the following document:
and compared the output between these two versions:
This uncovers at least two issues with the second version:
Another possibilty is to move the Beamer logic after the main font package loading and defaults, but before the font setting code: knuesel@e4d6a95 . Compared to the current PR, this leaves the loading of packages |
Thanks for investigating. That approach seems cleaner to me. But it would be worth checking with e.g. a Chinese document, with lang set to zh-CN, so that CJK code will be used. |
3dce24e
to
878fd2c
Compare
I tried compiling a Beamer presentation from https://github.com/mba811/dev-study/tree/master/Markdown with metadata
and it works fine (with and without the proposed changes) with xelatex and lualatex. (With lualatex there's an unrelated error that looks like https://tex.stackexchange.com/questions/609104/lualatex-ctex-and-microtype-together-produce-errors-when-using-scshape; it works when disabling microtype.) I've updated the PR to the new approach. |
To fix the tests, you can do |
878fd2c
to
7a2e705
Compare
Ah thanks, the tests should pass now. The golden files now have a silly section
but that seems difficult to avoid without making the template much more verbose (with a pdftex check for each font setting). |
That is odd.
Then it will look like
and it least it will be clear what this section is for. I don't know, what do you think? The other thing that's a bit odd is that fonts can be selected to override beamer theme fonts ONLY in xelatex/lualatex. Why should that be? |
7a2e705
to
92f9d31
Compare
Good idea, and I also see it's odd for the comment to mention a Beamer theme, when using regular LaTeX. I pushed some changes, so now in the worst case it looks like this: \usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math} % this also loads fontspec
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\ifPDFTeX\else
% xetex/luatex font selection
\fi It still looks a bit odd to have the empty "if" block split from the rest, but that's already an improvement I think? Regarding the second point: another good point... in the PR I'm only moving the fontspec commands
This applies to all engines. I think the |
We could just put these lines under the |
This does sound more consistent, so please do. |
92f9d31
to
0f4da6f
Compare
Beamer themes such as metropolis and saintpetersburg change the default fonts. This change gives precedence to the user font settings by moving them after the loading of the Beamer theme.
0f4da6f
to
71a387f
Compare
That would work well, but it's kind of incompatible with the other change (moving the However I think it actually makes perfect sense to move the
or if
I find this finally starts to make sense... What do you think? |
This looks good, thanks for iterating! |
Thanks for the comments! |
Beamer themes such as metropolis and saintpetersburg change the default fonts. This PR gives precedence to the user font settings by moving them after the loading of the Beamer theme.
This fixes #6260