Error when Rendering Quarto Document to pdf (Won't install xelatex)

I have used the basic function of RMarkdown before but am now delving into the world of Quarto. When I put together a document I was able to render it as an html but when I tried to render as a pdf it gave me this error...

processing file: FLOURISH_mailer.qmd
                                                                                                           
output file: FLOURISH_mailer.knit.md

pandoc 
  to: latex
  output-file: FLOURISH_mailer.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
  title: FLOURISH Data Summary
  editor: visual
  
running xelatex - 1
command xelatex not found, attempting install
finding package for xelatex
> 1 package to install
> installing xelatex (1 of 1)
ERROR: tlmgr returned a non zero status code
The system cannot find the path specified.

When I run the quarto list tools command in the terminal it shows tinytex as being up to data and v2303.05 being installed. My R version is 4.3.0 and my Rstudio version is 2023.03.1 Build 446.

I have also run tinytex::install_tinytex() and uninstalled tinytex and reinstalled it with the addition of the --update-path command.

It seems like maybe R is confused in finding the file path to some of the tinytex material but I am unsure of how to remedy it. Many of the other forums online related to similar problems have seemed pretty inconclusive so hoping that maybe there is another solution out there!

You show us the output of the quarto processing.
What do you specify as input? Exactly the output statements?

Does it compile with

pdf-engine: pdflatex

? Because maybe you do not need specific xelatex functionality.

See also e.g. https://github.com/quarto-dev/quarto-cli/issues/909

Thanks for the reply @HanOostdijk .

To get the error above my header was...

 ---
title: "FLOURISH Data Summary"
format: pdf
editor: visual
---

when I replace format: pdf with pdf-engine: pdflatex it gives an output but in html instead of pdf?
Here is the output:

 processing file: FLOURISH_mailer.qmd
1/7                 
2/7 [Setup]         
3/7                 
4/7 [Soil M graph]  
5/7                 
6/7 [Soil Tempgraph]
7/7                 
output file: FLOURISH_mailer.knit.md

pandoc 
  to: html
  output-file: FLOURISH_mailer.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  pdf-engine: pdflatex
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: FLOURISH Data Summary
  editor: visual
  
Output created: FLOURISH_mailer.html

I also tried running tinytex::uninstall_tinytex() and then reinstalling the larger tinytex bundle with tinytex::install_tinytex(bundle = "TinyTeX-2") hoping that with more packages it would get rid of the problem but it still resulted in the original error when ran with format: pdf

I know there are workarounds but was just trying to figure out why the default rendering wasn't working.

In the https://quarto.org/docs/reference/formats/pdf.html I see a separate format and pdf-engine option.
So I would expect something like

---
title: "My Document"
format: 
  pdf: 
    pdf-engine: pdflatex
---

Is this what you did? If you did not specify the format pdf I can imagine (but I am not sure) that html would be the default.

I think we have related issue on this already

xelatex is not a package that should be installed. It should be part of the installation. It means something prevent Quarto to correctly find LaTeX

Can you share more about your setup in one of those issues ? This is maybe something linked to paths or specific to an environment

@cderv Thanks for the response! It does seem like a path or environment issue.

When I used the header recommended by @HanOostdijk above it resulted in the same error as trying to use the default engine but just replaced xelatex with pdflatex in the error message.

processing file: FLOURISH_mailer.qmd
1/7                 
2/7 [Setup]         
3/7                 
4/7 [Soil M graph]  
5/7                 
6/7 [Soil Tempgraph]
7/7                 
output file: FLOURISH_mailer.knit.md

pandoc 
  to: latex
  output-file: FLOURISH_mailer.tex
  standalone: true
  pdf-engine: pdflatex
  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
  title: FLOURISH Data Summary
  editor: visual
  
running pdflatex - 1
command pdflatex not found, attempting install
finding package for pdflatex
> 1 package to install
> installing pdflatex (1 of 1)
ERROR: tlmgr returned a non zero status code
The system cannot find the path specified.

What exactly would you like me to share about my setup that would be helpful in troubleshooting? My apologies, my knowledge of debugging is fairly basic.

It does not seem like TinyTeX is installed correctly.

You could try also installing using Quarto https://quarto.org/docs/output-formats/pdf-engine.html#installing-tex

Also can you confirm R Markdown is working for PDF ? Finding LaTeX ?

Sharing some information on your environment can help. Which OS are you ? Is Tlmgr found on Path ? Does LaTeX Works without Quarto on your environment ?

This topic was automatically closed 45 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.