emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org syntax: is \begin{equation} a latex-fragment?
@ 2024-04-18 11:56 Max Nikulin
  2024-04-19 18:10 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Max Nikulin @ 2024-04-18 11:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Is it expected that

---- 8< ----
\begin{equation}
---- >8 ----

is parsed by (org-element-parse-buffer) as the following?

(latex-fragment ... :value "\\begin{equation}")

\begin{something} is quite special in LaTeX, so despite it is similar to 
`latex-fragment' definition, it almost certainly leads to an error. 
Perhaps is should be detected by `org-lint' and treated as literal text 
by `org-element' since it is incomplete `latex-environment'.

I noticed it trying to figure out how Gnus inline preview works. In the 
following fragment (e.g. of this message)

#+startup: latexpreview
\begin{equation}
   x = 1
\end{equation}

2 lines (startup and \begin{equation}) are passed to an Org mode 
temporary buffer.



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

* Re: org syntax: is \begin{equation} a latex-fragment?
  2024-04-18 11:56 org syntax: is \begin{equation} a latex-fragment? Max Nikulin
@ 2024-04-19 18:10 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-04-19 18:10 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Is it expected that
>
> ---- 8< ----
> \begin{equation}
> ---- >8 ----
>
> is parsed by (org-element-parse-buffer) as the following?
>
> (latex-fragment ... :value "\\begin{equation}")

Yes.
It matches https://orgmode.org/worg/org-syntax.html#LaTeX_Fragments

> \begin{something} is quite special in LaTeX, so despite it is similar to 
> `latex-fragment' definition, it almost certainly leads to an error. 
> Perhaps is should be detected by `org-lint' and treated as literal text 
> by `org-element' since it is incomplete `latex-environment'.

Yes, a linter would make sense.
Patches welcome!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2024-04-19 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-18 11:56 org syntax: is \begin{equation} a latex-fragment? Max Nikulin
2024-04-19 18:10 ` Ihor Radchenko

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