emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex fragments compilation error when exporting to html
@ 2020-08-31 20:24 Jeremie Juste
  2020-08-31 21:57 ` Nick Dokos
  2020-09-01  9:06 ` Eric S Fraga
  0 siblings, 2 replies; 10+ messages in thread
From: Jeremie Juste @ 2020-08-31 20:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello 

When I export test.org to html, the latex fragment fail to compile. 
The reason is a star get added to the tabular environment. {tabular*}
(see tmpfile.tex). 

I don't know why the function insists in using the tabular* environment.

From this point I would have two questions:

How can I remove the star from the tabular environment ?
How can I can I find the culprit?
- I was hoping to provide a patch by finding the culprit but I got lost.
  - I tried to debug-on-entry org-format-latex.
  

Best regards,
Jeremie
   
> test.org 
#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t tex:imagemagick title:nil author:nil date:nil
#+LATEX_HEADER: \usepackage{booktabs}

     \begin{tabular}{lll}
     \toprule
      1 & 2 & 3 \\
      5 & 6 & 8 \\
     \bottomrule
     \end{tabular}
  
> tmpfile.tex

...

{\color{fg}
\begin{tabular*}{lll}
\toprule
 1 & 2 & 3 \\
 5 & 6 & 8 \\
\hline
\end{tabular*}
%
}


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2020-08-31 21:57 UTC (permalink / raw)
  To: emacs-orgmode

Jeremie Juste <jeremiejuste@gmail.com> writes:

> Hello 
>
> When I export test.org to html, the latex fragment fail to compile. 
> The reason is a star get added to the tabular environment. {tabular*}
> (see tmpfile.tex). 
>
> I don't know why the function insists in using the tabular* environment.
>
> From this point I would have two questions:
>
> How can I remove the star from the tabular environment ?
> How can I can I find the culprit?
> - I was hoping to provide a patch by finding the culprit but I got lost.
>   - I tried to debug-on-entry org-format-latex.
>   
>
> Best regards,
> Jeremie
>    
>> test.org 
>
> #+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t tex:imagemagick title:nil author:nil date:nil
> #+LATEX_HEADER: \usepackage{booktabs}
>
>      \begin{tabular}{lll}
>      \toprule
>       1 & 2 & 3 \\
>       5 & 6 & 8 \\
>      \bottomrule
>      \end{tabular}
>   
>> tmpfile.tex
>
> ...
>
> {\color{fg}
> \begin{tabular*}{lll}
> \toprule
>  1 & 2 & 3 \\
>  5 & 6 & 8 \\
> \hline
> \end{tabular*}
> %
> }
>
>

I cannot reproduce it with Org mode version 9.3.7 (release_9.3.7-705-gea9463 @ /home/nick/src/emacs/org/org-mode/lisp/).
What version are you using?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-08-31 21:57 ` Nick Dokos
@ 2020-09-01  5:15   ` Jeremie Juste
  0 siblings, 0 replies; 10+ messages in thread
From: Jeremie Juste @ 2020-09-01  5:15 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode


Hello,

Nick Dokos <ndokos@gmail.com> writes:

> Jeremie Juste <jeremiejuste@gmail.com> writes:
>
>> Hello 
>>
>> When I export test.org to html, the latex fragment fail to compile. 
>> The reason is a star get added to the tabular environment. {tabular*}
>> (see tmpfile.tex). 
>>
>> I don't know why the function insists in using the tabular* environment.
>>
>> From this point I would have two questions:
>>
>> How can I remove the star from the tabular environment ?
>> How can I can I find the culprit?
>> - I was hoping to provide a patch by finding the culprit but I got lost.
>>   - I tried to debug-on-entry org-format-latex.
>>   
>>
>> Best regards,
>> Jeremie
>>    
>>> test.org 
>>
>> #+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t tex:imagemagick title:nil author:nil date:nil
>> #+LATEX_HEADER: \usepackage{booktabs}
>>
>>      \begin{tabular}{lll}
>>      \toprule
>>       1 & 2 & 3 \\
>>       5 & 6 & 8 \\
>>      \bottomrule
>>      \end{tabular}
>>   
>>> tmpfile.tex
>>
>> ...
>>
>> {\color{fg}
>> \begin{tabular*}{lll}
>> \toprule
>>  1 & 2 & 3 \\
>>  5 & 6 & 8 \\
>> \hline
>> \end{tabular*}
>> %
>> }
>>
>>
>
> I cannot reproduce it with Org mode version 9.3.7 (release_9.3.7-705-gea9463 @ /home/nick/src/emacs/org/org-mode/lisp/).
> What version are you using?

Thanks for have taken the time to check.

The org-version I was using was
Org mode version 9.3.7 (9.3.7-13-ge62ca4-elpaplus @ /home/djj/.emacs.d/elpa/org-plus-contrib-20200713/)

I updated to the latest version on melpa but the issue persists
Org mode version 9.3.7 (9.3.7-24-g7b657c-elpa @
/home/djj/.emacs.d/elpa/org-20200831/)


Best regards,
Jeremie


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  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  9:06 ` Eric S Fraga
  2020-09-01  9:36   ` Jeremie Juste
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Eric S Fraga @ 2020-09-01  9:06 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: emacs-orgmode

