emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex equation and html export
@ 2013-12-30 12:52 Joseph Vidal-Rosset
  2013-12-30 16:25 ` Thomas S. Dye
  0 siblings, 1 reply; 10+ messages in thread
From: Joseph Vidal-Rosset @ 2013-12-30 12:52 UTC (permalink / raw)
  To: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Hello everyone,

With numbered equation, I do not succeed to get a code working both for
LateX export AND html export .

For example this code:

#+BEGIN_LaTeX
\begin{equation}
\label{eq:2}
A \to \neg B
\end{equation}
#+END_LaTeX

works fine in org-mode : latex syntax is highleted and the export to pdf
works. But it does not work with html export: the formula does not appear.

Same problem also for footnotes and reference with biblatex... : I do not
see the conversion.

Your help is welcome.

Best wishes

Jo.

[-- Attachment #2: Type: text/html, Size: 812 bytes --]

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

* Re: latex equation and html export
  2013-12-30 12:52 latex equation and html export Joseph Vidal-Rosset
@ 2013-12-30 16:25 ` Thomas S. Dye
  2013-12-30 18:03   ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2013-12-30 16:25 UTC (permalink / raw)
  To: Joseph Vidal-Rosset; +Cc: emacs-orgmode list

Aloha Joseph,

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> With numbered equation, I do not succeed to get a code working both for
> LateX export AND html export .
>
> For example this code:
>
> #+BEGIN_LaTeX
> \begin{equation}
> \label{eq:2}
> A \to \neg B
> \end{equation}
> #+END_LaTeX
>
> works fine in org-mode : latex syntax is highleted and the export to pdf
> works. But it does not work with html export: the formula does not appear.
>

Your code is targeted to the LaTeX back-end and should be ignored by
other back-ends (as you've discovered).

Something like this might do what you want:

#+NAME: eq:2
#+BEGIN_EQUATION
A \to \neg B
#+END_EQUATION

See Section 11.8 of the manual, Special Blocks.

hth,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: latex equation and html export
  2013-12-30 16:25 ` Thomas S. Dye
@ 2013-12-30 18:03   ` Joseph Vidal-Rosset
  2013-12-30 18:53     ` Thomas S. Dye
  0 siblings, 1 reply; 10+ messages in thread
From: Joseph Vidal-Rosset @ 2013-12-30 18:03 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

Hi Thomas,

Thanks for your reply and your help !

2013/12/30 Thomas S. Dye <tsd@tsdye.com>

> #+NAME: eq:2
> #+BEGIN_EQUATION
> A \to \neg B
> #+END_EQUATION
>

Unfortunately, this code does not give a good translation in latex , here
is the result in the tex file:

\begin{equation}
\label{eq:2}
A [image: \to] [image: \neg{}] B
\end{equation}

Maybe you won't see in my email that there are 4 $ in this formula, and
that is not accepted in equation environnment. So the pfd generation fails.

It works bette in html, but the equation is neither in center, nor
numbered.

Another suggestion ?



Best wishes and happy end of year !

Jo.

[-- Attachment #2: Type: text/html, Size: 2024 bytes --]

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

* Re: latex equation and html export
  2013-12-30 18:03   ` Joseph Vidal-Rosset
@ 2013-12-30 18:53     ` Thomas S. Dye
  2013-12-30 20:10       ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2013-12-30 18:53 UTC (permalink / raw)
  To: Joseph Vidal-Rosset; +Cc: emacs-orgmode list

Aloha Joseph,

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> Unfortunately, this code does not give a good translation in latex , here
> is the result in the tex file:
>
> \begin{equation}
> \label{eq:2}
> A [image: \to] [image: \neg{}] B
> \end{equation}

I get this LaTeX, which works as expected:

\begin{equation}
\label{eq:2}
A \(\to\) \(\neg{}\) B
\end{equation}
% Emacs 24.3.1 (Org mode 8.2.4)

Also, IIUC the Org mode manual at section 11.8, the HTML back-end wraps
its contents within a `<div name="equation">' tag (although I get <div
class="equation">). I don't work with HTML export much, but I believe
this is what you need to format the output with a style sheet.

hth,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

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

