emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Issues with nested begin..end blocks in inline math environments
@ 2019-12-06 19:42 Matt Huszagh
  2019-12-07 11:30 ` Fraga, Eric
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Huszagh @ 2019-12-06 19:42 UTC (permalink / raw)
  To: emacs-orgmode

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

I'm experiencing incorrect and seemingly inconsistent behavior when nesting
`\begin` `\end` environments inside `\(\)` or `$$`. For example, the
following is valid latex code:
```
\(\begin{aligned}
b_n &= \frac{1}{\pi} \int_{0}^{\pi} x \sin{\left(nx\right)}dx \\
b_0 &= 0 \\
\int_{0}^{\pi} udv &= \left[uv\right]_{0}^{\pi}
  - \int_{0}^{\pi} vdu \\
dv &= \sin{\left(nx\right)}dx \\
v(x) &= \int \sin{\left(nx\right)}dx \\
&= -\frac{\cos{\left(nx\right)}}{n} \\
\left[uv\right]_{0}^{\pi} &=
  -\left[\frac{x\cos{\left(nx\right)}}{n}\right]_{0}^{\pi} \\
&= \left\{\begin{alignedat}{2}
  \frac{\pi}{n}&, && \quad \text{$n$ odd} \\
  -\frac{\pi}{n}&, && \quad \text{$n$ positive even} \\
\end{alignedat}\right. \\
\int_{0}^{\pi} vdu &=
  \int_{0}^{\pi} -\frac{\cos{\left(nx\right)}}{n} dx \\
&= -\frac{1}{n^2} \left.\sin{\left(nx\right)}\right|_{0}^{\pi} \\
&= 0 \\
b_{n\in \mathbb{Z}^+} &= \left\{\begin{alignedat}{2}
  \frac{1}{n}&, && \quad \text{$n$ odd} \\
  -\frac{1}{n}&, && \quad \text{$n$ positive even} \\
\end{alignedat}\right. \\
\end{aligned}\)
```
But this confuses org which is generating images for the `\begin{aligned}`
at the top and the `\text` macros, but nothing else. Iterations on this
sometimes work fine, however. For example,
```
\(\begin{aligned}
b_{n\in \mathbb{Z}^+} &= \left\{\begin{alignedat}{2}
  \frac{1}{n}&, && \quad \text{$n$ odd} \\
  -\frac{1}{n}&, && \quad \text{$n$ positive even} \\
\end{alignedat}\right. \\
\end{aligned}\)
```
typesets correctly. Has anyone else had trouble with the latex fragment
regex's?

[-- Attachment #2: Type: text/html, Size: 1897 bytes --]

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

end of thread, other threads:[~2019-12-16  8:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 19:42 Issues with nested begin..end blocks in inline math environments Matt Huszagh
2019-12-07 11:30 ` Fraga, Eric
2019-12-07 19:28   ` Matt Huszagh
2019-12-08  7:04     ` Matt Huszagh
2019-12-15  4:01   ` Matt Huszagh
2019-12-15  8:58     ` Nicolas Goaziou
2019-12-16  8:25       ` Matt Huszagh

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