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

xelatex in beamer yaml #4

Closed
ian-adams opened this issue Sep 1, 2021 · 4 comments
Closed

xelatex in beamer yaml #4

ian-adams opened this issue Sep 1, 2021 · 4 comments

Comments

@ian-adams
Copy link

ian-adams commented Sep 1, 2021

For whatever reason, replacing the latex_engine: pdflatex with the xelatex option recommended in the template makes it so I can't knit the presentation.

However, if I change the yaml to the following structure (moving latex_engine out from under the output), it knits fine and with the appropriate font changes (I've commented out the original latex_engine call):


output:
stevetemplates::beamer:
keep_tex: TRUE
#latex_engine: pdflatex # use xelatex here instead! I recommend it, but this is minimal reprex
dev: cairo_pdf # I typically comment this out if latex_engine: pdflatex
slide_level: 3 # I prefer this, but I won't force it on you.
fig_width: 7
fig_height: 6
#toc: false
latex_engine: xelatex
title: The Effect of Body-Worn Camera Activation and Review Policies on Perceived Fairness
subtitle: Technology, Policy, and Organizational Justice
author: Ian T. Adams
date: "r paste0('JOB TALK LOCATION, ',format(Sys.time(), '%B %d, %Y'))"
institute: University of Utah
#titlegraphic: "img/public-affairs.png"
#scaletg: .5 # Optional, proportional (0, 1) to paper width. Defaults to .3
fontsize: 10pt
make149: TRUE
mainfont: "Open Sans" # Try out some font options if xelatex
titlefont: "Titillium Web" # Try out some font options if xelatex
#specify color as six-digit RGB (no pound sign)
primarycolor: "CC0000"
secondarycolor: "808080"

Not sure if this is a "me" problem, or if there's something else going on, but thought I'd drop a note on it.

@svmiller
Copy link
Owner

svmiller commented Sep 1, 2021

What error are you getting? Is it a LaTeX error or a Pandoc error or an R error?

@ian-adams
Copy link
Author

Using the minimal example, and changing only the latex_engine...Upon knitting, it throws the following latex error:

! Package fontspec Error: The font "serif" cannot be found.

! name = serif, rootname = serif, pointsize = 
! mktexmf: empty or non-existent rootfile!

! mktexmf: empty or non-existent rootfile!

! kpathsea: Running mktexmf serif.mf

! The command name is C:\Users\adams\AppData\Roaming\TinyTeX\bin\win32\mktexmf
! Cannot find serif.mf.

! Cannot find serif.mf.

! kpathsea: Running mktextfm serif

! The command name is C:\Users\adams\AppData\Roaming\TinyTeX\bin\win32\mktextfm

! kpathsea: Appending font creation commands to missfont.log.

Error: LaTeX failed to compile millerbeamertest.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See millerbeamertest.log for more info.
In addition: Warning message:
package 'tibble' was built under R version 4.1.1 
Execution halted

@svmiller
Copy link
Owner

svmiller commented Sep 1, 2021

I encountered this in the morning when I saw your issue and ran the reprex myself. I think those errors are LaTeX's way of saying, given what's fed to it (e.g. my template), if you're using xelatex, you must supply something to mainfont: and titlefont: that it recognizes. This much will depend on what fonts you have installed, but even putting something super vanilla in those two fields (e.g. "Times New Roman") should be enough to compile.

@ian-adams
Copy link
Author

Yup, that was it, thank you. Apparently "trillium web" wasn't installed, but reprex works smooth now. Thanks again for the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants