Installed latest. Can't build existing project. xelatex needed

New laptop. Installed latest R from fresh download. Installed latest RStudio from fresh download.
Installed the packages for tutorials, as well.

Opened existing project. Tried to build book. It fails because xelatex is not found. Tried to install xelatex, and get this:
Warning in install.packages :
package ‘xelatex’ is not available for this version of R

R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

RStudio 2022.12.0+353 "Elsbeth Geranium" Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36

No idea what to do now. Is xelatex no longer supported? Do I need to use a different package?

Cut and paste the YAML block from the document? And do you have LaTeX markup embeded?

OR

Don't think xelatex is an RPackage; instead

install.packages("tinytex")

bookdown::gitbook:
css: style.css
config:
toc:
before: |

  • A Minimal Book Example

  • after: |
  • Published with bookdown

  • edit: https://github.com/USERNAME/REPO/edit/BRANCH/%s
    download: ["pdf", "epub"]
    bookdown::pdf_book:
    includes:
    in_header: preamble.tex
    latex_engine: xelatex
    citation_package: natbib
    keep_tex: yes
    sansfont: Consolas
    bookdown::epub_book: default

    As to LaTeX markup embedded, not sure where to check.

    OK, the preamble.tex counts, but I no longer think that's the problem—it's a missing LaTeX setup. Try

    install.packages("tinytex")
    

    install.packages("tinytex")
    Installing package into ‘C:/Users/w_mey/AppData/Local/R/win-library/4.2’
    (as ‘lib’ is unspecified)
    trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/tinytex_0.43.zip'
    Content type 'application/zip' length 135823 bytes (132 KB)
    downloaded 132 KB

    package ‘tinytex’ successfully unpacked and MD5 sums checked

    The downloaded binary packages are in
    C:\Users\w_mey\AppData\Local\Temp\Rtmpmyu2Lh\downloaded_packages

    But on build, I get this:
    Error: LaTeX failed to compile _main.tex. See The R package tinytex - Helper Functions to Manage TinyTeX, and Compile LaTeX Documents - Yihui Xie | 谢益辉 for debugging tips.
    In addition: Warning message:
    In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
    '"xelatex"' not found
    Execution halted
    Error: bookdown::render_book() failed to render the output format 'bookdown::pdf_book'.
    Execution halted

    And on trying to follow the advice:

    update.packages(ask = FALSE, checkBuilt = TRUE)
    Warning in install.packages(update[instlib == l, "Package"], l, repos = repos, :
    'lib = "C:/Program Files/R/R-4.2.2/library"' is not writable

    That’s a file system permissions issue, but I don’t remember how to change it in Windows and it’s probably changed since XP anyway.

    After installing the tinytex R package, you need to install the TinyTex LaTeX distribution.

    tinytex::install_tinytex()
    

    This should take care of missing xelatexerror.

    About this error message, you need to run RStudio as "Administrator" to be able to update packages in the system level package library.

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