Subject: bug#76612: 14.0.8; TeX-engine=xetex causes "No matching viewer found" with TeX-command-run-all

From: Arash Esbati <[email-masked]>
Date: Fri, 28 Feb 2025 10:22:11 +0100

Hi Zhuohua,

Zhuohua Li <[email-masked]> writes:

> I've encountered an issue when using `TeX-engine = xetex` in AUCTeX.
> Specifically, invoking `TeX-command-run-all` fails to launch a PDF
> viewer with the error:

Thanks for raising this issue, the reproducer and a solution.

> ** Proposed Fix
>
> Instead of passing `-pdfxe` to `latexmk`, I replaced it with:
>
> #+begin_src elisp
> (cond ((eq TeX-engine 'xetex)
>        " -pdf -pdflatex=xelatex")
>  ...
> #+end_src

I would install the following change:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index 590f938a..622e980a 100644
--- a/tex.el
+++ b/tex.el
@@ -681,7 +681,7 @@ string."
     ("%(latexmk-out)"
      (lambda ()
        (cond ((eq TeX-engine 'xetex)
-              " -pdfxe")
+              " -pdf -pdflatex=xelatex")
              ((eq TeX-engine 'luatex)
               (cond ((and TeX-PDF-mode
                           (TeX-PDF-from-DVI))
--8<---------------cut here---------------end--------------->8---

With this change, users will loose the compilation speed mentioned in
LaTeXMk manual, but this is the best option we currently have, I think.

At some point, we probably have to do the dance we do for luatex in
terms of creating a .pdf or .dvi, but I'm not familiar enough with XeTeX
and LaTeXMk options to do that now.

I'll wait another day or two if there are other comments, and then
install the patch (and possibly make a new release).

Best, Arash