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