emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex environment inside math mode problem
@ 2015-01-19 23:29 Marko Schütz Schmuck
  2015-01-20  1:30 ` Nick Dokos
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Marko Schütz Schmuck @ 2015-01-19 23:29 UTC (permalink / raw)
  To: Orgmode Mailing List

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

Dear All,

the new exporter does not seem to handle \begin/\end inside \( ... \).

If the org file contains

    \(f =
      \begin{cases}
      t & 1\\
      f & 2\\
      \end{cases}
    \)

the resulting tex file contains

$\backslash$(f =
\begin{cases}
t & 1\\
f & 2\\
\end{cases}
$\backslash$)

Is there a known fix or workaround?

Thanks and best regards,

Marko

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: latex environment inside math mode problem
  2015-01-19 23:29 latex environment inside math mode problem Marko Schütz Schmuck
@ 2015-01-20  1:30 ` Nick Dokos
  2015-01-20  3:44   ` Marko Schütz Schmuck
  2015-01-20  1:33 ` John Kitchin
  2015-01-20 11:10 ` Rasmus
  2 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2015-01-20  1:30 UTC (permalink / raw)
  To: emacs-orgmode

Marko Schütz Schmuck <MarkoSchuetz@web.de> writes:

> Dear All,
>
> the new exporter does not seem to handle \begin/\end inside \( ... \).
>
> If the org file contains
>
>     \(f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
>     \)
>
> the resulting tex file contains
>
> $\backslash$(f =
> \begin{cases}
> t & 1\\
> f & 2\\
> \end{cases}
> $\backslash$)
>
> Is there a known fix or workaround?
>

My guess is that inline math is recognized as such by the latex exporter
only if the closing delimiter is on the same line as the opening
delimiter. Try

    \(f = \begin{cases} t & 1\\ f & 2\\ \end{cases} \)

-- 
Nick

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

* Re: latex environment inside math mode problem
  2015-01-19 23:29 latex environment inside math mode problem Marko Schütz Schmuck
  2015-01-20  1:30 ` Nick Dokos
@ 2015-01-20  1:33 ` John Kitchin
  2015-01-20  3:34   ` Marko Schütz Schmuck
  2015-01-20 11:10 ` Rasmus
  2 siblings, 1 reply; 9+ messages in thread
From: John Kitchin @ 2015-01-20  1:33 UTC (permalink / raw)
  To: Marko Schütz Schmuck; +Cc: Orgmode Mailing List

#+BEGIN_LaTeX
    f =
      \begin{cases}
      t & 1\\
      f & 2\\
      \end{cases}
#+END_LaTeX

seems to work.

Marko Schütz Schmuck writes:

> Dear All,
>
> the new exporter does not seem to handle \begin/\end inside \( ... \).
>
> If the org file contains
>
>     \(f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
>     \)
>
> the resulting tex file contains
>
> $\backslash$(f =
> \begin{cases}
> t & 1\\
> f & 2\\
> \end{cases}
> $\backslash$)
>
> Is there a known fix or workaround?
>
> Thanks and best regards,
>
> Marko

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: latex environment inside math mode problem
  2015-01-20  1:33 ` John Kitchin
@ 2015-01-20  3:34   ` Marko Schütz Schmuck
  2015-01-20  8:48     ` Eric S Fraga
  0 siblings, 1 reply; 9+ messages in thread
From: Marko Schütz Schmuck @ 2015-01-20  3:34 UTC (permalink / raw)
  To: John Kitchin; +Cc: Orgmode Mailing List

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

At Mon, 19 Jan 2015 20:33:50 -0500,
John Kitchin wrote:
> 
> #+BEGIN_LaTeX
>     f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
> #+END_LaTeX
> 
> seems to work.

almost: whether I use your suggestion or 
 
#+BEGIN_LaTeX
    \(f =
      \begin{cases}
      t & 1\\
      f & 2\\
      \end{cases}
    \)
#+END_LaTeX

