emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode list <emacs-orgmode@gnu.org>
Subject: Re: latex equation and html export
Date: Wed, 1 Jan 2014 10:11:15 +0100	[thread overview]
Message-ID: <CAD-VTcE7dTTTcN3-Cr+vSVd9BuKKXtcA_EZQ8bm++srV0oQ1Fg@mail.gmail.com> (raw)
In-Reply-To: <87zjng5i7k.fsf@alphaville.bos.redhat.com>

[-- 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 --]

  reply	other threads:[~2014-01-01  9:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-01-01  9:28           ` Achim Gratz
2014-01-01 15:42             ` Nick Dokos

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=CAD-VTcE7dTTTcN3-Cr+vSVd9BuKKXtcA_EZQ8bm++srV0oQ1Fg@mail.gmail.com \
    --to=joseph.vidal.rosset@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndokos@gmail.com \
    /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).