1

I'm following instructions on this page: https://orgmode.org/worg/org-tutorials/org-latex-preview.html. I have managed to install dvipng and successfully replicated the given example page as a .png file. Then, when I try to run org-latex-preview by C-c C-x C-l in Emacs, I get the following message:

Creating LaTeX previews in section... done.

However there no rendering happening anywhere. I'm running Emacs 26.3. on Ubuntu 20.04 LTS.

The value of org-preview-latex-default-process is dvipng and the value of org-preview-latex-process-alist is as follows:

Value:
((dvipng :programs
          ("latex" "dvipng")
          :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
          (1.0 . 1.0)
          :latex-compiler
          ("latex -interaction nonstopmode -output-directory %o %f")
          :image-converter
          ("dvipng -D %D -T tight -o %O %f"))
 (dvisvgm :programs
           ("latex" "dvisvgm")
           :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
           (1.7 . 1.5)
           :latex-compiler
           ("latex -interaction nonstopmode -output-directory %o %f")
           :image-converter
           ("dvisvgm %f -n -b min -c %S -o %O"))
 (imagemagick :programs
               ("latex" "convert")
               :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
               (1.0 . 1.0)
               :latex-compiler
               ("pdflatex -interaction nonstopmode -output-directory %o %f")
               :image-converter
               ("convert -density %D -trim -antialias %f -quality 100 %O")))

The document I'm trying to render is the example given in the above link:

#+BEGIN_SRC latex :tangle latex/example.tex
\documentclass{article}

\begin{document}

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

\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

\end{document}

#+END_SRC

If I press C-u C-u C-c C-x C-l, I receive the same message Creating LaTeX previews in section... done. as above and once again no rendering.

6
  • What is the value of org-preview-latex-default-process? If it is not dvipng, then try setting to that. Edit your question and add the value. Also add the value of org-preview-latex-process-alist for good measure.
    – NickD
    Mar 24 at 1:25
  • Can you show us the document you are trying to create previews in? What happens if you try C-u C-u C-c C-x C-l?
    – Tyler
    Mar 24 at 16:03
  • @Tyler, Done. Added the example and response to the key-combo. Mar 24 at 17:05
  • Incidentally, I would recommend working from the built-in org documentation (i.e., M-x org-info). Worg gets updated very irregularly (if at all), and the tutorial you were referring to appears to be six or seven years old! It can be confusing, as org changes a lot between versions.
    – Tyler
    Mar 24 at 18:14
  • That example is a LaTeX file to be used for testing the dvipng installation: it is NOT an org file to be used for testing LaTeX preview. The example you should follow is under "Basic Usage" : put that in your Org mode file and then do C-c C-x C-l on each of them.
    – NickD
    Mar 24 at 18:35
1

I think the example you are working from has mislead you. You can include LaTeX snippets in your org files directly, you don't need to wrap them in a src block. In fact, src blocks are ignored when org tries to preview the LaTeX snippets.

Try this:

* Org heading

This is an ordinary org file. The following LaTeX code can be previewed:

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

\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

Latex code inside src blocks doesn't get previewed:

#+BEGIN_SRC latex :tangle latex/example.tex
\documentclass{article}

\begin{document}

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

\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

\end{document}

#+END_SRC

2
  • Ok. Thanks for pointing this out. Now I receive the following error when invoking C-c C-x C-l: Creating LaTeX preview... org-compile-file: File "/tmp/orgtexX7Vwnu.dvi" wasn’t produced. Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’. Mar 24 at 18:36
  • I'm not sure what's wrong. This example works for me on Ubuntu 18.04, with the same dvipng settings as you have listed in your question ??
    – Tyler
    Mar 24 at 18:51
1

Problem solved! I had to install the texlive-latex-extra package as I was missing some .sty files.

Your Answer

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

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