the itemize environment in which it occurs ends before the inline math.

> Marko Schütz Schmuck writes:
> 
> > Dear All,
> >
> > the new exporter does not seem to handle \begin/\end inside \( ... \).
> >
> > If the org file contains
> >
> >     \(f =
> >       \begin{cases}
> >       t & 1\\
> >       f & 2\\
> >       \end{cases}
> >     \)
> >
> > the resulting tex file contains
> >
> > $\backslash$(f =
> > \begin{cases}
> > t & 1\\
> > f & 2\\
> > \end{cases}
> > $\backslash$)
> >
> > Is there a known fix or workaround?
> >
> > Thanks and best regards,
> >
> > Marko
> 
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: latex environment inside math mode problem
  2015-01-20  1:30 ` Nick Dokos
@ 2015-01-20  3:44   ` Marko Schütz Schmuck
  0 siblings, 0 replies; 9+ messages in thread
From: Marko Schütz Schmuck @ 2015-01-20  3:44 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

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

At Mon, 19 Jan 2015 20:30:51 -0500,
Nick Dokos wrote:
> 
> Marko Schütz Schmuck <MarkoSchuetz@web.de> writes:
> 
> > Dear All,
> >
> > the new exporter does not seem to handle \begin/\end inside \( ... \).
> >
> > If the org file contains
> >
> >     \(f =
> >       \begin{cases}
> >       t & 1\\
> >       f & 2\\
> >       \end{cases}
> >     \)
> >
> > the resulting tex file contains
> >
> > $\backslash$(f =
> > \begin{cases}
> > t & 1\\
> > f & 2\\
> > \end{cases}
> > $\backslash$)
> >
> > Is there a known fix or workaround?
> >
> 
> My guess is that inline math is recognized as such by the latex exporter
> only if the closing delimiter is on the same line as the opening
> delimiter. Try
> 
>     \(f = \begin{cases} t & 1\\ f & 2\\ \end{cases} \)

It recognized inline math across multiple lines without the cases
environment inside. It also recognizes your suggestion. Thanks for the
suggestion, but I hesitate to apply it to the real inline math
environments that I have, it would obfuscate the code quite a bit...

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: latex environment inside math mode problem
  2015-01-20  3:34   ` Marko Schütz Schmuck
@ 2015-01-20  8:48     ` Eric S Fraga
  2015-01-20 11:51       ` Marko Schütz Schmuck
  0 siblings, 1 reply; 9+ messages in thread
From: Eric S Fraga @ 2015-01-20  8:48 UTC (permalink / raw)
  To: Marko Schütz Schmuck; +Cc: Orgmode Mailing List, John Kitchin

On Monday, 19 Jan 2015 at 23:34, Marko Schütz Schmuck wrote:

[...]

> almost: whether I use your suggestion or 
>  
>
> #+BEGIN_LaTeX
>     \(f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
>     \)
> #+END_LaTeX
>
> the itemize environment in which it occurs ends before the inline math.

Indent the #+ directives and they won't break the list:

--8<---------------cut here---------------start------------->8---
* Test
1. an item
   #+BEGIN_LaTeX
    \(f =
      \begin{cases}
      t & 1\\
      f & 2\\
      \end{cases}
    \)
   #+END_LaTeX
2. a second item
--8<---------------cut here---------------end--------------->8---


-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-721-gd1c5dc.dirty

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

* Re: latex environment inside math mode problem
  2015-01-19 23:29 latex environment inside math mode problem Marko Schütz Schmuck
  2015-01-20  1:30 ` Nick Dokos
  2015-01-20  1:33 ` John Kitchin
@ 2015-01-20 11:10 ` Rasmus
  2015-01-20 11:57   ` Nicolas Goaziou
  2 siblings, 1 reply; 9+ messages in thread
From: Rasmus @ 2015-01-20 11:10 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: mail

Hi,

Marko Schütz Schmuck <MarkoSchuetz@web.de> writes:

> the new exporter does not seem to handle \begin/\end inside \( ... \).
>
> If the org file contains
>
>     \(f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
>     \)

This will also work:

\(f = \begin{cases}
      t & 1\\
      f & 2\\
      \end{cases}\)


Technically, I think what happens is that latex-fragments are "objects" in
the lingo of org-element whereas environments are elements.  If you run
(org-element-latex-fragment-parser) at "\(f" it is indeed interpret
correctly as a latex-fragment.  Yet, the nested environment is recognized
as a latex-environment and it seems the former can't "hold" the latter.
Why the above work is because a latex-environment starts on its own line
(cf.  org-element--latex-begin-environment).

Nicolas will be able to tell if this is a feature or a bug.

—Rasmus

-- 
. . . The proofs are technical in nature and provides no real understanding

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

* Re: latex environment inside math mode problem
  2015-01-20  8:48     ` Eric S Fraga
