Error using Beamer for Presentations in R Markdwon - r

I'm getting the below error when I try to knit any document into Beamer and I don't understand why. I have Miktex installed and updated.
! LaTeX Error: File `beamerbasemodes.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.19
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43

With latex, if a .sty file isn't found, its because it isn't installed or MikTex doesn't know that its been installed and the FNDB must be refreshed.
I would check MikTex to verify that beamer is installed, and set the setting to install packages on the fly..
This tex.stachexchange answer might also lead to a solution.
https://tex.stackexchange.com/questions/404218/is-there-a-problem-with-beamer-in-the-latest-miktex-update

Related

pandoc: 4compatibility.woff2: withBinaryFile: does not exist (No such file or directory) when knitting

I am trying to knit my Rmarkdown, however I get this error at the end:
pandoc: /home/xxx/R/x86_64-pc-linux-gnu-library/4.1/fontawesome/fontawesome/css/../webfonts/fa-v
4compatibility.woff2: withBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted
I work with ubuntu 22.04 and I tried to install the libc6-i386, updating pandocand installing fontawesome, however no success..
Could you help me with a solution?
Thanks

Rstudio pdflatex.exe did not succeed

I'm currently using Rstudio and R markdown to create a pdf. However, every time I attempt to knit these error messages show up:
! Sorry, but C:\Users\AP\AppData\Local\Programs\MiKTeX\miktex\bin\x64\pdflatex.exe did not succeed.
! The log file hopefully contains the information to get MiKTeX going again:
! C:\Users\AP\AppData\Local\MiKTeX\miktex\log\pdflatex.log
Error: LaTeX failed to compile new-report.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See c2089682-report.log for more info.
In addition: Warning message:
In has_crop_tools() :
Tool(s) not installed or not in PATH: ghostcript
-> As a result, figure cropping will be disabled.
Execution halted
I've attempted to uninstall/re-install MiKTex and restarting Rstudio but the problem persists. How can I solve this issue?
With a new installation of MiKTeX, many style files needed to knit an RMarkdown file to PDF are not installed. To allow MiKTeX to install them on the fly, open the MiKTeX console and go to the Settings tab.
There is an option that says You can choose whether missing packages are to be installed automatically (on-the-fly). Make sure that this is set to Always to allow the necessary style files to be installed.
For me I just went to MiKTeX console setting and choose ALWAYS missing packages to be installed automatically.

Error when trying to knit R markdown: ! Package inputenc Error: Unicode character 锛?(U+FF0C) (inputenc) not set up for use with LaTeX

The error clearly has something to do with Latex, and I have tried my best to google and solve it, but all I got is just more errors.
The initial error:
! Package inputenc Error: Unicode character 锛?(U+FF0C)
(inputenc) not set up for use with LaTeX.
Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. See https://bookdown.org/yihui/rmarkdown-cookbook/latex-unicode.html
错误: LaTeX failed to compile Jan-26-in-class-code.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Jan-26-in-class-code.log for more info.
此外: Warning message:
In grepl("==> Fatal error occurred", x[i], fixed = TRUE) :
输入的字符串1不适用于此语言环境
停止执行
So I tried xelatex. Then I got
! LaTeX Error: File `unicode-math.sty' not found.
! Emergency stop.
<read *>
! Unfortunately, the package unicode-math could not be installed.
! Please check the log file:
! C:\Users\86188\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.log
错误: LaTeX failed to compile Jan-26-in-class-code.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Jan-26-in-class-code.log for more info.
停止执行
I guess the problem is I don't have "unicode-math" installed on my computer, so I tried install.packages("unicode-math"), then I got
Warning in install.packages :
package ‘unicode-math’ is not available for this version of R
I sincerely appreciate any instructions or suggestions. Thanks!
unicode-math is a LaTeX package and not an R package so it needs to be installed using a LateX package manager; either tlmgr if using the TeX Live distribution or using MiKTeX Console with MiKTeX (usually the main TeX distribution on Windows).

pdfpages Latex package not found

I am trying to compile a pdfbook using R-markdown. After I knit I get the following error:
! LaTeX Error: File `pdfpages.sty' not found.
I loaded tiny text using library(tinytex) to help me install the package pdfpages but continue to have the same error. I resorted to running Rstudio in administrator mode and try the preceding step and running the following tinytex::parse_install(text="! LaTeX Error: File `pdfpages.sty' not found.") (as suggested in Yihui in bookdown). Both resulted in the same error.
Any other suggestion on what is wrong? The package is clearly installed, so I do not know what else can the error be.
Generally when you get an error like pdfpages.sty not found, you need to install the package. From the command line (assuming the Tex bin is in your path) use "tlmgr install pdfpages". Yihui Xie called it "TinyTex" because it was a minimal install compared to something like MacTeX or TexLive.

Cannot knit Rmd file since I changed the name of User directory

I am using R for windows on RStudio.
I recently changed the name of User directory for a reason, and it seems that the change is causing a problem in knitting Rmd file.
If I try to knit Rmd file, the following error massage appears:
Error: invalid
version specification 'find'
In addition: Warning message:
In system(paste(shQuote(path), "--version"), intern = TRUE) :
running command '"C:/PROGRA~3/CHOCOL~1/bin/pandoc.exe" --version' had status 65535
Execution halted
I entered '"C:/PROGRA~3/CHOCOL~1/bin/pandoc.exe" --version' in cmd, it says
Cannot find file at 'c:\users\MY OLD USER NAME\appdata\local\pandoc\pandoc.exe'
So, I guess that knitr or pandoc is trying to find the wrong path.
How can I fix the problem? How can I change the path?
Here is the list of what I have tried:
Uninstalled R and RStudio, and then installed them.
Then, I installed all the packages needed by install.packeges.
Thus, I am using the latest version of R, RStudio, and packages.
Searched 'pandoc' in registry editor, and tried to find the old path (but I couldn't)
It seems you installed Pandoc by yourself through Chocolatey, and the installation was broken after you changed the name of your User directory.
First, you do not have to install Pandoc separately if you are using RStudio, because RStudio has bundled Pandoc with it.
If you have to install Pandoc for some reason, you may need to reinstall it (perhaps you have to reinstall Chocolatey, too).
choco uninstall pandoc
choco install pandoc

Resources