From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +O1AJBgsnF4kLQAA0tVLHw (envelope-from ) for ; Sun, 19 Apr 2020 10:46: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 mp0 with LMTPS id gD1KDB0snF5xIwAA1q6Kng (envelope-from ) for ; Sun, 19 Apr 2020 10:46: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 6B31B941E1B for ; Sun, 19 Apr 2020 10:46:52 +0000 (UTC) Received: from localhost ([::1]:40206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ7TJ-00050O-Co for larch@yhetil.org; Sun, 19 Apr 2020 06:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54710) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ7Sx-00050F-9Y for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 06:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQ7Sw-0007gK-6w for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 06:46:22 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:60699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jQ7Sv-0007bQ-Eu for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 06:46:21 -0400 Received: from localhost (40-67.ipv4.commingeshautdebit.fr [185.131.40.67]) (Authenticated sender: admin@nicolasgoaziou.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 6C403240008; Sun, 19 Apr 2020 10:46:17 +0000 (UTC) From: Nicolas Goaziou To: Brian Powell Subject: Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html References: <87h7xhxlyt.fsf@nicolasgoaziou.fr> Mail-Followup-To: Brian Powell , emacs-orgmode@gnu.org Date: Sun, 19 Apr 2020 12:46:15 +0200 In-Reply-To: (Brian Powell's message of "Sat, 18 Apr 2020 21:22:05 -1000") Message-ID: <87k12bwy6g.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.178.230; envelope-from=mail@nicolasgoaziou.fr; helo=relay10.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: Linux 3.11 and newer [fuzzy] X-Received-From: 217.70.178.230 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.11 Authentication-Results: aspmx1.migadu.com; dkim=none; 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.11 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.5721187302078]; 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.24), country: US(-0.01), ip: 209.51.188.17(-0.57)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[209.51.188.17:from]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(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]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[mail@nicolasgoaziou.fr,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[org-manual.org:url,hawaii.edu:email]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[nicolasgoaziou.fr]; HAS_LIST_UNSUB(-0.01)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: mSHiPiNB+nwR Hello, Brian Powell writes: > Thank you for the message. I spent about 2 hours on it today learning > more about lisp and the internals to explain your email to me. > I learned a lot. Thank you. > I have modified ox-html.el to include a local OPTION as well as > a customizable setting. I tested with both as well as with an export > option. All three worked correctly. I also updated the org-manual.org. > > Please find my patch attached. You need to provide a commit message, using git format-patch mechanism. > +- =HTML_EQUATION_REFERENCE_FORMAT= :: > + > + #+cindex: @samp{HTML_EQUATION_REFERENCE_FORMAT}, keyword > + #+vindex: org-html-equation-reference-format > + Specify the MathJax command for referencing equations > + (~org-html-equation-reference-format~). The default is to wrap in > + parentheses using "\\eqref{%s}". Setting to "\\ref{%s}" is consistent > + with LaTeX export. I don't think this is required. We do not document every variable for export back-ends. > ImageMagick suite is available on your system. You can still get this > processing with > > +The command for formatting equation references can be configured via > +~org-html-equation-reference-format~. > + > : #+OPTIONS: tex:dvipng This change is odd. You insert your sentence between an explanation and its related example. Anyway, per above, this is not needed. However, it would be nice to reference that variable in Publishing > Configuration > Options for the exporters > HTML specific properties > : #+OPTIONS: tex:dvisvgm > diff --git a/lisp/ox-html.el b/lisp/ox-html.el > index e70b8279b..4848028a2 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,20 @@ The function should return the string to be exported." > > ;;;; LaTeX > > +(defcustom org-html-equation-reference-format "\\eqref{%s}" > + "MathJax command to use when referencing equations. > + > +Default is to wrap equations in parentheses (using \"\\eqref{%s}\)\". It might be useful to explicitly state this is a format control string, expecting a single argument, the actual reference. > +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.3") It should be "9.4". > + ;; environment. Use "ref" or "eqref" macro, depending on user > + ;; preference to refer to those in the document. Indentation problem? > + (format (plist-get info :html-equation-reference-format) > (org-export-get-reference destination info)) OK. As a side note that you can achieve the same without this variable, using a link filter, e.g. (untested): (defun my-html-filter-references (text backend info) "Change \eqref{...} into \ref{...}." (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "\\`\\\\eqref{" "\\\\ref{" text))) (add-to-list 'org-export-filter-link-functions 'my-html-filter-references) Anyway, would you mind sending an updated patch? Regards, -- Nicolas Goaziou