emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: latex nested environments are failed on preview and export [9.3.8 (9.3.8-1-g13dfab-elpaplus @ /home/sd/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200914/)]
@ 2020-09-20 20:32 Сергей Олегович
  2020-09-20 22:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Сергей Олегович @ 2020-09-20 20:32 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1221 bytes --]

I want to use a matrix environment that is included in an outer
environment, so:

```
Environment:
\begin{equation*}
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
\end{equation*}

Display--math:
\[
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
\]

Inline--math:
\(
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
\)
```

But for the second and third cases (display-math and inline-math) the
preview and export to latex are failed:

exported LaTeX:

```
Environment:
\begin{equation*}
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
\end{equation*}

Display--math:
$\backslash$[
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
$\backslash$]

Inline--math:
$\backslash$(
\left|
\begin{matrix}
a_1 & b_1\\
a_2 & b_2
\end{matrix}
\right|
$\backslash$)
\end{document}
```

org-mode preview:

[image: preview.png]

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
 of 2020-03-26, modified by Debian
Package: Org mode version 9.3.8 (9.3.8-1-g13dfab-elpaplus @
/home/sd/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200914/)

It is reproduces with Org mode 9.4 also
https://emacs.stackexchange.com/q/60765/13323

[-- Attachment #1.2: Type: text/html, Size: 1726 bytes --]

[-- Attachment #2: preview.png --]
[-- Type: image/png, Size: 10640 bytes --]

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

* Re: Bug: latex nested environments are failed on preview and export [9.3.8 (9.3.8-1-g13dfab-elpaplus @ /home/sd/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200914/)]
  2020-09-20 20:32 Bug: latex nested environments are failed on preview and export [9.3.8 (9.3.8-1-g13dfab-elpaplus @ /home/sd/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200914/)] Сергей Олегович
@ 2020-09-20 22:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2020-09-20 22:51 UTC (permalink / raw)
  To: Сергей Олегович
  Cc: emacs-orgmode

Hello,

Сергей Олегович <sdorof1@gmail.com> writes:

> I want to use a matrix environment that is included in an outer
> environment, so:
>
> ```
> Environment:
> \begin{equation*}
> \left|
> \begin{matrix}
> a_1 & b_1\\
> a_2 & b_2
> \end{matrix}
> \right|
> \end{equation*}
>
> Display--math:
> \[
> \left|
> \begin{matrix}
> a_1 & b_1\\
> a_2 & b_2
> \end{matrix}
> \right|
> \]
>
> Inline--math:
> \(
> \left|
> \begin{matrix}
> a_1 & b_1\\
> a_2 & b_2
> \end{matrix}
> \right|
> \)
> ```
>
> But for the second and third cases (display-math and inline-math) the
> preview and export to latex are failed:

This is not a bug. \[...\] and \(...\) are inline elements within
a paragraph. However, \begin{...}...\end{...} environments are blocks,
and they break paragraphs. IOW, you cannot nest them.

The following should work however

  \(
  \left|\begin{matrix}
  a_1 & b_1\\
  a_2 & b_2
  \end{matrix}\right|
  \)

because \begin{matrix} doesn't start the line, and therefore is not seen
as starting a new LaTeX block.

As a rule of thumb, Org has limited support for raw LaTeX in a document.
This is not AucTeX. For specific needs, you may want to use LaTeX
blocks, i.e., #+begin_export latex...


Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2020-09-20 22:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-20 20:32 Bug: latex nested environments are failed on preview and export [9.3.8 (9.3.8-1-g13dfab-elpaplus @ /home/sd/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200914/)] Сергей Олегович
2020-09-20 22:51 ` 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).