Skip to content

Beamer fonttheme always set to serif if mainfont specified #6607

@thatchermo

Description

@thatchermo

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions