I'm working on a largish Bookdown project with 10 .rmd input files, a lot of figures and tables and about 200 pages (so far) as a pdf. A few days ago I successfully compiled my project to pdf using the tufte::tufte2 book set up. After lunch I tried to compile it again and got a number of errors related to bad bioliography references and missing dollar signs. Each file individually compiles successfully with simple Rmarkdown to pdf. Also if I remove two .rmd files from the folder, bookdown compiles successfully but when I add them back, failure. The specific error that stops compilation
! Missing inserted.
<inserted text>
l.419 \textbf{Scalars} & A scal & ar \in
& dex{da & ta obj & ects!scalar} ...
Try to find the following text in _main.Rmd:
\textbf{Scalars} & A scal & ar \in
RMarkdown code:
Scalars A scalar \index{data objects!scalar}
Compilation errors:
After conversion to the _main.tex file
\textbf{Scalars} & A scal & ar \in & dex{da & ta obj & ects!scalar}
I think this is a red herring issue because without those 2 files, the book compiles and produces a pdf.
In addition, another issue has popped when creating figures from rmarkdown chunks. All the figures generated in the rmarkdown code have the axis scales and titles cut off and just the plot portion of the figure filling the page margins. This happens only when producing a tufte_handout or book .pdf. In html, the figures are as they should be. This is happening in both bookdown and plain RMarkdown, and has never happened before in the 10+ years I've been using these tools. Even the prototype .rmd file when a new rMarkdown document is created has this problem with the figure margins and scales.
I've reinstalled both RStudio and R (4.1.3) and run update.packages() to refresh the R libraries. None of this helped.
Something is seriously wrong here and I don't know what to do next. Any thoughts are appreciated.