emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: reza <reza@housseini.me>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: svg file from tikz picture
Date: Tue, 20 Sep 2022 09:55:42 +0000	[thread overview]
Message-ID: <010201835a532739-08121085-5b99-4410-8f53-11b74f8d7dcc-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <01020182a6670908-78f84b7b-c05b-42db-a109-0b828f53dc45-000000@eu-west-1.amazonses.com>

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

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

[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

  parent reply	other threads:[~2022-09-20 10:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3bc47afb-0bac-f6e8-1097-13dcb6f2be1f@housseini.me>
2022-08-15 18:50 ` svg file from tikz picture reza
2022-08-16  9:42   ` Ihor Radchenko
     [not found]     ` <964a4117-ef6c-8d41-a25d-00e61c0c93d8@housseini.me>
2022-08-16 10:00       ` reza
2022-08-16 10:13         ` Ihor Radchenko
     [not found]           ` <0931497c-9075-c214-c7f2-6507340a6d74@housseini.me>
2022-08-16 10:19             ` reza
2022-08-16 10:31               ` Ihor Radchenko
     [not found]                 ` <6daeb56b-163c-f862-5866-da624b43edd9@housseini.me>
2022-08-16 11:06                   ` reza
2022-08-16 11:22                     ` Ihor Radchenko
     [not found]                       ` <7dcd1348-6faf-8464-38b5-8efac7c69250@housseini.me>
2022-08-16 11:25                         ` reza
     [not found]                           ` <be3e5412-37ff-c1c7-7a27-3793d72842d4@housseini.me>
2022-09-20  9:55                             ` reza [this message]
2022-09-20 20:53                               ` Edouard Debry
2022-09-21  9:32                               ` Ihor Radchenko
2022-09-23  2:28                                 ` Akira Kyle
2022-09-25  7:52                                   ` Ihor Radchenko
2022-11-14  5:52                                     ` Ihor Radchenko
2023-03-24 23:22                                       ` Akira Kyle
2023-03-25 18:13                                         ` Ihor Radchenko
2023-03-25 18:14                                           ` Akira Kyle
2023-03-25 18:25                                             ` Ihor Radchenko
2023-04-19  9:57                                               ` Bastien Guerry
2023-08-05  9:34                                                 ` Ihor Radchenko
2023-08-05 17:29                                                   ` Bastien Guerry
2023-08-05 18:38                                                     ` Akira Kyle
2023-08-06  5:37                                                       ` Bastien Guerry
2023-08-06  5:40                                                       ` Bastien Guerry
2023-10-19  9:51                                                       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=010201835a532739-08121085-5b99-4410-8f53-11b74f8d7dcc-000000@eu-west-1.amazonses.com \
    --to=reza@housseini.me \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).