>>> It is in the docstring:
>>>
>>> :latex-header list of strings, the LaTeX header of the snippet file.
>>> When nil, the fallback value is used instead, which is
>>> controlled by option `org-latex-preview-preamble',
>>> `org-latex-default-packages-alist' and
>>> `org-latex-packages-alist', which see.
>>
>> Yes. I was wondering if it made sense to keep it.
>> org-latex-preview-process-alist is no longer an alias of the old variable,
>> and we can decide if it makes sense to include the :latex-header
>> specification here as an option.
>>
>> Personally, I don't see a need for it.
>
> Maybe some exotic compilers need dedicated header.
> For example, recall
> \def\pgfsysdriver{pgfsys-tex4ht.def}
> from ob-latex that is needed for htlatex.
Okay.
>> 1. preview.sty can fail with exit-code 1 even when the run is
>> successful. This is by design for preview.sty, details are in its
>> manual. For this reason we have:
>>
>> (plist-put (cddr tex-compile-async) :success img-extract-async)
>> (plist-put (cddr tex-compile-async) :failure img-extract-async)
>>
>> implying we always run the image extractor, even if the tex compilation
>> "fails". So when the image converter fails, we don't know if it was
>> because the tex compilation failed and no dvi was produced.
>
>> 2. dvipng has a --follow option that we use, where it is started right
>> away, before any dvi files have been produced. This is for speed.
>> dvipng can read a partially produced dvi file and start producing images
>> for completed pages. This is why the dvipng route is much faster than
>> dvisvgm -- dvipng previews can feel instant if you have a small LaTeX
>> preamble.
>>
>> But in this context it means image-extract-async runs whether or not the
>> LaTeX process fails.
>
> These caveats would be nice to put somewhere in the commentary.
> Because it is bending :failure/:success design quite a bit.
I mentioned this in the commentary. Note that this is shown in the
process tree diagram we draw in the same block comment, but without
explaining why:
;; dvisvgm case:
;; └─ Compile tex file ⟶ stdout to `org-latex-preview--latex-preview-filter'
;; └─ (success or failure) <------- HERE --------
;; └─Extact images ⟶ stdout to `org-latex-preview--dvisvgm-filter'
;; ├─ (success)
;; │ ├─ Call `org-latex-preview--check-all-fragments-produced',
;; │ │ which can rerun the async tree if needed.
;; │ └─ Delete tempfiles (`org-latex-preview--cleanup-callback').
;; └─ (failure)
;; └─ Run `org-latex-preview--failure-callback' (remove overlays and
emit msg).
Karthik