2 min read

Fight with TinyTex and Rmarkdown can't knit to PDF on my PC

A little bit History

I started to learn R markdown since 2018.

R Markdown

Figure 1: R Markdown

After attending RStudio conference 2019 @Austin, I decided write my tech report for project in R markdown.

RStudio Conf 2019

Figure 2: RStudio Conf 2019

Although it’s a tough process, I finally nailed it and wrote at least 2 tech report in Rmarkdown then produced the final tech report in PDF for client.

Year 2020 Story

Then, we are getting into year 2020. Clients asked us to update tech report for this year. I was so confident at the beginning, thinking what I need to do are changing the parameters and hitting the knit button.

Then, the reality hit me.

I was unable to knit any rmarkdown file to PDF document and a lengthy error message showed up. Here is the error message.

Cannot knit PDF error

Figure 3: Cannot knit PDF error

OK, fine! Let’s debugging.

I first went to search the stackoverflow and found that after version 1.8, Rmarkdown automatically connects to package-TinyTex.

Then I went to TinyTex webpage and it seems like there are some answers to my problem.

TinyTex

Figure 4: TinyTex

I started to try different solutions and even created an R code (Feel free to download) for the TinyTex debugging.

After more than 2 days trials, I thought it might be a good idea to post my issue to the online community so that the expert (probably Yihui himself) could help me out.

My question post

After 12 hours, I even received Yihui’s reply–> Oh Yeah!

Yihui reply

Figure 5: Yihui reply

However, nothing really worked out:(

my Rstudio constantly received this error message.

What a creepy error

Figure 6: What a creepy error

Alright then! I came and I tried. Now it’s time to move on and reinstall the entire WINDOWS system, I guess.

The possible root cause might be I have installed multiple versions of Latex distribution in the past.

But anyway, it’s a good debugging experience and at least, I let my patience play out entire process.