[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html
From: |
Brian Powell |
Subject: |
Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html |
Date: |
Sat, 18 Apr 2020 21:22:05 -1000 |
User-agent: |
mu4e 1.2.0; emacs 28.0.50 |
Nicolas,
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.
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.
Cheers,
Brian
equation-ref.diff
Description: Text Data
On Fri, Apr 17 2020, Nicolas Goaziou wrote:
> Hello,
>
> Brian Powell <address@hidden> 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,
- Inconsistent use of \ref and \eqref in ox-latex and ox-html, Brian Powell, 2020/04/11
- Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Nicolas Goaziou, 2020/04/18
- Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html,
Brian Powell <=
- Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Nicolas Goaziou, 2020/04/19
- [PATCH] Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Brian Powell, 2020/04/19
- Re: [PATCH] Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Nicolas Goaziou, 2020/04/20
- Re: [PATCH] Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Brian Powell, 2020/04/20
- Re: [PATCH] Re: Inconsistent use of \ref and \eqref in ox-latex and ox-html, Nicolas Goaziou, 2020/04/21