[Top][All Lists]

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

Re: Bug: org-mime-htmlize generates unwanted equations numbers in mail [

From: Nicolas Goaziou
Subject: Re: Bug: org-mime-htmlize generates unwanted equations numbers in mail [9.2.5 (release_9.2.5-521-gdea0c7 @ /home/oub/emacs/site-lisp/packages/org/)]
Date: Sun, 08 Dec 2019 21:40:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)


Thibault Marin <address@hidden> writes:

> Following-up on this bug report regarding the handling of unnumbered
> equation environments in HTML export, I would like to propose the
> attached patch.  The patch simply removes the caption for unnumbered
> environments.

Thank you.

> Could you please let me know whether this could be considered for a
> merge and if there any comments or suggestions to improve it?

Some comments follow.

> +(defun org-html--latex-environment-numbered-p (latex-frag)

> +  "Return t if LATEX-ENV contains a numbered environment.

Non-nil if...

> +Environments with a star (*) character and displaymath are not
> numbered."

I think that "starred environments and displaymath" is enough.

However, I suggest to make this function operate on the element itself,
not its value, much like `org-html--math-environment-p'.

> +  (not (some 'identity
> +          (mapcar (lambda (el)
> +                    (string-match el latex-frag))
> +                  '("\\`[ \t]*\\\\begin{[^*}]+?[*]}"
> +                    "\\`[ \t]*\\\\begin{displaymath}")))))

I suggest merging the two regexps into a single one, and use:

    (not (string-match-p REGEXP latex-env))

> +  (let* ((processing-type (plist-get info :with-latex))
> +      (latex-frag (org-remove-indentation
> +                   (org-element-property :value latex-environment)))
> +         (attributes (org-export-read-attribute :attr_html 
> latex-environment))
> +         (label (and (org-element-property :name latex-environment)
> +                     (org-export-get-reference latex-environment info)))
> +      (caption (when (org-html--latex-environment-numbered-p
> +                      latex-frag)
> +                 (number-to-string
> +                  (org-export-get-ordinal
> +                   latex-environment info nil
> +                   (lambda (l info)
> +                     (and (org-html--math-environment-p l)
> +                          (org-html--latex-environment-numbered-p
> +                           (org-remove-indentation
> +                            (org-element-property :value l))))))))))

Operating directly on the element will be a bit nicer. Why do you need

Could you send an updated patch and provide an ORG-NEWS entry (on top of


Nicolas Goaziou

reply via email to

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