The following line in my org file is causing problems

#+LaTeX_HEADER: \usepackage{prooftrees}

If this line is there, then org latex preview produces an empty box. If I remove it, things work just fine.

The output of *Org Preview LaTeX Output* is:

This is dvipng 1.17 Copyright 2002-2015, 2019 Jan-Ake Larsson

so I can't tell what's going wrong. Finally, the *Messages* buffer only says: "Creating image...done", which doesn't help me understand why it's failing.

I know that the prooftrees package works, because I can get it to work in my normal latex compilation, so this seems to be a problems specifically with emacs org-mode.

How can I troubleshoot this issue? How can I see what latex it's generating and what commands it's running to produce the image?


Edit: The issue was with dvipng: this program would output a messed up png after processing the output dvi file. I tried changing to imagemagick but got a mysterious error. Changing to dvisvgm fixed the issue, so I guess this program is somehow better at processing dvi files that contain prooftrees.

To change to dvisvgm I did

  • M-x customize-variable ENTER org-preview-latex-default-process
  • then changed the value to "dvisvgm"

To catch the temporary tex files before emacs deleted them I used the following shell command in the /tmp directory:

inotifywait -mr --format '%w%f' -e create . | while read file; do if echo "$file" | grep '^./orgtex.*\.tex$' > /dev/null; then echo "file: $file"; cp $file ${file}.bkp; fi; done

1 Answer 1


The preview code writes a TeX file into the /tmp directory with a name like orgtexXXXXXX.tex - there should also be a log file with name orgtexXXXXXX.log. Check the log file for errors and peruse the tex file to see if there are any obvious problems. Depending on your setting of org-preview-latex-default-process, the tex file may go through a different set of commands to get the final image. The default value is dvipng I believe, although imagemagick and dvisvgm are also possible. Check org-preview-latex-process-alist to see which path is actually taken.

For dvipng, the (simplified) commands are

latex orgtexXXXXXX.tex
dvipng orgtexXXXXXX.dvi

For imagemagick they are:

pdflatex orgtexXXXXXX.tex
convert orgtexXXXXXX.pdf orgtexXXXXXX.png

I've omitted all options on the "simplified" commands. The alist contains all the options, but you probably don't need them to debug your problem.

  • I would be interested to find out exactly what the problem was: can you add a comment (or edit your question) ad describe the resolution? Thanks!
    – NickD
    Oct 7, 2020 at 0:28
  • 1
    Just added an edit. Thanks for the help, and let me know if you want any more details.
    – ttbo
    Oct 7, 2020 at 0:36
  • Thank you for the edit.
    – NickD
    Oct 7, 2020 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.