emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: emacs-orgmode@gnu.org
Subject: Re: latex fragments compilation error when exporting to html
Date: Wed, 02 Sep 2020 03:40:36 -0400	[thread overview]
Message-ID: <87mu28r5hn.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <87a6y8ogge.fsf@gmail.com>

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	other threads:[~2020-09-02  7:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 20:24 latex fragments compilation error when exporting to html Jeremie Juste
2020-08-31 21:57 ` Nick Dokos
2020-09-01  5:15   ` Jeremie Juste
2020-09-01  9:06 ` Eric S Fraga
2020-09-01  9:36   ` Jeremie Juste
2020-09-01 10:48     ` Colin Baxter
2020-09-01 10:07   ` Jeremie Juste
2020-09-01 20:15   ` Jeremie Juste
2020-09-02  6:12     ` Jeremie Juste
2020-09-02  7:40       ` Thibault Marin [this message]

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=87mu28r5hn.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    /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).