Can't compile minimal rmarkdown file to pdf from within bookdown environment.

I can knit the file below to pdf when in a rmarkdown-only environment. However, when I try to do the same thing within a bookdown project, the process fails by just reproducing the html file when using knit/knit to pdf and when using bookdown::render_book('03-Mass.rmd','pdf_book') I get

tlmgr search --file --global "/tikzlibrarytopaths.code.tex"
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\David Stevens\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat search --file --global "/tikzlibrarytopaths.code.tex"'
In addition: Warning message:
In system2("tlmgr", args, ...) :
  'CreateProcess' failed to run 'C:\Users\David Stevens\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat update --all --self'
Please delete _main.Rmd after you finish debugging the error.
title: "CEE/BEng 3670 Notes Outline"
author: "David Stevens"
date: "`r Sys.Date()`"
  pdf_document: default
  html_document: default
# Mass Transfer  

This may be a difference between Windows and Mac, but I didn't have the same problem. Did you first run


within your project directory?

If so, the tex engine tlmgr failed to find "/tikzlibrarytopaths.code.tex", which sounds like a PATH problem. I've been away from Windows for quite some time, so cum grano salis, etc. but either the location of the bat file or the tex file could be mis-specified.

pdf_document and pdf_book does not use the same latex template. It may be possible that your missing some latex package for the pdf book output and that you installation of TinyTex have issue.

You can try to see if the installation works. I tried

> tinytex::tlmgr_search("/tikzlibrarytopaths.code.tex")
tlmgr search --file --global "/tikzlibrarytopaths.code.tex" package repository (not verified: gpg unavailable)

It found one hit in pgf package.

You may try to update your tinytex distribution before retrying though...


Hope it helps

1 Like

Thanks. I tried tinytex::tlmgr_search("/tikzlibrarytopaths.code.tex") and got no response except a repeat of the command - nothing like what cderv got in the example, and the same for tinytex::tlmgr_update(). I'm using TeXlive (full installation) rather than tinytex for the pdf creation. That could be the issue but the pdf engines are the same for both, to my understanding. I could be wrong.

Not sure it is related, but an issue has just be opened relative to the same TexLive package .

and was closed because related to some Texlive issue.

I don't know if this can help :man_shrugging:

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