emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Matt Huszagh <huszaghmatt@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: patch: add custom latex->html conversion command
Date: Mon, 17 Feb 2020 01:23:25 +0100	[thread overview]
Message-ID: <87k14mdptu.fsf@gnu.org> (raw)
In-Reply-To: <87blpz1c29.fsf@gmail.com> (Matt Huszagh's message of "Sat, 15 Feb 2020 18:49:18 -0800")

Hi Matt,

Matt Huszagh <huszaghmatt@gmail.com> writes:

> From 056d23d9e5caa6fc22907014e0128519fcc84b6e Mon Sep 17 00:00:00 2001
> From: Matt Huszagh <huszaghmatt@gmail.com>
> 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

  parent reply	other threads:[~2020-02-17  0:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16  2:49 patch: add custom latex->html conversion command Matt Huszagh
2020-02-17  0:06 ` Bastien
2020-02-17  0:12   ` Matt Huszagh
2020-02-17  0:19     ` Bastien
2020-02-17  0:23 ` Bastien [this message]
2020-02-17  1:06   ` Matt Huszagh
2020-02-17  1:10     ` Bastien
2020-02-17  1:11       ` Matt Huszagh
2020-02-24 10:27     ` Bastien

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=87k14mdptu.fsf@gnu.org \
    --to=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=huszaghmatt@gmail.com \
    /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).