* Re: latex equation and html export
  2013-12-30 18:53     ` Thomas S. Dye
@ 2013-12-30 20:10       ` Joseph Vidal-Rosset
  2013-12-30 21:30         ` Thomas S. Dye
  2014-01-01  6:28         ` Nick Dokos
  0 siblings, 2 replies; 10+ messages in thread
From: Joseph Vidal-Rosset @ 2013-12-30 20:10 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

2013/12/30 Thomas S. Dye <tsd@tsdye.com>

>  get this LaTeX, which works as expected:
>
> \begin{equation}
> \label{eq:2}
> A [image: \to] [image: \neg{}] B
> \end{equation}
> % Emacs 24.3.1 (Org mode 8.2.4)
>

Bonsoir Thomas,

Indeed, the code works correctly. I do not understand why
 #+NAME: eq:2
#+BEGIN_EQUATION

#+END_EQUATION
does not produce the same thing when I export it into latex.

I have this list of preambules:

# -*- Mode:org; mode:reftex; coding:utf-8  -*-
#+OPTIONS:   H:5 num:t toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
#+OPTIONS: tex:verbatim
#+LaTeX_CLASS: koma-article
#+LaTeX_CLASS_OPTIONS: [koma,a4paper]
#+LANGUAGE:  en
#+LATEX_HEADER: \usepackage[AUTO]{inputenc}
#+LATEX_HEADER: \usepackage[hyperref,x11names]{xcolor}
#+LATEX_HEADER:
\usepackage[colorlinks=true,urlcolor=SteelBlue4,linkcolor=Firebrick4]{hyperref}
#+LaTeX_HEADER: \usepackage[backend=biber,style=verbose]{biblatex}
#+LaTeX_HEADER: \bibliography{jvr-biblatex-references.bib}
#+LaTeX_HEADER: \usepackage{bussproofs}
#+LaTeX_HEADER: \usepackage{amsmath,amssymb,amsopn}
#+LaTeX_HEADER: \usepackage{fitch}
#+OPTIONS: tex:verbatim
#+HTML_MATHJAX: align:"left" mathml:t path:"/MathJax/MathJax.js"
#+OPTIONS: tex:imagemagick

Could you send to me your configuration files and your preambles please, it
would be certainly helpful.

In advance thanks,

Best wishes,

Jo.