On Monday, 31 Aug 2020 at 22:24, Jeremie Juste wrote:
> When I export test.org to html, the latex fragment fail to compile. 
> The reason is a star get added to the tabular environment. {tabular*}
> (see tmpfile.tex). 

Doesn't happen to me.

Out of curiosity, what happens if you wrap the LaTeX in
#+begin_export latex ... #+end_export
?

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-724-ge8ebf5


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  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
  2 siblings, 1 reply; 10+ messages in thread
From: Jeremie Juste @ 2020-09-01  9:36 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

Many thanks for your concerns.
Everything goes well with emacs -Q. Sorry for the noise.
The culprit is definitely in my init file. I'll keep the emacs -Q
options in mind before sending issues next time.

> Out of curiosity, what happens if you wrap the LaTeX in
> #+begin_export latex ... #+end_export
If I wrap I get the same error.

Best regards,
Jeremie






Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Monday, 31 Aug 2020 at 22:24, Jeremie Juste wrote:
>> When I export test.org to html, the latex fragment fail to compile. 
>> The reason is a star get added to the tabular environment. {tabular*}
>> (see tmpfile.tex). 
>
> Doesn't happen to me.
>
> Out of curiosity, what happens if you wrap the LaTeX in
> #+begin_export latex ... #+end_export
> ?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-09-01  9:06 ` Eric S Fraga
  2020-09-01  9:36   ` Jeremie Juste
@ 2020-09-01 10:07   ` Jeremie Juste
  2020-09-01 20:15   ` Jeremie Juste
  2 siblings, 0 replies; 10+ messages in thread
From: Jeremie Juste @ 2020-09-01 10:07 UTC (permalink / raw)
  To: emacs-orgmode


Some news about the investigation. The org-mode version of the emacs -Q
is  Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
/usr/local/share/emacs/26.3/lisp/org/). It's pretty old but the latex
compilation works fine.

When I change to
Org mode version 9.3.7 (9.3.7-24-g7b657c-elpa @
/home/djj/.controlled-emacs.d/elpa/org-20200831/)

The same issue arises. tabular* instead of tabular.


I don't know how to change the version of org-mode without
restarting. But with my .emacs brought to minimun and I just
uncommenting the following command.

(add-to-list 'load-path "/home/djj/.controlled-emacs.d/elpa/org-20200831")
(require 'org) is enough to generate the issue.



Best regards,
Jeremie 



Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Monday, 31 Aug 2020 at 22:24, Jeremie Juste wrote:
>> When I export test.org to html, the latex fragment fail to compile. 
>> The reason is a star get added to the tabular environment. {tabular*}
>> (see tmpfile.tex). 
>
> Doesn't happen to me.
>
> Out of curiosity, what happens if you wrap the LaTeX in
> #+begin_export latex ... #+end_export
> ?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-09-01  9:36   ` Jeremie Juste
@ 2020-09-01 10:48     ` Colin Baxter
  0 siblings, 0 replies; 10+ messages in thread
From: Colin Baxter @ 2020-09-01 10:48 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: emacs-orgmode

>>>>> Jeremie Juste <jeremiejuste@gmail.com> writes:

    > Hello,

    > Many thanks for your concerns.  Everything goes well with emacs
    > -Q. Sorry for the noise.  The culprit is definitely in my init
    > file. I'll keep the emacs -Q options in mind before sending issues
    > next time.

    >> Out of curiosity, what happens if you wrap the LaTeX in
    >> #+begin_export latex ... #+end_export
    > If I wrap I get the same error.

Perhaps check that you don't have any older versions of org-mode in your
system.


Best wishes,


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-09-01  9:06 ` Eric S Fraga
  2020-09-01  9:36   ` Jeremie Juste
  2020-09-01 10:07   ` Jeremie Juste
@ 2020-09-01 20:15   ` Jeremie Juste
  2020-09-02  6:12     ` Jeremie Juste
  2 siblings, 1 reply; 10+ messages in thread
From: Jeremie Juste @ 2020-09-01 20:15 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

Some follow up on this problem
I thought that I messed up the org-mode update because I had some
org files open during the updates.

I reinstall emacs and org-mode to the latest but I still get the
problem. Performing M-x org-html-export-to-html on the file below ends
up in an error because tabular* is wrongly added instead of tabular.

I could reproduce the problem with the version org-mode that comes with
the latest emacs version as well.



-- test.org 
#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t tex:imagemagick title:nil author:nil date:nil
#+LATEX_HEADER: \usepackage{booktabs}

\begin{tabular}{lll}
\toprule
4 & 2 & 3 \\
5 & 6 & 8 \\
\hline
\end{tabular}
\end{table}

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/)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-09-01 20:15   ` Jeremie Juste
@ 2020-09-02  6:12     ` Jeremie Juste
  2020-09-02  7:40       ` Thibault Marin
  0 siblings, 1 reply; 10+ messages in thread
From: Jeremie Juste @ 2020-09-02  6:12 UTC (permalink / raw)
  To: emacs-orgmode


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/)


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: latex fragments compilation error when exporting to html
  2020-09-02  6:12     ` Jeremie Juste
@ 2020-09-02  7:40       ` Thibault Marin
  0 siblings, 0 replies; 10+ messages in thread
From: Thibault Marin @ 2020-09-02  7:40 UTC (permalink / raw)
  To: emacs-orgmode

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/)


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-02  7:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).