R-markdown error when knitting to pdf

I'm relatively new to programming and taking courses on R, using Positron on R-4.4.1 & Quarto, tinytex is installed (when checking with sys.which('pdflatex'), there's a directory output)

When trying to knit an .rmd file to pdf (latex), I'm encountering the bellow error in the Terminal output:

processing file: HW_temp.rmd
1/7
2/7 [unnamed-chunk-1]
3/7
4/7 [unnamed-chunk-2]
5/7
6/7 [unnamed-chunk-3]
7/7
output file: HW_temp.knit.md

output-file: HW_temp.tex
standalone: true
pdf-engine: xelatex
variables:
graphics: true
tables: true
default-image-extension: pdf

metadata
documentclass: scrartcl
classoption:
- DIV=11
- numbers=noendperiod
papersize: letter
header-includes:
- '\KOMAoption{captions}{tableheading}'
block-headings: true

Rendering PDF
running xelatex - 1
command xelatex not found, attempting install
finding package for xelatex

1 package to install
installing xelatex (1 of 1)
ERROR: [non-error-thrown] tlmgr returned a non zero status code
The system cannot find the path specified.

Stack trace:
The system cannot find the path specified.

at Command.handleError (file:///C:/Users/anhcl/AppData/Local/Programs/Quarto/bin/quarto.js:8184:126)
at Command.parseCommand (file:///C:/Users/anhcl/AppData/Local/Programs/Quarto/bin/quarto.js:7909:18)
at eventLoopTick (ext:core/01_core.js:153:7)
at async quarto (file:///C:/Users/anhcl/AppData/Local/Programs/Quarto/bin/quarto.js:118224:9)
at async file:///C:/Users/anhcl/AppData/Local/Programs/Quarto/bin/quarto.js:118244:9
at async mainRunner (file:///C:/Users/anhcl/AppData/Local/Programs/Quarto/bin/quarto.js:118128:9)

The output contains the following: pdf-engine: xelatex. This is overriding the default choice of pdflatex as the LaTeX engine. By any chance does your document contain a header specifying xelatex? If so, changing it to pdflatex (or just omitting the line and defaulting to pdflatex) should fix the problem.

Thanks for the response!

There is no header in this document (see screenshot)

Other than this, what would prompt xelatex to override the default choice?

I tried to look in settings, under render options, but didn't recognize anything that explicitly reference latex options (I wouldn't trust my discerning of what I see though, because I dont know what I dont know)

At the top of an Rmd document that I render to pdf, I have a header like this:

---
output:
  pdf_document:
    latex_engine: pdflatex
  fig_caption: yes
geometry:
  - top=1.8cm
  - left=2cm
  - bottom=1.5cm
  - right=2cm
  - paper=a4paper
header-includes:
  - \usepackage{lscape}
---

I suggest you try doing that using only the first three lines (output:, pdf_document:, latex_engine: pdflatex) and also include the three dashes before and after that. Be sure to do the indentation correctly.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.