Re: Parsing of incomplete LaTeX environments

2025-04-17 Thread Ihor Radchenko
Karthik Chikmagalur writes: > Here is an example. An environment is being previewed live, and edited: > > https://share.karthinks.com/olp-live-preview-deletion-bug.mp4 > > When you delete the \begin{FOO} line and move the cursor away, the live > preview disappears as it should, because the Org el

Re: Parsing of incomplete LaTeX environments

2025-04-16 Thread Karthik Chikmagalur
> I fear you may be over-committed to a certain way of thinking about > this: that is, you are convinced it is the job of a preview tool to > compensate for ill-formed LaTeX code. That is a really large demand. If org-latex-preview provides a live-updating preview feature, it has to compensate for

Re: Parsing of incomplete LaTeX environments

2025-04-16 Thread Leo Butler
On Tue, Apr 15 2025, Karthik Chikmagalur wrote: >>> Basically, we need a specialized parser that will guess that a given >>> paragraph of text is actually an incomplete or broken latex fragment. >>> You may try writing one. For example, by additionally checking paragraph >>> elements to be latex-

Re: Parsing of incomplete LaTeX environments

2025-04-15 Thread Karthik Chikmagalur
>> Basically, we need a specialized parser that will guess that a given >> paragraph of text is actually an incomplete or broken latex fragment. >> You may try writing one. For example, by additionally checking paragraph >> elements to be latex-like. > > Alternatively, why not fix Karthik's stated

Re: Parsing of incomplete LaTeX environments

2025-04-15 Thread Leo Butler
On Tue, Apr 15 2025, Rudolf Adamkovič wrote: > Leo Butler writes: > >> Alternatively, why not fix Karthik's stated problem with some analogue >> to `org-insert-structure-template'? E.g. `org-insert-latex-environment'. > > This would be a nice addition in general, IMO. > >> It would insert a late

Re: Parsing of incomplete LaTeX environments

2025-04-15 Thread Rudolf Adamkovič
Leo Butler writes: > Alternatively, why not fix Karthik's stated problem with some analogue > to `org-insert-structure-template'? E.g. `org-insert-latex-environment'. This would be a nice addition in general, IMO. > It would insert a latex environment, after prompting for the name, or > update

Re: Parsing of incomplete LaTeX environments

2025-04-14 Thread Leo Butler
On Sun, Apr 13 2025, Ihor Radchenko wrote: > Karthik Chikmagalur writes: > >> If I delete the last line, so it looks like >> >> \begin{align} >> x = 1 >> >> And now place the cursor anywhere on the first line (with the \begin...) >> and call (org-element-context), it parses it as a `latex-fragme

Re: Parsing of incomplete LaTeX environments

2025-04-13 Thread Ihor Radchenko
Karthik Chikmagalur writes: > If I delete the last line, so it looks like > > \begin{align} > x = 1 > > And now place the cursor anywhere on the first line (with the \begin...) > and call (org-element-context), it parses it as a `latex-fragment'. > > This make sense too, since any text of the for