io12 / org-fragtog

Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
MIT License
397 stars 14 forks source link

Not working for begin environment #18

Closed arpit15 closed 3 years ago

arpit15 commented 3 years ago

The package works for $ environment. However, it doesn't work for begin environment. I am able to toggle the preview using keybinding C-c C-x C-l for both cases.

I tried following block in org mode

\begin{align}
\label{myeq}
x=10
\end{align}

Thanks for creating this package. I love this package.

io12 commented 3 years ago

Glad you like my package! Unfortunately, I'm not sure if I can reproduce this bug. The example block you posted works for me. I opened a new empty org-mode buffer, typed

\begin{align}
\label{myeq}
x=10
\end{align}
A

and the fragment appeared. I needed to type the A (or any non-space character) at the end because apparently org-mode thinks the context of spaces after a LaTeX fragment is also part of the LaTeX fragment (although I think I know how to fix this if this is the issue you're talking about).

arpit15 commented 3 years ago

Silly me. Yes, that was it. I am fine with the current context. I was just testing. Therefore, I didn't have any other text after it.

io12 commented 3 years ago

I ended up fixing this in https://github.com/io12/org-fragtog/commit/51fcac59c724fdf58f478db62dbf6f157621d598.