Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Beamer fonttheme always set to serif if mainfont specified #6607

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

Closed
thatchermo opened this issue Aug 23, 2023 · 3 comments Β· Fixed by #12680
Closed

Beamer fonttheme always set to serif if mainfont specified #6607

thatchermo opened this issue Aug 23, 2023 · 3 comments Β· Fixed by #12680
Assignees
Labels
beamer enhancement New feature or request pandoc upstream Bug is in upstream library
Milestone

Comments

@thatchermo
Copy link

Bug description

Beamer has multiple fonttheme options for specifying serif and sanserif to be used in slide headings and body. For example:

\usefonttheme[stillsansseriflarge]{serif}

will set headings to sans and body to serif.

I assume that to use such a feature, I'd have to specify both a main font for serif and a sans font for sans serif. However, I've seen that if mainfont is set, the beamer template automatically adds \usefonttheme{serif}. I don't see a spot in the format where it would process any optional argument for usefonttheme, so if I want to get sans headings and serif body, I'd have to give the whole command \usefonttheme[stillsansseriflarge]{serif} as part of header-includes:, but this causes an error because the options conflict with the built-in \usefonttheme{serif} that gets added by the format.

If I comment out the line in the /formats/pdf/pandoc/template.tex file like this:

$if(mainfont)$
%\usefonttheme{serif} % use mainfont rather than sansfont for slide text
$endif$

then I get the behavior I expect: beamer uses the mainfont for serif, the sansfont for sans serif, and it defaults to sans serif unless I set a font theme.

To me, this is a preferable result, compared with assuming that if a user sets mainfont, then user must want to only use serif font in both headings and body of the slides. I hope that makes sense. Here's a minimal (non)working example that generates an error, but works if I comment out the offending line in the template.tex file.

Or, a feature request would be a way to set the stillsansseriflarge as an option to the fonttheme within the YAML.

Thanks for all your work on Quarto--it's great!

Steps to reproduce

---
mainfont: Caladea # Note: Set these to any fonts you have on your system.
sansfont: Carlito
monofont: Ubuntu Mono
format:
  beamer:
    header-includes: |
       \usefonttheme[stillsansseriflarge]{serif}
    keep-tex: true
---

## Header Should be in Sans

Body should be in serif.

Expected behavior

Be able to use Beamer's fonttheme optional arguments.

Actual behavior

No good way to use optional fonttheme arguments.

Your environment

  • Ubuntu 22.04
  • R 4.3.1
  • Quarto 1.3.294
  • Not using RStudio

Quarto check output

[βœ“] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[βœ“] Checking versions of quarto dependencies......OK
[βœ“] Checking Quarto installation......OK
      Version: 1.3.294
      Path: /opt/quarto/bin

[βœ“] Checking basic markdown render....OK

[βœ“] Checking Python 3 installation....OK
      Version: 3.10.12
      Path: /usr/bin/python3
      Jupyter: 4.9.1
      Kernels: python3

(/) Checking Jupyter engine render....[IPKernelApp] WARNING | debugpy_stream undefined, debugging will not be enabled
[βœ“] Checking Jupyter engine render....OK

[βœ“] Checking R installation...........OK
      Version: 4.3.1
      Path: /usr/lib/R
      LibPaths:
        - /home/thatcher/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.42
      rmarkdown: 2.21

[βœ“] Checking Knitr engine render......OK
@thatchermo thatchermo added the bug Something isn't working label Aug 23, 2023
@cscheid cscheid added enhancement New feature or request beamer needs-discussion Issues that require a team-wide discussion before proceeding further and removed bug Something isn't working labels Aug 23, 2023
@cscheid
Copy link
Collaborator

cscheid commented Aug 23, 2023

If I comment out the line in the /formats/pdf/pandoc/template.tex file like this:

That looks to me, then, like the issue comes from the underlying pandoc template. We do a certain number of improvements on some templates, but we have to be careful about it. Let me take this with the other devs and I'll get back to you.

@cderv
Copy link
Collaborator

cderv commented Aug 30, 2023

Or, a feature request would be a way to set the stillsansseriflarge as an option to the fonttheme within the YAML.

About this, it would possibly be a good feature request for upstream Pandoc itself

@cderv cderv self-assigned this Sep 14, 2023
@cderv cderv removed the needs-discussion Issues that require a team-wide discussion before proceeding further label Sep 14, 2023
@cscheid cscheid added upstream Bug is in upstream library pandoc labels Sep 14, 2023
@cscheid cscheid added this to the v1.5 milestone Nov 30, 2023
@cscheid cscheid modified the milestones: v1.5, Future Feb 26, 2024
@cwickham
Copy link
Collaborator

cwickham commented May 2, 2025

@cderv It seems like this is no longer an upstream issue. Pandoc supports the option fontthemeoptions:

$if(fonttheme)$
\usefonttheme[$for(fontthemeoptions)$$fontthemeoptions$$sep$,$endfor$]{$fonttheme$}
$endif$

But we do not:

$if(fonttheme)$
\usefonttheme{$fonttheme$}
$endif$

Should we now support fontthemeoption (and colorthemeoptions, innerthemeoptions, and outerthemeoptions)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beamer enhancement New feature or request pandoc upstream Bug is in upstream library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants