>> 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 problem with some analogue
> to `org-insert-structure-template'? E.g. `org-insert-latex-environment'.
The problem is deletion, not insertion of environments. The
live-preview capability of the new org-latex-preview feature is confused
by the state of the Org element when you delete the \end{FOO} line of
the environment.
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 element is no longer a
LaTeX environment. But when you delete the \end{FOO} line, the preview
doesn't clear because the start of the element, at \begin{FOO}, is still
a LaTeX fragment. Fixing this is subtle.
Karthik