emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch: add custom latex->html conversion command


From: Bastien
Subject: Re: patch: add custom latex->html conversion command
Date: Mon, 17 Feb 2020 01:23:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Matt,

Matt Huszagh <address@hidden> writes:

> From 056d23d9e5caa6fc22907014e0128519fcc84b6e Mon Sep 17 00:00:00 2001
> From: Matt Huszagh <address@hidden>
> Date: Sat, 15 Feb 2020 18:42:11 -0800
> Subject: [PATCH] add custom command option when converting latex fragments to
>  html
>
> This allows you to set a custom command
> `org-latex-to-html-convert-command' that will take as input a latex
> fragment and use it to generate html for export. This is very
> open-ended in the sense that you can use any shell-command you want. I
> envisioned this for use with latexml, but there's nothing preventing
> you from using something else.

The commit message needs to be formatted using the Emacs changelog
format.  See `add-change-log-entry-other-window' on how to add a
changelog entry from a patch (or from magit's diff view).

> ---
>  lisp/org.el     | 30 ++++++++++++++++++++++++++++++
>  lisp/ox-html.el |  9 +++++++--
>  2 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 97ce7ec43..94557bf86 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -3203,6 +3203,22 @@ When using LaTeXML set this option to
>         (const :tag "None" nil)
>         (string :tag "\nShell command")))
>  
> +(defcustom org-latex-to-html-convert-command nil
> +  "Command to convert LaTeX fragments to HTML.
> +This command is very open-ended: the output of the command will
> +directly replace the latex fragment in the resulting HTML.
> +Replace format-specifiers in the command as noted below and use
> +`shell-command' to convert LaTeX to HTML.
> +%i:     The latex fragment to be converted.
> +
> +For example, this could be used with LaTeXML as
> +\"latexmlc 'literal:%i' --profile=math --preload=siunitx.sty 2>/dev/null\"."
> +  :group 'org-latex
> +  :version "26.1"

No need for :version "26.1" (which is false).

Better add :package-version '(Org . "9.5") for when this will be in 9.5.

> +  :type '(choice
> +       (const :tag "None" nil)
> +       (string :tag "\nShell command")))
                                        ^ missing value ?

> +(defun org-format-latex-as-html (latex-frag)
> +  "Convert latex to html with a custom conversion command.
> +`LATEX-FRAG' is the latex fragment
> +Set the custom command with `org-latex-to-html-convert-command'."
> +  (let ((cmd (format-spec
> +           org-latex-to-html-convert-command
> +           `((?i . ,latex-frag)))))
              ^ indentation looks weird.

Otherwise it looks good.  Thanks!

-- 
 Bastien



reply via email to

[Prev in Thread] Current Thread [Next in Thread]