[-- Attachment #2: Type: text/html, Size: 5906 bytes --]

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

* Re: latex equation and html export
  2013-12-30 20:10       ` Joseph Vidal-Rosset
@ 2013-12-30 21:30         ` Thomas S. Dye
  2014-01-01  6:28         ` Nick Dokos
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas S. Dye @ 2013-12-30 21:30 UTC (permalink / raw)
  To: Joseph Vidal-Rosset; +Cc: emacs-orgmode list

Aloha Jo,

I believe this should work "out of the box," but others on the list
might be able to give you better advice on debugging.

The instructions here might be useful:

http://orgmode.org/manual/Feedback.html

All the best,
Tom

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> Could you send to me your configuration files and your preambles please, it
> would be certainly helpful.

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: latex equation and html export
  2013-12-30 20:10       ` Joseph Vidal-Rosset
  2013-12-30 21:30         ` Thomas S. Dye
@ 2014-01-01  6:28         ` Nick Dokos
  2014-01-01  9:11           ` Joseph Vidal-Rosset
  2014-01-01  9:28           ` Achim Gratz
  1 sibling, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2014-01-01  6:28 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> 2013/12/30 Thomas S. Dye <tsd@tsdye.com>
>
>     get this LaTeX, which works as expected:
>    
>     \begin{equation}
>     \label{eq:2}
>     A \to      \neg{}   B
>     \end{equation}
>     % Emacs 24.3.1 (Org mode 8.2.4)
>
> Bonsoir Thomas,
>
> Indeed, the code works correctly. I do not understand why
>  #+NAME: eq:2
> #+BEGIN_EQUATION
>
> #+END_EQUATION
> does not produce the same thing when I export it into latex. 
>
> I have this list of preambules: 
>
...snip...
>
> Could you send to me your configuration files and your preambles please, it would be certainly helpful. 
>

The best way to proceed is to start with *no* configuration at all:
start with a minimal init file that just loads org and sets up the
absolute minimum. Then try the exports. Here is my minimal file,
min.org.el, although you will need to modify the paths to suit your environment:

--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path "~/src/emacs/org/org-mode/lisp")
(add-to-list 'load-path "~/src/emacs/org/org-mode/contib/lisp")

(require 'org-loaddefs)

(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)

--8<---------------cut here---------------end--------------->8---

I start emacs like this to use it:

   emacs -q -l /path/to/min.org.el


Then try exporting a small example like this:

--8<---------------cut here---------------start------------->8---
* Numbered displayed equations

#+BEGIN_EQUATION
A \to \neg B
#+END_EQUATION
--8<---------------cut here---------------end--------------->8---

This example works for both latex and html export for me but it's
somewhat misleading: both \to and \neg are org entities and they
go through the org-entity translation which produces this
for html:

,----
| <p>
| A &rarr; &not; B
| </p>
`----

and this for latex:

,----
| \begin{equation}
| A \(\to\) \(\neg{}\) B
| \end{equation}
`----

[The latex result could be simplified in this particular case: because
it's in an equation environment, TeX is already in math mode so the
inline delimiters \(...\) could be deleted, as could the {} - which I
think is unnecessary in any case for \neg - or any entity that requires
tex math mode. But since org does not know that TeX is in math mode, it
just makes sure by using \(..\) - it would probably be better to use
\ensuremath but that's a nit].

But let's take a look at something that is not just org-entities.
Here is the square root of pi divided by 2 in latex:

--8<---------------cut here---------------start------------->8---
#+BEGIN_EQUATION
\frac{\sqrt\pi}{2}
#+END_EQUATION
--8<---------------cut here---------------end--------------->8---

Exporting that to latex gives

,----
| \begin{equation}
| \frac{\sqrt\pi}{2}
| \end{equation}
`----

and to html:


,----
| <div class="equation">
| <p>
| \frac{\sqrt\pi}{2}
| </p>
| 
| </div>
`----

The latex result is perfect, but the html result is a disaster.  The
reason for that is that the special EQUATION block is translated by the
latex exporter to a reasonable latex construct, but the html exporter
does not have a similar html construct at its disposal: so it does the
generic thing and adds an equation div around it - which accomplishes
nothing.

OTOH, if you are using mathjax for displaying math in html (which is
the default for the html exporter), then I think going whole-hog to
latex notation works better. Using this in your org file

--8<---------------cut here---------------start------------->8---
\begin{equation}
\frac{\sqrt\pi}{2}
\end{equation}
--8<---------------cut here---------------end--------------->8---

does the right thing for both latex and html (with mathjax) export.  And
you can add a mathjax option to org-html-mathjax-template to produce
numbered equations (and omit the number with
\begin{equation*}...\end{equation*} just as in latex).

I may be missing something but using a BEGIN/END_EQUATION special block
just does not seem to do the right thing for both latex and html (let
alone any other backend, which is not handled by the other method either).

I should point out that using

--8<---------------cut here---------------start------------->8---
#+BEGIN_EQUATION
\[
\frac{\sqrt\pi}{2}
\]
#+END_EQUATION
--8<---------------cut here---------------end--------------->8---

with html/mathjax does the right thing (except for not numbering the
equation): the \[...\] delimiters signal mathjax to process the math
inside. But they break latex in the sense that you no longer get a
numbered equation.

So if you want latex and html export to do right by your math, I would
recommend the

--8<---------------cut here---------------start------------->8---
\begin{equation}
   ...   
\end{equation}
--8<---------------cut here---------------end--------------->8---

form.

All this is with latest org. org-7.x is probably different but I have
not gone back to check. And if I've got things wrong, I'd love to be
corrected.

Nick

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

* Re: latex equation and html export
  2014-01-01  6:28         ` Nick Dokos
@ 2014-01-01  9:11           ` Joseph Vidal-Rosset
  2014-01-01  9:28           ` Achim Gratz
  1 sibling, 0 replies; 10+ messages in thread
From: Joseph Vidal-Rosset @ 2014-01-01  9:11 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 6271 bytes --]

Dear Nick,

Many thanks to have taken time of writing this long email to try to help
me. That's very kind of you.

Here are my results.

If I want to use MathJax , I have to write something like

\[

equation

\]

it works well in my computer. For labelling, I should follow this
documentation:

http://orgmode.org/worg/org-tutorials/org-jsmath.html

but I do not succeed to write correctly the loadFile code in my org file.
Your help is welcome.

Nevertheless, I am afraid to give up the hope to use only MathJax. Reason:
in LaTeX there are a lot of very useful packages  for logicians , like
bussproofs, fitch, and so on, and I am not stronger enough to adapt them in
oder to use them both with MathJax and with LaTeX. But Imagemagick seems
doing the right thing.

Again, happy new year and thanks for your kind help.

Jo.


2014/1/1 Nick Dokos <ndokos@gmail.com>

> Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:
>
> > 2013/12/30 Thomas S. Dye <tsd@tsdye.com>
> >
> >     get this LaTeX, which works as expected:
> >
> >     \begin{equation}
> >     \label{eq:2}
> >     A \to      \neg{}   B
> >     \end{equation}
> >     % Emacs 24.3.1 (Org mode 8.2.4)
> >
> > Bonsoir Thomas,
> >
> > Indeed, the code works correctly. I do not understand why
> >  #+NAME: eq:2
> > #+BEGIN_EQUATION
> >
> > #+END_EQUATION
> > does not produce the same thing when I export it into latex.
> >
> > I have this list of preambules:
> >
> ...snip...
> >
> > Could you send to me your configuration files and your preambles please,
> it would be certainly helpful.
> >
>
> The best way to proceed is to start with *no* configuration at all:
> start with a minimal init file that just loads org and sets up the
> absolute minimum. Then try the exports. Here is my minimal file,
> min.org.el, although you will need to modify the paths to suit your
> environment:
>
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'load-path "~/src/emacs/org/org-mode/lisp")
> (add-to-list 'load-path "~/src/emacs/org/org-mode/contib/lisp")
>
> (require 'org-loaddefs)
>
> (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
>
> (global-set-key "\C-cl" 'org-store-link)
> (global-set-key "\C-cc" 'org-capture)
> (global-set-key "\C-ca" 'org-agenda)
>
> --8<---------------cut here---------------end--------------->8---
>
> I start emacs like this to use it:
>
>    emacs -q -l /path/to/min.org.el
>
>
> Then try exporting a small example like this:
>
> --8<---------------cut here---------------start------------->8---
> * Numbered displayed equations
>
> #+BEGIN_EQUATION
> A \to \neg B
> #+END_EQUATION
> --8<---------------cut here---------------end--------------->8---
>
> This example works for both latex and html export for me but it's
> somewhat misleading: both \to and \neg are org entities and they
> go through the org-entity translation which produces this
> for html:
>
> ,----
> | <p>
> | A &rarr; &not; B
> | </p>
> `----
>
> and this for latex:
>
> ,----
> | \begin{equation}
> | A \(\to\) \(\neg{}\) B
> | \end{equation}
> `----
>
> [The latex result could be simplified in this particular case: because
> it's in an equation environment, TeX is already in math mode so the
> inline delimiters \(...\) could be deleted, as could the {} - which I
> think is unnecessary in any case for \neg - or any entity that requires
> tex math mode. But since org does not know that TeX is in math mode, it
> just makes sure by using \(..\) - it would probably be better to use
> \ensuremath but that's a nit].
>
> But let's take a look at something that is not just org-entities.
> Here is the square root of pi divided by 2 in latex:
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_EQUATION
> \frac{\sqrt\pi}{2}
> #+END_EQUATION
> --8<---------------cut here---------------end--------------->8---
>
> Exporting that to latex gives
>
> ,----
> | \begin{equation}
> | \frac{\sqrt\pi}{2}
> | \end{equation}
> `----
>
> and to html:
>
>
> ,----
> | <div class="equation">
> | <p>
> | \frac{\sqrt\pi}{2}
> | </p>
> |
> | </div>
> `----
>
> The latex result is perfect, but the html result is a disaster.  The
> reason for that is that the special EQUATION block is translated by the
> latex exporter to a reasonable latex construct, but the html exporter
> does not have a similar html construct at its disposal: so it does the
> generic thing and adds an equation div around it - which accomplishes
> nothing.
>
> OTOH, if you are using mathjax for displaying math in html (which is
> the default for the html exporter), then I think going whole-hog to
> latex notation works better. Using this in your org file
>
> --8<---------------cut here---------------start------------->8---
> \begin{equation}
> \frac{\sqrt\pi}{2}
> \end{equation}
> --8<---------------cut here---------------end--------------->8---
>
> does the right thing for both latex and html (with mathjax) export.  And
> you can add a mathjax option to org-html-mathjax-template to produce
> numbered equations (and omit the number with
> \begin{equation*}...\end{equation*} just as in latex).
>
> I may be missing something but using a BEGIN/END_EQUATION special block
> just does not seem to do the right thing for both latex and html (let
> alone any other backend, which is not handled by the other method either).
>
> I should point out that using
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_EQUATION
> \[
> \frac{\sqrt\pi}{2}
> \]
> #+END_EQUATION
> --8<---------------cut here---------------end--------------->8---
>
> with html/mathjax does the right thing (except for not numbering the
> equation): the \[...\] delimiters signal mathjax to process the math
> inside. But they break latex in the sense that you no longer get a
> numbered equation.
>
> So if you want latex and html export to do right by your math, I would
> recommend the
>
> --8<---------------cut here---------------start------------->8---
> \begin{equation}
>    ...
> \end{equation}
> --8<---------------cut here---------------end--------------->8---
>
> form.
>
> All this is with latest org. org-7.x is probably different but I have
> not gone back to check. And if I've got things wrong, I'd love to be
> corrected.
>
> Nick
>
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 8146 bytes --]

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

* Re: latex equation and html export
  2014-01-01  6:28         ` Nick Dokos
  2014-01-01  9:11           ` Joseph Vidal-Rosset
@ 2014-01-01  9:28           ` Achim Gratz
  2014-01-01 15:42             ` Nick Dokos
  1 sibling, 1 reply; 10+ messages in thread
From: Achim Gratz @ 2014-01-01  9:28 UTC (permalink / raw)
  To: emacs-orgmode

Am 01.01.2014 07:28, schrieb Nick Dokos:
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'load-path "~/src/emacs/org/org-mode/lisp")
> (add-to-list 'load-path "~/src/emacs/org/org-mode/contib/lisp")

There is usually no point to include contrib in a minimal Org init, but 
if you need it, it should not be first in load-path (that is, the two 
lines above should be reversed and the directory name be "contrib").


-- 
Achim.

(on the road :-)

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

* Re: latex equation and html export
  2014-01-01  9:28           ` Achim Gratz
@ 2014-01-01 15:42             ` Nick Dokos
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2014-01-01 15:42 UTC (permalink / raw)
  To: emacs-orgmode

Achim Gratz <Stromeko@Nexgo.DE> writes:

> Am 01.01.2014 07:28, schrieb Nick Dokos:
>> --8<---------------cut here---------------start------------->8---
>> (add-to-list 'load-path "~/src/emacs/org/org-mode/lisp")
>> (add-to-list 'load-path "~/src/emacs/org/org-mode/contib/lisp")
>
> There is usually no point to include contrib in a minimal Org init,
> but if you need it, it should not be first in load-path (that is, the
> two lines above should be reversed and the directory name be
> "contrib").

True - I guess the misspelling saved me from any troubles that contrib
could have caused :-) My minimal file now starts like this:

--8<---------------cut here---------------start------------->8---
;(add-to-list 'load-path "~/src/emacs/org/org-mode/contrib/lisp")
(add-to-list 'load-path "~/src/emacs/org/org-mode/lisp")

(require 'org-loaddefs)
...
--8<---------------cut here---------------end--------------->8---

If I need contrib, I can just uncomment the first line.

Thanks,
Nick

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

end of thread, other threads:[~2014-01-01 15:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-30 12:52 latex equation and html export Joseph Vidal-Rosset
2013-12-30 16:25 ` Thomas S. Dye
2013-12-30 18:03   ` Joseph Vidal-Rosset
2013-12-30 18:53     ` Thomas S. Dye
2013-12-30 20:10       ` Joseph Vidal-Rosset
2013-12-30 21:30         ` Thomas S. Dye
2014-01-01  6:28         ` Nick Dokos
2014-01-01  9:11           ` Joseph Vidal-Rosset
2014-01-01  9:28           ` Achim Gratz
2014-01-01 15:42             ` Nick Dokos

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