io12 / org-fragtog

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

org-fragtog seems to disable M-x org-latex-preview #24

Closed notuntoward closed 3 years ago

notuntoward commented 3 years ago

If I've created a new org file with latex in it, I'd expect that M-x org-latex-preview would render all of the equations. However, after I installed org-fragtog, this command doesn't do anything; I have to manually put the cursor on each equation in order to cause the rendering.

Is there a way around this?

io12 commented 3 years ago

I can't reproduce this. Do you have an example org file that has this problem? Thanks.

notuntoward commented 3 years ago

Yes, here's an example:

#+STARTUP: latexpreview

* test

\[
e^{i\pi} = -1
\]

\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

* test 2

Within emacs numbered equations are always (1), but they'll be correctly numbered in exported latex doc pdf.

Some text above numbered equation on its own line:

\begin{equation}                      
y=\sqrt{b}                            
\end{equation}                        

Some text below equation.

\begin{equation}                      
y=\sin{b}                            
\end{equation}                        

* here's mixed text and equations, unnumbered equations on their own lines

If $a^2=b^{e^{i\theta}}$ and \( b=2 \), then the solution must be
either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].  

* a new numbered equ number 

  \begin{equation}                      
y=\sqrt{b}                            
\end{equation}                        

* better equ. numbers in org mode
  From: https://kitchingroup.cheme.cmu.edu/blog/2016/11/07/Better-equation-numbering-in-LaTeX-fragments-in-org-mode/

  *MUST PUT LISP ON KITCHIN PAGE INTO .EMACS FOR THIS*

   Here are some example equations to see if it works (/almost but not quite/).

   Below adapted from Kitchin example org file.

This should be numbered (4)
\begin{equation} \int y^2 dx \end{equation}

This is a numbered equation with a custom number. This should have (E1) as the number.
\begin{equation}\tag{E1} \int x^2 dx \end{equation}

But equation* is not numbered
\begin{equation*} \int x^2 dx \end{equation*}

LaTeX align environments are numbered. The first line is (5), the second line is not numbered (because we put \nonumber in the line), and the third line is (6).
\begin{align} a = 5 \\ b=6 \nonumber \\ c = 8 \end{align}

But align* environments are not numbered.
\begin{align*} a = 5 \\ b=6 \end{align*}

This should be numbered (7) (but it's not).
\begin{equation} \int x^4 dx \end{equation}

These should be numbered (8), (9) and (10) (but aren't b/c equ above is wrong).
\begin{align} a = 5 \\ b=6 \\ c = 8 \end{align}

This should be numbered with (E2).
\begin{equation}\tag{E2} \int x^2 dx \end{equation}

And this should be numbered (11) (but isn't b/c above equs are wrong).
\begin{equation} \int x^2 dx \end{equation}
io12 commented 3 years ago

Thanks for the example.

I opened the example file, put the cursor at the beginning, and ran M-x org-latex-preview. It didn't do anything, but it also didn't when org-fragtog-mode is off. I think the intended behavior of org-latex-preview is that it toggles the preview for the fragment surrounding the cursor if there is one, and enables previews for all fragments in the surrounding subtree otherwise. When I move the cursor into a subtree with fragments, it has this expected behavior and I couldn't notice a difference whether org-fragtog-mode was enabled or not.

Is there something else I need to do to reproduce the issue? Thanks.

io12 commented 3 years ago

I'm going to close this issue for inactivity. Feel free to re-open it if you still have any issues.