@ 2015-01-20 11:51       ` Marko Schütz Schmuck
  0 siblings, 0 replies; 9+ messages in thread
From: Marko Schütz Schmuck @ 2015-01-20 11:51 UTC (permalink / raw)
  To: Marko Schütz Schmuck, John Kitchin, Orgmode Mailing List

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

At Tue, 20 Jan 2015 08:48:29 +0000,
Eric S Fraga wrote:
> 
> On Monday, 19 Jan 2015 at 23:34, Marko Schütz Schmuck wrote:
> 
> [...]
> 
> > almost: whether I use your suggestion or 
> >  
> >
> > #+BEGIN_LaTeX
> >     \(f =
> >       \begin{cases}
> >       t & 1\\
> >       f & 2\\
> >       \end{cases}
> >     \)
> > #+END_LaTeX
> >
> > the itemize environment in which it occurs ends before the inline math.
> 
> Indent the #+ directives and they won't break the list:

yes! Thanks


> --8<---------------cut here---------------start------------->8---
> * Test
> 1. an item
>    #+BEGIN_LaTeX
>     \(f =
>       \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}
>     \)
>    #+END_LaTeX
> 2. a second item
> --8<---------------cut here---------------end--------------->8---
> 
> 
> -- 
> : Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-721-gd1c5dc.dirty

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: latex environment inside math mode problem
  2015-01-20 11:10 ` Rasmus
@ 2015-01-20 11:57   ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2015-01-20 11:57 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Marko Schütz Schmuck <MarkoSchuetz@web.de> writes:
>
>> the new exporter does not seem to handle \begin/\end inside \( ... \).
>>
>> If the org file contains
>>
>>     \(f =
>>       \begin{cases}
>>       t & 1\\
>>       f & 2\\
>>       \end{cases}
>>     \)
>
> This will also work:
>
> \(f = \begin{cases}
>       t & 1\\
>       f & 2\\
>       \end{cases}\)
>
>
> Technically, I think what happens is that latex-fragments are "objects" in
> the lingo of org-element whereas environments are elements.  If you run
> (org-element-latex-fragment-parser) at "\(f" it is indeed interpret
> correctly as a latex-fragment.  Yet, the nested environment is recognized
> as a latex-environment and it seems the former can't "hold" the latter.
> Why the above work is because a latex-environment starts on its own line
> (cf.  org-element--latex-begin-environment).

That's correct. Elements bind stronger than objects.

> Nicolas will be able to tell if this is a feature or a bug.

This is per Org syntax.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-01-20 11:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 23:29 latex environment inside math mode problem Marko Schütz Schmuck
2015-01-20  1:30 ` Nick Dokos
2015-01-20  3:44   ` Marko Schütz Schmuck
2015-01-20  1:33 ` John Kitchin
2015-01-20  3:34   ` Marko Schütz Schmuck
2015-01-20  8:48     ` Eric S Fraga
2015-01-20 11:51       ` Marko Schütz Schmuck
2015-01-20 11:10 ` Rasmus
2015-01-20 11:57   ` Nicolas Goaziou

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