> I did checked the code. I think we should keep it ATM, because:
>
> * This option uses xdv image input type, while dvipng & dvisvgm option 
> uses dvi (since dvi can't handle CJK characters, xdv is used to )

We handle this correctly in the patchset. See:

https://git.tecosaur.net/tec/org-mode/src/commit/75082c88ec8e7707beb0e3f1cd44877ec12af2f2/lisp/org-latex-preview.el#L2172

We produce xdv if the latex-compiler is xelatex.  It is actually not
possible to use xelatex to produce dvi output consistently, IIUC.

In general, we handle all combinations of image converter (dvisvgm,
dvipng etc) and latex compiler (pdflatex, xelatex, lualatex) correctly,
or report the issue when a combination is unsupported.

> * LaTeX preview compiler relies on :latex-compiler, and it shouldn't 
> affected by org-latex-compiler setting, because this setting is used for 
> exporting org files. While pdflatex can export PDF documents, it can't 
> generate dvi or xdv files like latex or xelatex.

The latex-preview compiler and the latex compiler must be related as
follows:

https://git.tecosaur.net/tec/org-mode/src/commit/75082c88ec8e7707beb0e3f1cd44877ec12af2f2/lisp/org-latex-preview.el#L212

(defcustom org-latex-preview-compiler-command-map
  '(("pdflatex" . "latex")
    ("xelatex" . "xelatex -no-pdf")
    ("lualatex" . "dvilualatex"))
  "An alist mapping from each of `org-latex-compilers' to command strings.
Each key is a LaTeX compiler name, for each compiler in
`org-latex-compilers', and the value the command that should be used
when producing a preview (optionally including flags).

This should only ever be changed in the event that PDF, not DVI output
is required."
  :group 'org-latex-preview
  :package-version '(Org . "9.7")
  :type '(alist :tag "Compiler"
          :value-type (string :type "command")))

otherwise there are correctness issues.  We handle this correctly.

> I think we may add org-preview-latex-process and 
> org-preview-latex-processes setting if we want to make latex preview 
> compiler independent.

Ihor and I discussed this in the past -- specifically, we discussed
adding a org-latex-preview-compiler option similar to
org-latex-compiler, specifically for latex previews.  But we decided
this is not a good idea because the preamble may not be compatible with
both.  The export and preview pipeline use the same preamble (in both
the old and new latex preview systems), so they must use the same
compiler.

Karthik

Reply via email to