From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <87pngytusp.fsf@nicolasgoaziou.fr> References: <87tv7o6nki.fsf@mat.ucm.es> <87imo37lay.fsf@mat.ucm.es> <87pniapzk9.fsf@dell-desktop.WORKGROUP> <87ftj6r537.fsf@mat.ucm.es> <87muc2snas.fsf@dell-desktop.WORKGROUP> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34059) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ie3Ma-0005sG-P6 for emacs-orgmode@gnu.org; Sun, 08 Dec 2019 15:41:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ie3MX-0000h9-8N for emacs-orgmode@gnu.org; Sun, 08 Dec 2019 15:41:06 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:44241) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ie3MX-0000Um-0t for emacs-orgmode@gnu.org; Sun, 08 Dec 2019 15:41:05 -0500 In-Reply-To: <87muc2snas.fsf@dell-desktop.WORKGROUP> (Thibault Marin's message of "Sun, 08 Dec 2019 13:08:11 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Thibault Marin Cc: Uwe Brauer , emacs-orgmode@gnu.org Hello, Thibault Marin 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) ^^^^^^^^^^ latex-env > + "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 `org-remove-indentation'? Could you send an updated patch and provide an ORG-NEWS entry (on top of master)? Regards, -- Nicolas Goaziou