> Next step - ox-latex. I've redone the precompilation logic to be simpler to follow, and eliminated some redundant code. Pasting from the relevant commit message here (4a183344cadb1a652ab80aeb235457900d46df96):
Simplify the precompilation code path and logic used for LaTeX preview and LaTeX export. Specify the precompilation command in only one place, `org-latex-precompile-command'. * lisp/ox-latex.el (org-latex-precompile-command): Make this command the source of truth for precompilation under all conditions: preview/export, dvipng/dvisvgm/imagemagick, pdflatex/xelatex/lualatex. (Note that xelatex and lualatex have precompilation disabled anyway.) (org-latex-precompile-compiler-map): This alist is never used, remove it. (org-latex--precompile, org-latex--precompile-preamble): Change calling convention. Instead of reading a mysterious :precompile-format-spec from the INFO plist, explicitly pass a format SPEC to use with `org-latex-precompile-command'. Default to using the LaTeX complier in use for the export/preview process in this spec. (org-latex--remove-cached-preamble): Fix the hash so we find the correct preamble dump. * lisp/org-latex-preview.el (org-latex-preview-process-alist): Remove the :latex-precompiler key, the precompilation command is handled automatically. (org-latex-preview--precompile-log): Documentation (org-latex-preview-clear-cache): Clear the precompile cache correctly (see change to org-latex--remove-cached-preamble above). (org-latex-preview--precompile): Call `org-latex--precompile' with the new SPEC argument, see above. Karthik
