5

I have an org file, where I put a LaTeX fragment to be rendered in line with C-c C-x C-l. It is a simple formula:

\[
 e^{i\pi} = -1
\]

I have MiKTeX installed, latex and dvi commands work from command line in Windows without a problem. I also have AUCTeX and preview of the same file (embedded in \begin{document} and stuff) works fine.

I get the following message in the messages buffer:

Failed to create dvi file from c:/Users/Michele/AppData/Local/Temp/orgtex6380KuB.tex
Creating images for entry...done.  Use `C-c C-c' to remove images.
Cannot find image file `c:/Users/Michele/Documents/ltxpnghome_5e3cd2413a24591c2b9e10c34d704b6effc5776a.png'

What to do next?

UPDATE

I have tried to change org-latex-create-formula-image-program to imagemagick instead of dvipng but got no luck. However, during my trials I opened the tex editor of MiKTeX to do some other, basically unrelated, testing. While editor and package manager were open, I went to emacs and reverted back to dvipng and tried again C-c C-x C-l. At this point, I got a series of request to install missing packages!! Guess what? When the requests ended (it was quite a few), everything was working fine and previews are now correctly displayed!

I have tried to trace back the last packages installed, they should be:

ulem, marvosym, wasysym, vasy

Hope this can help in a similar case.

Mike Anblips
  • 658
  • 6
  • 19
  • Try to compile `c:/Users/Michele/AppData/Local/Temp/orgtex6380KuB.tex` manually. When you get this error it's typically because some LaTeX package is missing. – rasmus Jan 05 '16 at 22:52
  • Please move your UPDATE text to an answer and accept that answer as soon as possible. (It is good practice to answer your own question if you found a solution to your problem.) Otherwise the community bot bumps that question again and again to the homepage. – Tobias Jun 24 '18 at 15:00

1 Answers1

1

I think that you should add one of the following lines to your .emacs file (or init.el) :

(setq org-latex-create-formula-image-program 'imagemagick)

or

(setq org-latex-create-formula-image-program 'dvipng)

More details and further configuration hints available here.

Lgen
  • 1,380
  • 10
  • 19
  • thanks, I am aware of that page and scanned it a few times to no avail...I have to try the `imagemagick` approach, as so far I had the variable set to `dvipng`. Note that I can see `png` in line, and other `latex` command work fine from the shell (windows). – Mike Anblips Dec 06 '15 at 15:14
  • Under Ubuntu it is working like a charm with any of the two options but leading to a blank square if none of them is activated. Let's hope that imagemagick will work for you. – Lgen Dec 06 '15 at 15:23