Open fbob opened 4 years ago
The current state of texfrag is: The source text is shown (and editable) when you enter the LaTeX fragment and the source text is hidden when you leave the fragment. Texfrag displays the last rendered image for the LaTeX fragment during editing if you switch on texfrag-show-last-mode
. The following image shows a LaTeX fragment where the cursor entered from the back when texfrag-show-last-mode
is switched on.
Currently, the image is not re-generated when you leave the source code of the LaTeX fragment. You have to call preview-at-point
yourself (e.g., with C-c C-p C-p).
I think automatic re-generation of the preview at point is feasible. But, it should be optional and I have to find some spare time to implement it.
Thanks a lot for your kind and precise feedback. Yes, no doubt that the automatic re-generation of the preview should be optional. I'm sorry to say that my lisp, elisp knowledge is non-existent. I can only help in testing, giving some feedback. Anyway thank you very much for developing texfrag, that's a very very nice emacs package. THANKS :)
Note, that I've seen the announcement of org-fragtog on reddit. But, I didn't notice the automatic regeneration of the LaTeX fragments. Only your issue taught me that. Therefore, I have to thank you.
You wrote:
I'm sorry to say that my lisp, elisp knowledge is non-existent.
Clearly, that is really a pity. You miss all the fun of Emacs;-)).
Note that I am working on this one and I have an almost working version. Pityingly, the automatic triggering of the re-generation of the preview amplifies a strange effect which I only observed occasional up to now. Sometimes the preview only shows an empty box.
I think I have to tackle that effect before publishing the automatic triggering of LaTeX.
Before that I have to write an issue for the observed effect.
At this point you could help me by answering the following question:
Do you sometimes observe that after pressing C-c C-p C-p
(i.e., preview-at-point
) the preview box for a LaTeX fragment remains empty? It changes to the right image immediately at the next input event that is not a point motion. Mouse clicks are sufficient to change to get the right image.
Sorry for the late feedback. On my installation I preview a square empty box on the left which disappear just before the correct image is rendered. I'm not sure if it's clear enough.
Hi fbob, meanwhile I found that: https://github.com/syl20bnr/spacemacs/issues/12728. Maybe, this is related to the wrong rendering of preview images. Don't know. I am on Ubuntu 18.04.
Pityingly, my auto-rendering attempts are strongly affected by this effect. Furthermore, my time resources are currently restricted through COVID-19. We have to take care of our son around the clock. No kindergarden and my wife and I have full-time jobs. So this feature can take some while. Sorry.
At this point you could help me by answering the following question: Do you sometimes observe that after pressing C-c C-p C-p (i.e., preview-at-point) the preview box for a LaTeX fragment remains empty? It changes to the right image immediately at the next input event that is not a point motion. Mouse clicks are sufficient to change to get the right image.
This always happens to me. It appears to be an issue with auctex, see https://lists.gnu.org/archive/html/auctex/2020-04/msg00010.html and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39927. The second link contains a patch that seems to fix the issue for me.
@sebmiq Thank you very much for that information. That problem is the main reason for stalling the work on this issue. I'll try the patch ASAP.
@TobiasZawada It seems that auto-toggle of latex image and code does not work for me. When the cursor move to the image, the equation image still shows and no text is shown. Tested on Emacs 27.2 and macOS.
Is it possible to automatically toggle latex code and image preview as the cursor enters and exits them ? Something in the spirit of https://github.com/io12/org-fragtog . Thanks :)