emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Brian Powell <powellb@hawaii.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html
Date: Sat, 18 Apr 2020 10:00:10 +0200	[thread overview]
Message-ID: <87h7xhxlyt.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <A65F9934-C141-4782-988F-11673BB1548E@hawaii.edu> (Brian Powell's message of "Fri, 10 Apr 2020 11:56:35 -1000")

Hello,

Brian Powell <powellb@hawaii.edu> writes:

> The issue is that when exporting equation numbers with ox-html, it uses MathJax's \eqref that wraps the equation in parentheses, for example:
>
> "Refer to (3) for more."
>
> However, when exporting the same document with ox-latex, it uses Latex's \ref that does not wrap the equation in parentheses. Would it be possible to add an option or variable to ox-html for the user to select whether to use \ref or \eqref on export? 
>
> For those of us that publish to HTML and PDF, it is very difficult because you end up with either double or no parentheses.
>
> My proposed fix would be a change to ox-html from:
>
>                (format "\\eqref{%s}"
>                        (org-export-get-reference destination info))
>
> to
>
>                (format (if org-html-export-mathjax-ref "\\ref{%s}" "\\eqref{%s}")
>                        (org-export-get-reference destination info))
>
> The variable org-html-export-mathjax-ref is non-nil to use \ref vs.
> nil to be the default \eqref.

The variable could be more general, e.g.,
org-html-export-equation-reference-format, and default to "\\ref{%s}".
Note the export back-ends do not use variables directly. It would be

  (format (plist-get info :html-equation-reference-format)
          (org-export-get-reference destination info))

where the correspondence between :html-equation-reference-format is set
in back-end definition.

Also, it needs to be referenced in "HTML specific properties" section of
the manual.

Would you want to propose a patch ?

Regards,

-- 
Nicolas Goaziou


  reply	other threads:[~2020-04-18  8:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 21:56 Inconsistent use of \ref and \eqref in ox-latex and ox-html Brian Powell
2020-04-18  8:00 ` Nicolas Goaziou [this message]
2020-04-19  7:22   ` Brian Powell
2020-04-19 10:46     ` Nicolas Goaziou
2020-04-19 23:13       ` [PATCH] " Brian Powell
2020-04-20 16:40         ` Nicolas Goaziou
2020-04-20 19:52           ` Brian Powell
2020-04-21 17:46             ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7xhxlyt.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=powellb@hawaii.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).