pdfpages Latex package not found - r

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.

Related

RStudio error in windows: Running pdflatex.exe on file_name.tex.. (exit code -1073740791)

I am using Rstudio in windows 10. I am triying to create a pdf from a .tex file. However, when I compile the PDF, the following error appears:
Running pdflatex.exe on file_name.tex...failed Error running C:/Users/user_name/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)
I am using a native installation of R, Rstudio and MikTeX. Not an envioronment with anaconda or similar.
If you are using RStudio, have you tried tinytex instead of MikTeX? In the Tools Menu>Global Options>Sweave, tick "use tinytex for compiling .tex files". Then install tinytex package. After installing tinytex package, write in console "tinytex::install_tinytex()". This will install the latex compiler tinytex. Try compiling your tex file using it.
I think that issue has to do with missing packages. In fact, MiKTeX doesnt preinstall most of them. I recommend to compile with TinyTeX, because it shows where the compilation stops (as I said, due to a missing package typically required in some sty file). This way you can track which are the missing packages and install them on the MiKTeX Console one by one.
I posted about this issue in an open discussion on Github. Drop the link here in case you need more details.

amsthm LaTex package not found in R (3.2.6)

I'm trying to compile a .Rnw file to PDF in RStudio using the amsthm package but keep getting the error "LaTex Error: File 'amsthm.sty' not found. Is amsthm not available on the latest version of R?
I'm trying Miktex for Windows and I've had the same problem: file 'amsthm.sty' not found. You can add it from the console, but it's not listed with that name. It's included in the amscls package.
Packages can be searched here: https://www.ctan.org/

rmarkdown::render() in cmd returns pandoc error

I need to render forms with rmarkdown from a command line
this is where I am:
knit button in RStudio works fine
function rmarkdown::render(file.rmd) in a .r file works when run in Rstudio
Then I tried running this command in CMD
c:\Program Files\R\R-4.0.2\bin\Rscript.exe" -e "rmarkdown::render('C:/file.rmd')
and I get this error:
Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
In RStudio I sent
> rmarkdown::pandoc_available()
[1] TRUE
> rmarkdown::pandoc_version()
[1] ‘2.7.3’
What am I missing here?
By the way, I'm on Win10.
Thanks.
There might be an issue wit h Pandoc version, obviously. But maybe some library requires that older pandoc version, and the issue comes from you using Rmarkdown from outside Rstudio.
This link has the answer
Go into Rstudio and type
Sys.getenv("RSTUDIO_PANDOC")
Now take the output from the command above and put it here
Sys.setenv(RSTUDIO_PANDOC="OUTPUT FROM ABOVE COMMAND")

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

When trying to knit in RStudio it writes a ligature in the tex file and cannot compile it

I'm working on a brand new install of Linux Mint (19.2), a brand new install of RStudio, and a brand new install of texlive.
When I try to knit an Rmarkdown file in RStudio I get the error
! Package inputenc Error: Unicode char fi (U+FB01)
(inputenc) not set up for use with LaTeX.
It seems to be producing a ligature for the characters "fi" and the LaTeX is not able to read this. However, I don't know how to make it stop producing this ligature. I tried looking for other solutions and it led me to installing the newest version of texlive-full and running the init-usertree. I tried then running install tlmgr inputenc and it returned an error. I looked up the error, the recommendation was to set texlive to an earlier version. Then I run it again and get
tlmgr install: package inputenc not present in repository.
Even if I chase this error down, it seems like I won't be solving my problem because this doesn't seem like it will fix the ligature issue. I saw one recommendation to change the LaTeX typeset so I switched it from pdflatex to xelatex but that caused no change.
The translation from Rmd to tex should not add an explicit fi ligature. Therefore, it is most likely that your Rmd file already contains the ligature, probably as a result of a previous copy & paste.

Resources