# Previewing LaTeX fragments in org-mode not working

I've been trying to find a fix for this for a few days now and it's driving me crazy, so any help would be amazing. I'm trying to set my emacs up for making maths notes using org-mode. However, I've run into several problems displaying equations within org-mode.

First, when I used c-c c-x c-l I got the error,

can't find 'latex' (you need to install programs: latex and dvipng.)


I managed to find a fix for this using the following code in my init file:

(setenv "PATH" (concat ":/Library/TeX/texbin/" (getenv "PATH")))


but I now get a new error:

File "var/folders/z5/kbjq2cd50mv3fmzpwsr1s94h0000gn/T/orgtex905eux.dvi" wasn't produced. Please adjust 'dvipng' of 'org-preview-latex-process-alist'.


I've navigated to this file and found orgtex905eux.tex and manually converted this to a PNG using latex and dvipng in the terminal. As per link. And I noticed it adds a 1 to the end of the file name, but doesn't fix my problem.

Also I'm using mac OS.

The same happen to me, and it turned out to be an error in the formula.

For example:

Incorrect formula:
$$y[x/e'] = \begin{cases} e' & \text{if x = y}\\ y & \text{if x \neq y} \end{cases}$$

Correct formula:
$$y[x/e'] = \begin{cases} e' & \text{if x = y}\\ y & \text{if x \neq y} \end{cases}$$


Notice the $\neq$ (correct) vs \neq (incorrect).

I recommend that you debug your formula bit by bit.

• Welcome to tex.sx. Actually, the entire math expression within \text should be marked as math: $x = y$ and $x \neq y$. However, this doesn't really appear to answer the question. (But I can't answer it either.) – barbara beeton Oct 24 '20 at 15:45