From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Popineau Subject: Re: LaTeX math mode and export Date: Sat, 12 Oct 2013 00:03:16 +0200 Message-ID: References: <87d2nb95jm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01633f7e4cbb5504e87e4abd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUkoB-0004Gn-GN for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 18:03:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUko6-0006bC-Db for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 18:03:43 -0400 Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]:53840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUko6-0006b5-3C for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 18:03:38 -0400 Received: by mail-ea0-f172.google.com with SMTP id r16so2191467ead.31 for ; Fri, 11 Oct 2013 15:03:37 -0700 (PDT) In-Reply-To: <87d2nb95jm.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" --089e01633f7e4cbb5504e87e4abd Content-Type: text/plain; charset=ISO-8859-1 > > \[\begin{array}{c} > > \begin{array}{|c|c|c|} > > \hline > > \delta_{1} & 0 & 1 \\ > > \hline > > p & \{p, q\} & \{q\} \\ > > \hline > > q & \{r\} & \{q, r\} \\ > > \hline > > r & \{s\} & \{p\} \\ > > \hline > > s & \{s\} & \{p\} \\ > > \hline > > \end{array} > > \] > > This isn't correct syntax: "\begin{array}{|c|c|c|}...\end{array}" is > parsed as a latex environment, so it breaks the paragraph you started > the line before. You can use "\begin{equation}" instead of "\[". > > I'm not sure why it is not correct : I guess you mean not correct Org syntax? (I broke my example by shortening it, one \end{array} is missing and there used to be other arrays below) The problem as I feel it is that \[ \] works sometimes, but not as often as with LaTeX, which is disconcerting. I know that theparagraph entity in Org mode is different than what it is is in LaTeX, but still. Why \[ ... \] couldn't be handled as if it where \begin{equation} ... \end{equation} ? Is there any other use of \[ that would prevent its detection ? Sorry to be such an hassle, but that would help to smooth the conversion of previous LaTeX files/users to Org. If I fix it and I use #+begin_equation ... #+end_equation , I still hit something with these math delimiters: #+begin_equation \begin{array}{c} \begin{array}{|c|c|c|} \hline \delta_{1} & 0 & 1 \\ \hline p & \{p, q\} & \{q\} \\ \hline q & \{r\} & \{q, r\} \\ \hline r & \{s\} & \{p\} \\ \hline s & \{s\} & \{p\} \\ \hline \end{array} \vspace{1em} \\ (\{p,q,r,s\}, \{0,1\}, \delta_{2}, p, \{q,s\}) \end{array} #+end_equation The last line but two is translated : (\{p,q,r,s\}, \{0,1\}, $\delta$$_{\text{2}}$, p, \{q,s\}) This time, given that we are in an equation environment, things should be left as-is surely? > - \(\min(x,y)\) , \(\max(x,y)\) > > - \(\operatorname{Prime}(x) = \left\{ \begin{array}{cl} 1 & \text{ if } > > x \text{ is prime } \\ 0 & \text{ if } x \text{ is not prime } > > \end{array} \right. \) > > The last line is not correctly indented: it doesn't belong to the last > item and therefore, the math snippets is not recognized. True, didn't notice that it could make a difference, because Org-mode refuses to indent it. I mean I used on all lines and thought that it wasn't indented because it could have been the previous line that was wrapped. Org-mode is able to indent the second line but what is preventing it to indent the third line? > > 2 - Quoting of {} may also happen in unwanted places. If I write a complex > > author line like : > > > > #+AUTHOR: \IEEEauthorblockN{Foo, Bar} \IEEEauthorblockA{ Somewhere\\ Over > > the Rainbow \\ Email: \{foo,bar\}@baz.fr } \and > \IEEEauthorblockN{foobar} > > \IEEEauthorblockA{somewhere else \\ Email: foobar@baz.fr} > > You cannot write raw non-math LaTeX in an Org buffer (unless it is also > an entity). You ought to use export snippets, i.e., @@latex:...@@. Ok. I understand that curly braces in plain text need to be backslahed in LaTeX. But again what is surprising is that the backslash itself in \IEEEAuthorBlockA and \IEEEAuthorBlockN are not translated to LaTeX syntax. Actually, it is only the second curly brace that gets backslashed, not even the first one. > Another related question also : did anybody managed to hilghlight LaTeX > > equations inside org-mode ? > > See `org-highlight-latex-and-related'. > > I hope my comments do not seem too rude. I try to report the feeling of someone who doesn't know the internals. I think that the less suprised the user is, the more it is willing to accept the tool. In the area of maths delimiters, I start to wonder if Org-mode doesn't push too far its guessing of what the user had intended. But maybe I don't see the whole picture. Thanks a lot for your help and your work, -- Fabrice --089e01633f7e4cbb5504e87e4abd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

=
> \[\begin{array}{c}
> =A0 \begin{array}{|c|c|c|}
> =A0 =A0 \hline
> =A0 =A0 \delta_{1} & 0 & =A01 \\
> =A0 =A0 \hline
> =A0 =A0 p & \{p, q\} & \{q\} \\
> =A0 =A0 \hline
> =A0 =A0 q & \{r\} & \{q, r\} \\
> =A0 =A0 \hline
> =A0 =A0 r & \{s\} & \{p\} \\
> =A0 =A0 \hline
> =A0 =A0 s & \{s\} & \{p\} \\
> =A0 =A0 \hline
> =A0 \end{array}
> \]

This isn't correct syntax: "\begin{array}{|c|c|c|}...\end{ar= ray}" is
parsed as a latex environment, so it breaks the paragraph you started
the line before. You can use "\begin{equation}" instead of "= \[".


I'm not su= re why it is not correct : I guess you mean not correct Org syntax?
(I broke my example by shortening it, one \end{array} is missing and the= re used
to be other arrays below)
The problem as I feel it is that \= [ \] =A0works sometimes, but not as =A0often as with LaTeX,
which= is disconcerting.

I know that theparagraph entity= in Org mode is different than what it is is in LaTeX, but still.

Why \[ ... \] couldn't be handled as if it where \b= egin{equation} ... \end{equation} ?
Is there any other use of \[ = that would prevent its detection ?

Sorry to be suc= h an hassle, but that would help to smooth the conversion of previous LaTeX= files/users
to Org.

If I fix it and I use #+begin_equatio= n ... #+end_equation , I still hit something with these math delimiters:

#+begin_equation
=A0\begin{array}{c}<= /div>
=A0 =A0\begin{array}{|c|c|c|}
=A0 =A0\hline
=A0 = =A0\delta_{1} & 0 & =A01 \\
=A0 =A0\hline
=A0 = =A0p & \{p, q\} & \{q\} \\
=A0 =A0\hline
=A0 = =A0q & \{r\} & \{q, r\} \\
=A0 =A0\hline
=A0 =A0r & \{s\} & \{p\} \\
= =A0 =A0\hline
=A0 =A0s & \{s\} & \{p\} \\
=A0 = =A0\hline
=A0 =A0\end{array}
=A0 \vspace{1em} \\
<= div>=A0 (\{p,q,r,s\}, \{0,1\}, =A0\delta_{2}, p, \{q,s\})
=A0 \end{array} =A0
=A0 #+end_equation

<= /div>
The last line but two is translated :

=A0 (\{p,q,r,s\}, \{0,1\}, =A0$\delta$$_{\text{2}}$, p, \{q,s\})

This time, given that we are in an equation environment, thi= ngs should be left as-is surely?

> - \(\min(x,y)\) , \(\max(x,y)\)
> - \(\operatorname{Prime}(x) =3D \left\{ \begin{array}{cl} 1 & \tex= t{ if }
> =A0 x \text{ is prime } \\ 0 & \text{ if } x \text{ is not prime }=
> \end{array} \right. \)

The last line is not correctly indented: it doesn't belong to the= last
item and therefore, the math snippets is not recognized.
<= br>
True, didn't notice that it could make a difference, beca= use Org-mode refuses to indent it.=A0
I mean I used <Tab> o= n all lines and thought that it wasn't indented because it could have
been the previous line that was wrapped. Org-mode is able to indent th= e second line but
what is preventing it to indent the third line?=
=A0
> 2 - Quoting of {} may also happen in unwanted places. If I write a com= plex
> author line like :
>
> #+AUTHOR: \IEEEauthorblockN{Foo, Bar} \IEEEauthorblockA{ Somewhere\\ O= ver
> the Rainbow \\ Email: \{foo,bar\}@baz.fr } \and \IEEEauthorblockN{foobar}
> \IEEEauthorblockA{somewhere else \\ Email: foobar@baz.fr}

You cannot write raw non-math LaTeX in an Org buffer (unless it is al= so
an entity). You ought to use export snippets, i.e., @@latex:...@@.

Ok. I understand that curly braces in plain text ne= ed to be backslahed in LaTeX.
But again what is surprising is tha= t the backslash itself
in \IEEEAuthorBlockA and \IEEEAuthorBlockN are not translated to LaTeX= syntax.
Actually, it is only the second curly brace that gets ba= ckslashed, not even the first
one.

=A0
> Another related question also : did anybody managed to hilghlight LaTe= X
> equations inside org-mode ?

See `org-highlight-latex-and-related'.

= =A0
I hope my comments do not seem too rude. I try to report the = feeling of someone
who doesn't know the internals. I think th= at the less suprised the user is, the more it is=A0
willing to accept the tool. In the area of maths delimiters, I start t= o wonder if Org-mode doesn't push too far=A0
its guessing of = what the user had intended. But maybe I don't see the whole picture.

Thanks a lot for your help and your work,

--
Fabrice
--089e01633f7e4cbb5504e87e4abd--