all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: [patch] Add two new header args to LaTeX block
Date: Sun, 18 Feb 2024 13:43:34 +0000	[thread overview]
Message-ID: <877cj1vqex.fsf@posteo.net> (raw)
In-Reply-To: <87il2lsvlb.fsf@localhost> (Ihor Radchenko's message of "Sun, 18 Feb 2024 14:20:00 +0000")

Ihor Radchenko writes:

>> In any case, if the org-create-formula-image method is going to stay, I
>> think it is fine as it is (except for extending the allowed file formats
>> to more extensions, and not only .png). I also believe that the :process
>> argument is sufficient for the user to control the value of
>> org-latex-pdf-process or org-preview-latex-default-process, as
>> appropriate.
>
> My concern about your patch is that it creates even more divergence
> between different branches of code in `org-babel-execute:latex'.
> With the new proposed features only available to some code branches,
> `org-babel-execute:latex' will just become more messy and harder to
> maintain.
>
> I'd prefer to refactor `org-babel-execute:latex' first, before adding
> new header arguments.

org-create-formula-image inserts LaTeX code:

...
    (with-temp-file texfile
      (insert latex-header)
      (insert "\n\\begin{document}\n"
              "\\definecolor{fg}{rgb}{" fg "}%\n"
              (if bg
                  (concat "\\definecolor{bg}{rgb}{" bg "}%\n"
                          "\n\\pagecolor{bg}%\n")
                "")
              "\n{\\color{fg}\n"
              string
              "\n}\n"
              "\n\\end{document}\n"))
...

that, /in principle/, would make it incompatible with the :standalone
argument (in my patch), which allows writing all LaTeX code from scratch
in the block content.

Anyway, it is true that org-babel-execute:latex has grown in a somewhat
irregular way. For example, I don't quite understand why the simple
output to PDF and the conversion to an image with :imagemagick live in
the same conditional:

(or (string= "pdf" extension) imagemagick)

I would propose three main branches in this function:

- A PDF branch, using org-format-latex-header with its valid options,
  and other sub-branches with conversion from the PDF, for example, the
  use of :imagemagick. Or you could even think of any possible
  conversion process using a hypothetical :pdf-postprocess

- A branch for orf-create-formula-image

- a third branch to export to html, with org-babel-latex-htlatex.

Having three clearly differentiated branches would make the code easier
to maintain.

--
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño editorial y ortotipografía


  reply	other threads:[~2024-02-18 14:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10  1:58 [patch] Add two new header args to LaTeX block Juan Manuel Macías
2024-02-10 14:37 ` Ihor Radchenko
2024-02-10 15:20   ` Juan Manuel Macías
2024-02-10 16:35     ` Ihor Radchenko
2024-02-10 17:48       ` Juan Manuel Macías
2024-02-10 19:35         ` Juan Manuel Macías
2024-02-10 21:07           ` Ihor Radchenko
2024-02-10 23:34             ` Juan Manuel Macías
2024-02-11 14:43               ` Ihor Radchenko
2024-02-11 20:01                 ` Juan Manuel Macías
2024-02-13 13:42                   ` Ihor Radchenko
2024-02-13 20:25                     ` Juan Manuel Macías
2024-02-18 14:20                       ` Ihor Radchenko
2024-02-18 13:43                         ` Juan Manuel Macías [this message]
2024-02-19 11:15                           ` Ihor Radchenko
2024-02-19 13:24                             ` Juan Manuel Macías

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

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

  git send-email \
    --in-reply-to=877cj1vqex.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.