When exporting an org file containing latex fragments with option
#+OPTIONS: tex:dvipng
in the html file the png image src attribute's value is not a valid URI.
<img src="e:/dir/sth.png" ...> while it should be <img
src="file:///e:/dir/sth.png" ...> for the browser to work. In my config
I have (setq org-preview-latex-image-directory "E:/tmp/ltximg/") so
that all images are created in a single directory and don't clutter my
org file directory.
I fixed this issue for me by modifying `org-html--format-image' function
of ox-html.el file as follow:
(defun org-html--format-image (source attributes info)
"Return \"img\" tag with given SOURCE and ATTRIBUTES.
SOURCE is a string specifying the location of the image.
ATTRIBUTES is a plist, as returned by
`org-export-read-attribute'. INFO is a plist used as
a communication channel."
(if (string= "svg" (file-name-extension source))
(org-html--svg-image source attributes info)
(org-html-close-tag
"img"
(org-html--make-attribute-string
(org-combine-plists
(list :src (concat "file:///" source)
:alt (if (string-match-p "^ltxpng/" source)
(org-html-encode-plain-text
(org-find-text-property-in-string 'org-latex-src source))
(file-name-nondirectory source)))
attributes))
info)))
I just changed (list :src source ...) to (list :src (concat "file:///"
source).
I don't know if it is an acceptable way or it further causes bugs in
other places.
Hope that this will find the proper way and fix it.
(emacs-version) = "GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-11-01"
(org-version) = "9.3.6"
Emacs Admirer,
Bibek Panthi
#+OPTIONS: tex:dvipng
* Vector Subspace
+ Subspace :: A subspace of a vector space $V$ is a subset $S \subset V$
such that $S$ itself is a vector space. (i.e. it must be closed
under addition, and scaling and thus also include $0$)