Why You Cannot Display SVG Images in Your Emacs
In order to use dvisvgm
properly, and have Emacs actually overlay the svg
images, Emacs must be able to not only generate svg
files, but also display them.
If you have a Latex package installed on your machine, like MacTex, then you already have dvisvgm
installed, and Emacs will be able to generate the svg
images. The real problem lies in displaying the svg
images in Emacs. To do so, the Emacs binary you are using must have been built with svg
support.
If your Emacs has not been built with svg
support, then it is not possible to add svg
support by installing a package or modifying your init.el
file (to the best of my knowledge). This is the case with the Emacs version from emacsformacosx.com. This was the Emacs I was using, and it does not have svg
support.
Solution
The easiest solution is to download another Emacs binary that has been compiled with svg
support. I found another great Emacs binary for Mac users, that not only has svg
support, but also extra utilities that can make use of a Mac's higher resolution displays. This binary can be found on this github (Yamamoto's Emacs a.k.a. Emacs Mac Port).
If you download the most recent Emacs from the link above (at the time of writing it was Emacs 25.2 Mac 6.4), and add (setq org-latex-create-formula-image-program 'dvisvgm)
to your init.el
, then C-c C-x C-l
will work, and the overlayed svg
image will look great on your display:

If you want to keep Emacs "lean", you can compile Emacs yourself, adding only support to svg
.
imagemagic
installed?C-c C-x C-v
and gotInvalid image type 'svg'
. Not sure aboutimagemagic (k?)
, how can I check that?svg
support, as there is no other way to add svg support to it after compilation (don't know why, though). I first got my Emacs from emacsformacosx.com, but I find out that a much much better Emacs is available from github.com/railwaycat/homebrew-emacsmacport. This other version is called Emacs Mac Port and it has svg support built-in, and many other "utilities" for Mac users. Thanks for helping!!! :D