Hi,

I can't comment on the rest of the discussion but I think I added this
org-html--unlabel-latex-environment line.  It was part of a change
allowing links to equations in HTML export
(https://lists.gnu.org/archive/html/emacs-orgmode/2018-01/msg00120.html).

When removing the call to org-html--unlabel-latex-environment, exporting
the following org file to html results in double equation labels (one
from dvipng, one from org to allow links).

,----
| #+OPTIONS: toc:nil html-postamble:nil tex:dvipng
|
| #+NAME: eq-test
| \begin{align}
| 1 + 1 = 0
| \end{align}
|
| link to equation [[eq-test]]
`----
(one could play with tex:mathjax and replace align by align* to see the
possible modes)

If I understand the problem correctly, one solution would be to apply
the environment transformation from env to env* only for math
environments.  Something along the lines of
,----
| (if (eq nil (org-html--math-environment-p latex-environment))
|     latex-frag
|   (org-html--unlabel-latex-environment latex-frag))
`----
may work (there may be a better way to do that).

I hope this helps.

Best,

thibault

On 2020-09-02T02:12:01-0400, Jeremie Juste wrote:


  Hello,

  I have found the culprit in the end. It was the function
  org-html--unlabel-latex-environment, int he ox-html.el file.

  I'm not sure this function is useful as I think it is better to give the
  user control on his environment (labelled or unlabelled) directly in his
  org file. I'm I missing something else about the use of this function?

  Anyway it was a good experience at debugging elisp.


  diff --git a/lisp/ox-html.el b/lisp/ox-html.el
  index 55d017529..b2a5d6d36 100644
  --- a/lisp/ox-html.el
  +++ b/lisp/ox-html.el
  @@ -2891,7 +2891,7 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
        ((assq processing-type org-preview-latex-process-alist)
         (let ((formula-link
                (org-html-format-latex
  -              (org-html--unlabel-latex-environment latex-frag)
  +              latex-frag
                 processing-type info)))
           (when (and formula-link (string-match "file:\\([^]]*\\)" 
formula-link))
             (let ((source (org-export-file-uri (match-string 1 formula-link))))


  Best regards,
  Jeremie

  - GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo 
version 1.16.0) of 2020-09-01
  - Org mode version 9.3.7 (release_9.3.7-725-g7bc18e @ 
/home/djj/src/org-mode/lisp/)

Reply via email to