A last suggestion. Incidentally the toggle returns nil when at least a
fragment is unpreviewed and non-nil otherwise (as a side effect of
message). This can be documented and made part of the interface, so
that something like the following can be put together by the end user:

(defun my-org-preview-latex (&optional arg)
  (interactive "P")
  (unless (org-toggle-latex-fragment arg)
    (org-toggle-latex-fragment arg)))
I insist on the importance of the use case "force preview" because
it's very useful to quickly jot down a paragraph or part of a
paragraph with many simple latex fragments like $x_i$, $f(x)$, etc.
and then, afterwards, type C-c C-x C-l to preview the last entered
part of the paragraph, instead of painfully entering C-c C-x C-l after
any single $x$ or similar. Now, if the toggle prefers removing
previews as it's the case, this won't work because, in general, you
already have some preview in the same section or paragraph.

Reply via email to