In org mode, previewing a particular latex fragment with C-c C-x C-l renders incorrectly when using ImageMagick instead of the default dvipng.

Rendering with dvipng works:


Rendering with ImageMagick doesn't work:


Elisp to use ImageMagick instead of dvipng:

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

Note: I need to use ImageMagick because the dvipng setting doesn't respect org-latex-pdf-process, as documented here.

Emacs 64bit linux

ImageMagick 6.7.7

  • 2
    I don't have an answer, but I have a direction to think. Look at the function org-create-formula-image-with-imagemagick and try to reproduce what it does step-by-step looking at the intermediate results. I have a gut feeling it's the "-density" dpi or the "-antialias" which garbles the image. – wvxvw Mar 4 '15 at 5:55
  • @wvxvw Good thinking, but messing with the flags didn't change much. (SE It won't let me upvote yet) – John Owen Mar 4 '15 at 7:16
  • From looking further into imagemagick documentation, it appears that there are many more options there. This can depend on many things, even on the order of the arguments. Could you update your question with what the LaTeX code you get for the PDF and the exact command line this function then generates for imagemagick? Just to make sure the problem reproduces (or not) elsewhere. – wvxvw Mar 4 '15 at 13:02
  • Setting org-latex-create-formula-image-program to 'imagemagick works fine for me. How does the manual testing using convert work for you as shown in the link you posted? I haven't ever needed to tweak the imagemagick flags; it worked right out of the box. Try out in an emacs -Q session while requiring only ox-latex. Also, I am on the latest org version available on MELPA. – Kaushal Modi Mar 4 '15 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.