Hi, thank you for the review. > I'm not convinced that inserting label and, more importantly, > caption within the environment is the way to go. For example, that > will not work when `org-html-with-latex' is set `verbatim'. Couldn't > we simply wrap a HTML label and caption above, or below, the whole > environment so it DTRT in all cases? It is true that my patch did not address the verbatim mode, I was focusing on the MathJax output. The reason I initially decided to rely on MathJax is that I thought it would be better to take advantage of MathJax support for LaTeX label and references. It was then sufficient to delegate rendering of the latex-environment and links to ox-latex, although I ended with some unpleasant code to achieve that. To make sure I understand the desired HTML output, do you mean that instead of producing this HTML: ,---- | \begin{align} | \label{eq:orgbfedefe} | 1 + 1 = 0 | \end{align} `---- and relying on MathJax to manage references, we should produce something like the following? ,---- |
| \begin{align} | 1 + 1 = 0 | \end{align} | |
`---- Am I understanding correctly? The advantage of this approach is that it is consistent with how the other types of references (figures, source blocks, etc.) are managed and it should work with the verbatim mode. I have a few questions about the "caption" (i.e. the equation number): 1. Where should it be placed? In a `' tag like it is done for figures? Ideally, I would like to have the caption (i.e. the equation number) on the right side of the equation, as it is done in LaTeX, should this be done with CSS? Should there be a user option for the position of the caption? 2. Should we disable MathJax's equation numbering and replace it with ours? I am afraid this may break the setup of users already relying on MathJax to label and reference equations. 3. Should there be an option to customize the formatting of the equation number, both on the right of the equation itself and in links (e.g. wrap the number between parentheses, as `\eqref' dose)? The attached patch tries to implement some version of this approach. The code looks less hackish to me, but I still rely on a variable external to ox-html.el: I use `org-latex-math-environments-re' to determine if the LaTeX block is a math block; this is used to limit counters to equations environments, ignoring other types of latex environments. Also note that I did not disable MathJax auto-numbering in the attached patch, so equations have two numbers. My main concern with this revised version of the patch is the possible conflicts between MathJax and org equation numbers: - Only one equation number should be shown, and MathJax and org counters may not match (e.g. with multiline equations). - If we disable MathJax auto-numbering, it seems that we would be losing the possibility to have labels on individual lines of multiline equations. Is it true? Please let me know how you would like me to move forward with this. Thanks in advance. thibault