14
output file: test.knit.md

! pdflatex: warning: running with administrator privileges

! Sorry, but C:\Users\jjw11\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe did not succeed.

! The log file hopefully contains the information to get MiKTeX going again:

!   C:\Users\jjw11\AppData\Local\MiKTeX\2.9\miktex\log\pdflatex.log

Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted

I got this error message while I was trying to generate pdf file using r markdown.

How can I solve this? I installed tinytex using install.packages("tinytex")

I also tried tinytex::reinstall_tinytex(). But I got this error message

tinytex::reinstall_tinytex()
Error in system2("tlmgr", args, ...) : '"tlmgr"' not found
In addition: Warning message:
In tlmgr(c("info", "--list", "--only-installed", "--data", field,  :
  TeX Live does not seem to be installed. See https://yihui.name/tinytex/.

I installed tinytex using "tinytex::install_tinytex()".

When I installed tinytex using "tinytex::install_tinytex()", I got warning which implies other Latex distribution was already installed.

I tried to generate pdf file after I installed tinytex using "tinytex::install_tinytex()".

But this time I got this error message.

output file: test.knit.md

"C:/PROGRA~1/Pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --template "C:\PROGRA~1\R\R-35~1.3\library\RMARKD~1\rmd\latex\DEFAUL~3.TEX" --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes" 
! Package inputenc Error: Unicode character ??(U+B144)
(inputenc)                not set up for use with LaTeX.

Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. For R Markdown users, see https://bookdown.org/yihui/rmarkdown/pdf-document.html
Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
In addition: Warning message:
In grepl("==> Fatal error occurred", x[i], fixed = TRUE) :
  input string 1 is invalid in this locale
Execution halted

Do I have to uninstall other Latex distributions?

Then, how can I uninstall other Latex distributions?

jjw
  • 481
  • 1
  • 4
  • 14
  • 2
    `install.packages("tinytex")` only installs the `tinytex` R package. To install the TeX distribution you have to call `tinytex::install_tinytex()`. That would be a replacement for the already installed MikTeX. BTW, what's the content of the mentioned log file? – Ralf Stubner Oct 18 '19 at 09:14
  • Thanks! as you said, I used "tinytex::install_tinyex()" and got different error message. I edited my post. The content of the mentioned log file is as follows. – jjw Oct 19 '19 at 04:55
  • 1
    2019-10-17 16:28:59,323+0900 INFO pdflatex - starting with command line: C:\Users\jjw11\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe -halt-on-error -interaction=batchmode test.tex 2019-10-17 16:28:59,328+0900 WARN pdflatex - running with administrator privileges 2019-10-17 16:28:59,376+0900 INFO pdflatex - allowing known shell commands 2019-10-17 16:28:59,386+0900 INFO pdflatex - enabling input (output) from (to) processes 2019-10-17 16:28:59,995+0900 FATAL pdflatex - GUI framework cannot be initialized. 2019-10-17 16:28:59,995+0900 FATAL pdflatex - Info: – jjw Oct 19 '19 at 04:56
  • 2019-10-17 16:28:59,995+0900 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp 2019-10-17 16:28:59,995+0900 FATAL pdflatex - Line: 77 2019-10-17 16:28:59,996+0900 INFO pdflatex - finishing with exit code 1 – jjw Oct 19 '19 at 04:57
  • You seem to be using CJK characters. With these it is easiest to use a different LaTeX as it says in the error message, c.f. https://bookdown.org/yihui/rmarkdown/pdf-document.html#advanced-customization-1. In addition you should set `mainfont` in the YAML header to a font name that contains the CJK characters. – Ralf Stubner Oct 19 '19 at 07:00
  • 1
    Thanks a lot!! Finally I solved my problem. I used YAML header like this. --- title: "Untitled" author: "jaewon" date: "2019년 10월 17일" output: pdf_document : latex_engine : xelatex mainfont : NanumGothic --- Thanks!!! – jjw Oct 19 '19 at 09:16
  • Cool. How about adding it as a self answer? – Ralf Stubner Oct 19 '19 at 09:36
  • Good idea!! I added self answer. – jjw Oct 19 '19 at 10:47

4 Answers4

13

I've solved my problem.

First, I had to install Tex distribution.

I could install Tex distribution by using tinytex::install_tinytex().

Second, I was using CJK(Chinese, Japanese, Korean) characters.

so I had to use different latex engine.

In addition, I had to set mainfont which contains my language(korea) in the YAML header.

I attach YAML header which solved my problem.

title: "Untitled"
author: "jjw"
date: "2019년 10월 17일"
output: 
    pdf_document :
      latex_engine : xelatex
mainfont : NanumGothic

Amit Kohli
  • 2,860
  • 2
  • 24
  • 44
jjw
  • 481
  • 1
  • 4
  • 14
1

I also had the same error but it was fixed after I used the following code
tinytex::install_tinytex() it was fixed.

But first I had Miktex installed which gave a total different error so I unstaulted it first then I run the code above and problem solved.

  • Thanks for the answer. Can you confirm that this is different than the accepted answer provided by jjw? They also say to use `tinytex::install_tinytext()` – Harrison Jones May 16 '22 at 13:21
0

I was getting the same error after installing MikTex. I then re-started RStudio and it worked for me.

cmoshe
  • 329
  • 4
  • 7
0

I had the same issue, but with your previous answers I just solved it with the line code:

tinytex::install_tinytex()
L Tyrone
  • 1,268
  • 3
  • 15
  • 24
Imourana
  • 1
  • 2