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

Feature Request: Evaluate the whole buffer #48

Open chookity-pokk opened 1 year ago

chookity-pokk commented 1 year ago

Is your feature request related to a problem? Please describe. No problem but I just have a large org file that has a lot of small chunks of latex and would like to eval the whole buffer rather than moving my cursor through all of them.

Describe the solution you'd like A function to evaluate the whole buffer with fragtog.

Describe alternatives you've considered Just going through each chunk of latex to add in the preview.

BeaRRRRR commented 11 months ago

You can first run C-U C-U org-latex-preview which will evaluate the whole buffer, and then run org-fragtog-mode. If you want to do it programmatically:

(add-hook 'org-mode-hook 
          (lambda () 
            (org-fragtog-mode)
            (let ((current-prefix-arg 16))
              (call-interactively 'org-latex-preview))
            ))

It'll run this for every org file, you can play around with the config and only run it for the files you need I think

swflint commented 9 months ago

You could also add #+startup: latexpreview, in each file, or customize org-startup-with-latex-preview, which see.