Preview Org LaTeX fuzzy on mesh displays

I use Emacs 24.4 for all my math / science notes. org-latex-preview is fantastic for this! But recently I upgraded to macbook pro with retina display, and now I see that all my equations in org-mode ... are fuzzy. Is there a setting that I can change to update?

Here is a screenshot:

enter image description here

Thanks!

+5
source share
3 answers

A few years ago, I decided to fix this and wrote a patch to add dvisvgm as a rendering option for latex previews. Although this worked fine, I never submitted it (no time or knowledge on how to officially install org).

Today I was very happy to know that org-mode v9.0.6 now has this feature!

To activate, first check that you have dvisvgm on your system. Then update org-mode and add the following line to your init.el file:

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

And presto!

enter image description here

+3
source

I tried emacs-mac-port

If I create 2 files foo.png foo@2x.png in the same directory, this will work.

0
source

By default, palm preview orgmode does not support the retina, so on a mac with a retina screen, latex viewing will be fuzzy.
However, we can hack org.el to achieve this feature. Just follow these steps:

get the correct version of emacs

Instead, use Yamamoto Mitsuharu's Emacs 25.1 version (with more Mac-specific features):

 brew tap railwaycat/emacsmacport brew install emacs-mac 

and finally bind it to the Applications folder:

 brew linkapps emacs-mac 

this version of emacs will support retinal imaging.

change parameters org-format-latex-options

zoom from 1.0 to 2.0 to create a 2x image.

remove org.elc

add function to org.el

 (defun galaxy-compose-image-filename-2x(image-file-name) (concat (file-name-directory image-file-name) (file-name-base image-file-name) "@2x." (file-name-extension image-file-name))) 

and eval function.

change org-format-latex function

change snippet:

 (unless (file-exists-p movefile) (org-create-formula-image value movefile options forbuffer processing-type) 

to

 (unless (file-exists-p movefile) (org-create-formula-image value movefile options forbuffer processing-type) (setq filename-2x (galaxy-compose-image-filename-2x movefile)) (rename-file movefile filename-2x) (call-process-shell-command "convert" nil nil nil nil (concat "\"" filename-2x "\" -scale \"50%\" -quality \"100%\"" ) (concat "\"" movefile "\"" ))) 

and eval function.

Now you can view the latex with a 2x size image for the mac retina screen.

0
source

All Articles