Problem with Tinytex in R Markdown! Help!

Hello everybody,

I have spent many hours trying to solve this problem but I could not find one. I was trying to to knit into PDF using the tinytex package from Yihui. My issue is quite the same like mentioned in R Markdown unable to knit, but I have different errors. It was just a simple R Markdown code like this:

---
title: "Untitled"
date: "10 11 2020"
output: pdf_document
---

## R Markdown

```{r cars}
library(tinytex)
options( tinytex.verbose = TRUE)
summary(cars)

This is the Error:

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
Warnung: Error in : LaTeX failed to compile C:\Users\J5A02~1.VIN\AppData\Local\Temp\RtmpIdWGVJ\file20ac33c021c5.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
  [No stack trace available]

What I have tried so far:
1. Install tinytex package and install TinyTex distribution.

install.packages("tinytex")
tinytex::install_tinytex()

Result:

2. Checked if it was installed.

tinytex:::is_tinytex()
[1] TRUE

3. Tryed another option of installation.

devtools::install_github('yihui/tinytex')

Result: nothing changed.

4. Checked if it was installed again.

tinytex:::is_tinytex()
[1] TRUE

5. Tryed to uninstall and reinstall it some times.

tinytex::uninstall_tinytex()
remove.packages("tinytex")

6. Tryed to fix it since pdflatex.exe could not be found.

tinytex:::install_prebuilt()

Result: nothing changed.

7. Checking pdflatex.exe I got this:

file.info(tinytex:::win_app_dir('TinyTeX', 'bin', 'win32', 'pdflatex.exe'))
Results:

                                                                      size isdir mode               mtime
C:\\Users\\j.vincent\\AppData\\Roaming/TinyTeX/bin/win32/pdflatex.exe 1536 FALSE  777 2020-11-10 15:42:45
                                                                                    ctime               atime   exe
C:\\Users\\j.vincent\\AppData\\Roaming/TinyTeX/bin/win32/pdflatex.exe 2020-11-10 15:42:45 2020-11-10 15:42:45 win32

I have done almost everything mentioned in every resources that I found online from Yihui. I tried to applied the debugging process mentioned in Yihui debugging using the "options(tinytex.verbose = TRUE)" and gives this additional message in console:

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode

It's important to say that I restarted (close and open again) RStudio many times during this process, I tryed to substitute latex distribution TinyTex for MikTex (but didn't go well since the output was a different issue which didn't let me knit to PDF either) and I even tryed both installed together (TinyTex and MikTex). Then I uninstalled MikTek.

The only possible reason in my mind was because of the company's firewall that gives quite a lot of constraint with this tinytex packages. But I am not quite sure of that. Could someone help me please!

info: R Studio Version 1.3.1093 and R version 4.0.3, also tinytex version 0.27

1 Like

When you attempt to knit, what text gets output into the R Markdown console (the tab between Terminal and Jobs) ?

1 Like
processing file: ad.Rmd
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: cars
  |......................................................................| 100%
  ordinary text without R code


"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS params.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc2d4cd6d81.tex --lua-filter "C:\Users\j.vincent\Documents\R\R-4.0.3\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\j.vincent\Documents\R\R-4.0.3\library\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" 
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
Warnung: Error in : LaTeX failed to compile C:\Users\J5A02~1.VIN\AppData\Local\Temp\RtmpeiuulC\file2d432bc707d.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
  [No stack trace available]

I am actually trying to put it in R Shiny for generating a PDF report later. But for this one I use the example of basic R Markdown data printing a data summary data cars.

I find it curious that this shows both a path beginning C:\Users\j.vincent and another C:\Users\J5A02~1.VIN
Are these two distinct locations ?

No both are the same locations. I have checked it both. Should I put the R-4.0.3 folder in the same path C:\Users\J5A02~1.VIN\AppData\Local?

Thanks, might be worth trying

tinytex::reinstall_tinytex()

as according to the docs

reinstalls TinyTeX as well as previously installed LaTeX packages by default;

when I tried to reinstall_tinytex(), there is such thing comes out in the output. Should I worry about it actually?

The directory C:\Users\j.vincent\AppData\Roaming\TinyTeX/texmf-local is not empty. It will be backed up to C:\Users\J5A02~1.VIN\AppData\Local\Temp\RtmpeiuulC\file2d47f5e2e03 and restored later.

I honestly dont know

Okay. I will upload it here if I find any solutions. Thanks anyway!

This topic was automatically closed 21 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.