18

I am checking my package and this is actually the last remaining problem. The pdf file cannot be compiled and the logfile tells me

2015-10-15 14:17:47,430+0200 INFO  pdflatex - running 'initexmf --quiet --update-fndb' to refresh the file name database
2015-10-15 14:17:50,276+0200 FATAL pdflatex - GUI framework cannot be initialized.
2015-10-15 14:17:50,276+0200 FATAL pdflatex - Info: 
2015-10-15 14:17:50,276+0200 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2015-10-15 14:17:50,276+0200 FATAL pdflatex - Line: 50

Any idea where the problem could be?

topchef
  • 19,091
  • 9
  • 63
  • 102
Christine Blume
  • 507
  • 3
  • 7
  • 17
  • 1
    Related/cross-network duplicate: [How can I fix the error “GUI framework cannot be initialized” with TeXnicCenter and MiKTeX?](http://tex.stackexchange.com/q/27138/5764) – Werner Oct 27 '15 at 01:00
  • Werner seems to be right. I faced exactly the same problem as Christine Blume, and I solved it via Werner's method in Windows 8.1 and Revolution R Enterprise environment: "Start - bottom arrow - MikTex Settings - MiKTeX Options" and chose "Yes" (not "Ask me first") for the option "Install missing packages on-the-fly". I advice doing these for both "MikTex Settings" and "MikTex Settings(Admin)". – Erdogan CEVHER Apr 26 '16 at 21:41

4 Answers4

14

I had this same issue, but for the newest versions of Miktex, mo.exe does not exist, and is replaced by the Miktex console. If you open it, go into settings and change the package on-the-fly setting from "Ask Me" to "Always", then the packages will install. If you do "Never" instead, then you'll have to do the individual package installation described by @topchef.

October 2021 Screenshot of the MiKTeX Console Settings tab with "Always" selected

Cara Wogsland
  • 191
  • 1
  • 6
user11837196
  • 141
  • 1
  • 2
11

This is known problem wit MikTex 2.9 when pdflatex encounters error

GUI framework cannot be initialized.

(found on my Windows 7 system in the file ~\AppData\Local\MiKTeX\2.9\miktex\log)

So far, I can offer following sequence of actions to remedy this:

  1. In Windows Command prompt go to MiKTeX bin folder (e.g. C:\Program Files (x86)\MiKTeX 2.9\miktex\bin) and run utility mo.exe;

  2. In General tab change 'Install missing packages on-the-fly:' option to No (this will disable GUI and error above won't be happening again);

  3. Run R CMD that calls latex converter again (in my case

    R CMD Rd2pdf man/
    

again to see new errors;

  1. This time miktex won't complaint about GUI - instead it will be missing packages with error like this

    ! LaTeX Error: File `inconsolata.sty' not found.
    
  2. Start MiKTeX package manager (again from mo.exe Packages tab) and install missing package one at the time by repeating steps 3.-5.

This might be not most effective way of fixing this so I appreciate corrections or alternative solutions.

topchef
  • 19,091
  • 9
  • 63
  • 102
  • 2
    For me the issue was that it was set to ask for packages to be installed. By selecting automatic, all errors disappeared and I managed to knit a pdf as expected. – Paul Jul 20 '21 at 19:30
3

I ran into this problem just... A very easy solution for me that allowed me not to renege on the install on the fly option is to install TexStudio, open your .tex file in there, and compile it: you will be able to install all your MikTex packages on the fly as desired and retain control over what gets installed.

tchevrier
  • 1,041
  • 7
  • 16
  • 1
    +1. Thanks that has solved my problem. It seems that RStudio is not able to prompt for package installation when needed. – pietrodito Mar 31 '21 at 07:33
0

I had the same problem compiling Knit to PDF of a R markdown file in R studio. Once I changed from "Ask me" to "Always" in the MikTex console setting (see the screenshot posted above [Cara Wogsland]) it compiled without errors.

OneDay
  • 1