Inclusion of preamble.tex

I have a problem with generating a PDF.

The yaml file contains:

    in_header: preamble.tex

The process works in that a complete PDF is produced in the _book directory, but it then runs again to generate a PDF in the top directory. This second process fails because TeX/LaTeX packages included via preamble.tex are not included.


"C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output CharacterizeLuminexFiles.tex --lua-filter "C:\PROGRA~1\R\library\bookdown\RMARKD~1\lua\CUSTOM~1.LUA" --lua-filter "C:\PROGRA~1\R\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --metadata-file "C:\Users\Gerard\AppData\Local\Temp\RtmpAjOday\filef4d042e53101" --embed-resources --standalone --table-of-contents --toc-depth 4 --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics --wrap preserve --variable tables=yes --standalone -Mhas-frontmatter=false 

Output created: _book/CharacterizeLuminexFiles.pdf

"C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output CharacterizeLuminexFiles.pdf --lua-filter "C:\PROGRA~1\R\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --citeproc 
Error producing PDF.
! LaTeX Error: Environment landscape undefined.

So, what is going on? What am I missing.

I don't know why you get two rendering. When does this happen ? When you run bookdown::render_book() ?
When you render all formats ?

What is the content of your _output.yml ? Of you index.Rmd yaml header ?

Good point.


generates the file in _book only, but the Rstudio Build button tries to build a second version in the parent directory. As can be seen from the log it actually uses a different command (far fewer arguments).

Must be an Rstudio peculiarity (it did not previously do this).

I will just use the command line.

_output.yaml content:

    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
  toc_depth: 4
  indent: true

Content of index.Rmd

title: "some title"
author: "some person"
date: "`r Sys.Date()`"
output: pdf_document
geometry: "left=2cm,right=2cm,top=2cm,bottom=2cm"
description: some description.
documentclass: book
link-citations: yes
bibliography: book.bib
site: bookdown::bookdown_site
biblio-style: apalike

These are fairly standard (I think).

Yes this is fairly standard. I am not sure to understand what could happen here. I don't recall RStudio is doing something specific :thinking:

If it is working with Command Line, I think this is then an RStudio issue that should be reported to their github repo. I don't know exactly what build book is doing.

One idea though

You got this in your index file, so you are asking to render the index.Rmd to pdf_document explicitely.

It is possible than building with RStudio renders all the formats ! including this one.

Is this on purpose ?

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.