From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WJJ4AQj+nV6uIgAA0tVLHw (envelope-from ) for ; Mon, 20 Apr 2020 19:54:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yBIpAQ3+nV4yEwAAB5/wlQ (envelope-from ) for ; Mon, 20 Apr 2020 19:54:53 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 30624941BD3 for ; Mon, 20 Apr 2020 19:54:52 +0000 (UTC) Received: from localhost ([::1]:41484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQcVG-0001Bf-0w for larch@yhetil.org; Mon, 20 Apr 2020 15:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58006) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQcSq-0007Qz-68 for emacs-orgmode@gnu.org; Mon, 20 Apr 2020 15:52:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQcSp-0002hO-3P for emacs-orgmode@gnu.org; Mon, 20 Apr 2020 15:52:19 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:53132) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQcSo-0002dJ-EU for emacs-orgmode@gnu.org; Mon, 20 Apr 2020 15:52:18 -0400 Received: by mail-pj1-x1044.google.com with SMTP id ng8so337171pjb.2 for ; Mon, 20 Apr 2020 12:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hawaii-edu.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=q+FORmlsq7fckSQghlxHXyfp3+VGYKVDXbBil5XViCA=; b=U+KnGafLPBEd3FJf4+34+DGGF82V57nyuoNXYodD7o2S3lwA/aSJPyYICUFhfPA8jy xFuHHkJU/HGqacYvg1XslcolsBOXTeRg2IYB8JhhDP/u2LzyyIFXrq9mW8hqBiN2ITKY TLGEaT/W5SjXuPtQPukYPys1A+6bd7LfCwF6VzEPBBX6b3gj0SLZtP78+oQDmNbIBUJS vLLXH5khNGdkz70cmAayllHjxhcUNM6HKTJlgy7kfIXLOSCdSEp3EA3pCXsmiY4Q5KNT jkQGrlK9DgixiKlJbc5aNZ0Y4kjKgcmgTHloIP9YpsDsmjzkpArtkiVEFsbJtEWpM6hd g4EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=q+FORmlsq7fckSQghlxHXyfp3+VGYKVDXbBil5XViCA=; b=AKXk7aakYBL2O8lPAieBnYQ9olm6yMomcz1EEp33eUTum1UUGL55D0YzdxVZHJB1RX bd0+PGDvU0mi76Mw2H++1f3jGTIUA9TUDrQD3yrdRP7eXCtX6KpaMa7WKr1X1OjQ1Xd2 QZgUfWYhqVh5mhQqsUHzQTR8bF9j+moS8fx2a9HXPKZnRViYuDmHXehMFDAXzSeSCvGV qH06ZZmuMY/cgIj8HY6cRB+qlQsGZ2u7rX7GUzoFcE3uJool7utVduV8YB3VtrQhNaGI /N6RLWowGkj+2/0V4HKFLzUdCF8Ay6HSeVHiUDKFe0T8w+yhSQtJM/B9hIHg5oRMYlom gcvg== X-Gm-Message-State: AGi0PuZuAseAiQj5UnIY0E0lTPiCpWkp4ZHnC9ViG4qSpHBrJ/k3xvss h7s0vnq7AtuWkyTVUPjtspEY7QvS6v4= X-Google-Smtp-Source: APiQypK92O1SH5Xi5qXA/E5SrdXCgxSgc0abbThRj2xeenkXVTPd+SrBvE1O9DWj8fTva2E3us/Lhg== X-Received: by 2002:a17:902:549:: with SMTP id 67mr9499804plf.115.1587412336459; Mon, 20 Apr 2020 12:52:16 -0700 (PDT) Received: from localhost ([132.160.7.6]) by smtp.gmail.com with ESMTPSA id t15sm150223pgv.61.2020.04.20.12.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 12:52:15 -0700 (PDT) References: <87h7xhxlyt.fsf@nicolasgoaziou.fr> <87k12bwy6g.fsf@nicolasgoaziou.fr> <87imhurtzf.fsf@nicolasgoaziou.fr> User-agent: mu4e 1.4; emacs 28.0.50 From: Brian Powell To: Nicolas Goaziou Subject: Re: [PATCH] Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html In-reply-to: <87imhurtzf.fsf@nicolasgoaziou.fr> Message-ID: Date: Mon, 20 Apr 2020 09:52:05 -1000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1044; envelope-from=powellb@hawaii.edu; helo=mail-pj1-x1044.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::1044 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.31 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hawaii-edu.20150623.gappssmtp.com header.s=20150623 header.b=U+KnGafL; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.31 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.56919251364994]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.23), country: US(-0.01), ip: 209.51.188.17(-0.57)]; HAS_ATTACHMENT(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[hawaii-edu.20150623.gappssmtp.com:+]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[209.51.188.17:from]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[powellb@hawaii.edu,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[hawaii-edu.20150623.gappssmtp.com:s=20150623]; URIBL_BLOCKED(0.00)[gnu.org:url,hawaii.edu:email,hawaii-edu.20150623.gappssmtp.com:dkim]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; DMARC_NA(0.00)[hawaii.edu]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: fvYHUkWAy+dz --=-=-= Content-Type: text/plain Thanks again. Please find attached patch addressing issues below. Cheers, Brian On Mon, Apr 20 2020, Nicolas Goaziou wrote: >> Subject: [PATCH] add org-html-equation-reference-format to customize MathJax >> ref command > > The commit message should reference the file being modified. I suggest > something along the lines: > > Add customizable format string for equations > > * lisp/ox-html.el (org-html-equation-reference-format): New variable. updated >> +(defcustom org-html-equation-reference-format "\\eqref{%s}" >> + "MathJax command to use when referencing equations. This is a >> +format controls string, expecting a single argument, the equation >> +being referenced that is generated on export. > > Small nit here. The first line of a docstring must contain complete > sentences only. Therefore you need to move "This is a" part to the line > below. > > Also : controls -> control > > Otherwise, it looks good! Could you provide an entry in ORG-NEWS about > it? I think Version 9.4 > Miscellaneous is a fine place for it. Done and done. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-customizable-format-string-for-equations-in-HTML.patch >From f3a8e7d99a390c6dd965f347d95f35780e7d3a77 Mon Sep 17 00:00:00 2001 From: Brian Powell Date: Mon, 20 Apr 2020 09:49:12 -1000 Subject: [PATCH] Add customizable format string for equations in HTML export * lisp/ox-html.el (org-html-equation-reference-format): New variable. * doc/org-manual.org update to reference new variable --- doc/org-manual.org | 1 + etc/ORG-NEWS | 9 +++++++++ lisp/ox-html.el | 25 ++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 6d5a34e56..4b1a14ef4 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -15851,6 +15851,7 @@ Settings]]), however, override everything. | ~:html-link-use-abs-url~ | ~org-html-link-use-abs-url~ | | ~:html-mathjax-options~ | ~org-html-mathjax-options~ | | ~:html-mathjax-template~ | ~org-html-mathjax-template~ | +| ~:html-equation-reference-format~ | ~org-html-equation-reference-format~ | | ~:html-metadata-timestamp-format~ | ~org-html-metadata-timestamp-format~ | | ~:html-postamble-format~ | ~org-html-postamble-format~ | | ~:html-postamble~ | ~org-html-postamble~ | diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index f6f806b8f..fbee0124d 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -384,6 +384,15 @@ now. E.g., This bug [[https://lists.gnu.org/archive/html/emacs-orgmode/2013-08/msg00072.html][originally reported]] by Matt Lundin and investigated by Andrew Hyatt has been fixed. Thanks to both of them. +*** Format of equation reference in HTML export can be specified + +By default, HTML (via MathJax) and LaTeX export equation references +using different commands. LaTeX must use \ref{%s} because it is used +for all labels; however, HTML (via MathJax) uses \eqref{%s} for equations +producing inconsistent output. New option +~org-html-equation-reference-format~ sets the command used in +HTML export. + * Version 9.3 ** Incompatible changes diff --git a/lisp/ox-html.el b/lisp/ox-html.el index e70b8279b..266467345 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -121,6 +121,7 @@ (:html-link-home "HTML_LINK_HOME" nil org-html-link-home) (:html-link-up "HTML_LINK_UP" nil org-html-link-up) (:html-mathjax "HTML_MATHJAX" nil "" space) + (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil org-html-equation-reference-format t) (:html-postamble nil "html-postamble" org-html-postamble) (:html-preamble nil "html-preamble" org-html-preamble) (:html-head "HTML_HEAD" nil org-html-head newline) @@ -761,6 +762,24 @@ The function should return the string to be exported." ;;;; LaTeX +(defcustom org-html-equation-reference-format "\\eqref{%s}" + "The MathJax command to use when referencing equations. + +This is a format control string that expects a single string argument +specifying the label that is being referenced. The argument is +generated automatically on export. + +The default is to wrap equations in parentheses (using \"\\eqref{%s}\)\". + +Most common values are: + + \"\\eqref{%s}\" Wrap the equation in parentheses + \"\\ref{%s}\" Do not wrap the equation in parentheses" + :group 'org-export-html + :package-version '(Org . "9.4") + :type 'string + :safe t) + (defcustom org-html-with-latex org-export-with-latex "Non-nil means process LaTeX math snippets. @@ -3113,9 +3132,9 @@ INFO is a plist holding contextual information. See (eq 'latex-environment (org-element-type destination)) (eq 'math (org-latex--environment-type destination))) ;; Caption and labels are introduced within LaTeX - ;; environment. Use "eqref" macro to refer to those in - ;; the document. - (format "\\eqref{%s}" + ;; environment. Use "ref" or "eqref" macro, depending on user + ;; preference to refer to those in the document. + (format (plist-get info :html-equation-reference-format) (org-export-get-reference destination info)) (let* ((ref (org-export-get-reference destination info)) (org-html-standalone-image-predicate -- 2.26.1 --=-=-=--