Hi Ihor,

Thank you very much for your reply!
I understand the answer.
Is there a proper way to render latex fragments in latex mode?

Thanks,
Roi

On Sat, 26 Mar 2022 at 12:34, Ihor Radchenko <yantar92@gmail.com> wrote:
Roi Holtzman <roi.holtzman@gmail.com> writes:

> This is the first time I am submitting a bug report here. I am not sure
> this is the proper place. I just took the advice of the warning message
> I got.

Thank a lot for the report! This is indeed the right place.

> When I am in latex mode (writing a tex document) and I run
> `org-toggle-latex-fragment` I get the error
> ```
> Warning (org-element-cache): org-element--cache: Org parser error in
> main.tex::38463. Resetting.
> The error was: (error "rx ‘**’ range error")
> Backtrace:
> nil
> Please report this to Org mode mailing list (M-x org-submit-bug-report).
> ```

You cannot run `org-toggle-latex-fragment' outside of Org buffers. It
used to work, but we made some changes that expect the major-mode to be
org-mode when analysing buffer text.

Best,
Ihor