diff --git a/doc/org-manual.org b/doc/org-manual.org index 6d5a34e56..69a36d6c7 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -12531,6 +12531,15 @@ settings described in [[*Export Settings]]. to typeset LaTeX math in HTML documents. See [[*Math formatting in HTML export]], for an example. +- =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. + - =HTML_HEAD= :: #+cindex: @samp{HTML_HEAD}, keyword @@ -12898,6 +12907,9 @@ files. This method requires that the dvipng program, dvisvgm or 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 : #+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}\)\". + +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") + :type 'string + :safe t) + (defcustom org-html-with-latex org-export-with-latex "Non-nil means process LaTeX math snippets. @@ -3113,9 +3128,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