[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: svg file from tikz picture
From: |
reza |
Subject: |
Re: svg file from tikz picture |
Date: |
Tue, 20 Sep 2022 09:55:42 +0000 |
By setting
(setq org-babel-latex-preamble (lambda (_)
"\\documentclass[preview]{standalone}\n")
the tikz file svg generation does run fine. Obviously the part
\\def\\pgfsysdriver{pgfsys-tex4ht.def}
inside `org-babel-latex-preamble` does not play well with the svg
generation.
When having a look at the code inside ob-latex.el I also encountered a
few stuff which made me wondering:
1. png generation is done with the preview code inside org.el
(org-create-formula-image), there is also a perfectly fine svg preview
function but this does not get used for the svg extension which does the
svg conversion without any external tools like inkscape (see
https://github.com/bzg/org-mode/blob/main/lisp/ob-latex.el#L156 and
https://github.com/bzg/org-mode/blob/main/lisp/org.el#L3181)
2. there is a tikz extension switch which does insert the code verbatim,
which in my opinion does create a whole bunch of problems (backend
dependency issues). Not to mention that it also mimics behaviour which
is reserved for the header :results (see
https://github.com/bzg/org-mode/blob/main/lisp/ob-latex.el#L177).
3. there is a html extension switch with an unclear purpose to me (in
what scenario would you want to produce an html file?). It also has some
strange (and contradicting) checking if an svg or an html file got
produced. As far as I can tell this code never gets executed and is
therefore pointless (see
https://github.com/bzg/org-mode/blob/main/lisp/ob-latex.el#L181).
4. the whole pdf generation looks like duplicate code which is already
done in other parts of the code base (ox-latex.el and for the svg
extension) it ais also not using the variable org-babel-latex-begin-env
and org-babel-latex-end-env (see
https://github.com/bzg/org-mode/blob/main/lisp/ob-latex.el#L225).
I don't want to criticize anyone, I just want to find answers for in my
opinion some strange decisions.
My propositions for refactoring is:
1. use the svg preview code for svg generation (and therefore ditching
the whole imagemagick headers)
2. remove the whole tikz generation completely
3. remove the whole html generation completely
4. try to merge pdf generation with org.el and ox-latex.el or
incorporating it into he preview code and
org-preview-latex-process-alist (this is probably a whole project of it own)
WDYT?
Best,
Reza
OpenPGP_0xC375C6AF05125C52.asc
Description: application/pgp-keys
OpenPGP_signature
Description: PGP signature
- Re: svg file from tikz picture,
reza <=