Knit to PDF not working

So far I haven´t had any problems kniting to pdf. However, now I´m getting this message.

A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TinyTeX with tinytex::reinstall_tinytex(). If it fails to upgrade, you might be using a default random CTAN mirror that has not been fully synced to the main CTAN repository, and you need to wait for a few more days or use a CTAN mirror that is known to be up-to-date (see the "repository" argument on the help page ?tinytex::install_tinytex()).
! LaTeX Error: Not in outer par mode.

The thing is, I have MikTex installed, which I suppose is what Rmarkdown has been using so far, and I don´t want to install another software.

Anyhow, I decided to give TinyTex a try, as after updating everything, I kept getting the same error. So I did:


But I got this message:

Error in system2("tlmgr", args, ...) : '"tlmgr"' not found

Any idea on how to fix this? Preferably if it´s using MikTex.

Hi @RoyBatty,
Have you tried updating your MikTeX installation?

It seems that TinyTex is now preferred over MikTeX:
Maybe you should uninstall MikTeX before installing TinyTeX.

I think you'll need install_tinytex() not reinstall_tinytex().


I have had this problem in the past as well. I can't remember the solution though.

I did find this similar thread though: Can't install tinytex via install_tinytex() - #8 by cderv

@RoyBatty the first message you get is from TeXLIve. This means that MikTeX did not seem to be the one used.

Uninstall TinyTeX completely using R package. Then check in terminal that pdftex is from MikTeX. R markdown should be able to find it.

You will look the auto installation of missing packages by using MikTeX instead of TeX Live but both should let you compile PDF.

Thanks @cderv for the answer.

I decided to uninstall MikTex and use it only for TexStudio in other machine. But after installing tinytex with tinytex::install_tinytex() I get:

! LaTeX Error: Not in outer par mode.

Error: LaTeX failed to compile CCA_multimodal.tex. See for debugging tips. See CCA_multimodal.log for more info.

Can this be related with the code, like something inside kableExtra package?

This is an error from your document. Something inside your R Markdown document is creating a wrong tex syntax causing this error. This is another issue.

You need to provide an example or at least part of the content you are rendering. I would suggest opening a new issue for this.

In order to check TinyTeX is working for you try building the template Rmd file to PDF.

Thanks @cderv .

tinytex is working, and I solved the other issue, it was related with kableExtra package.
I close the post

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