auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Supporting LatexMK in AUCTeX OOTB


From: Arash Esbati
Subject: Re: Supporting LatexMK in AUCTeX OOTB
Date: Tue, 16 Apr 2024 12:58:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> I think we can omit "-recorder" option. It seems that Latexmk adds
> "-recorder" option to latex command by default. The reason why I put
> "-recorder-" in my proposal was to suppress that option; when %l
> expansion includes "\input", Latexmk puts "-recorder" between "\input"
> and .tex file name when it invokes latex, which leads to error.
> (I forgot to mention this in my previous message, sorry.)

Thanks for the clarification.

> Yes, I think so, too. Without changing $dvipdf value, Latexmk calls
> dvipdf, not dvipdfmx, in response to "-pdfdvi" option. Thus this
> treatment is half-cooked. :-(

Yes, this is unfortunate, somehow.

> Maybe we should minimize the command option like
>     ("LaTeXMK" "latexmk %(extraopts) %t"
>      TeX-run-format nil (LaTeX-mode docTeX-mode) :help "Run LaTeXMK")
> and let the user to do all control over the option through .latexmkrc?

This doesn't feel right.  AUCTeX has some options to control the output,
and I think we should support them.  I mean, the only issue is currently
with dvipdfmx as discussed above, and I don't think we should throw the
baby out with the bathwater because of this one glitch.  And I think we
should also get close to what auctex-latexmk offers, and we're not far
away.  WDYT?

This is the current state:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index c4e4104e..4c1eeb09 100644
--- a/tex.el
+++ b/tex.el
@@ -250,6 +250,9 @@ If nil, none is specified."
     ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
      (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode)
      :help "Convert PostScript file to PDF")
+    ("LaTeXMK" "latexmk %(latexmk-out) %(file-line-error) \
+%`%(extraopts) %S%(mode)%' %t"
+     TeX-run-format nil (LaTeX-mode docTeX-mode) :help "Run LaTeXMK")
     ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil
      (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode)
      :help "Run makeglossaries to create glossary file")
@@ -672,7 +675,40 @@ string."
     ;; Okular forward PDF search requires absolute path.
     ("%a" (lambda nil (prin1-to-string (expand-file-name (buffer-file-name)))))
     ;; the following is for preview-latex.
-    ("%m" preview-create-subdirectory))
+    ("%m" preview-create-subdirectory)
+    ;; LaTeXMK support
+    ("%(latexmk-out)"
+     (lambda ()
+       (cond ((eq TeX-engine 'xetex)
+              " -pdfxe")
+             ((eq TeX-engine 'luatex)
+              (cond ((and TeX-PDF-mode
+                          (TeX-PDF-from-DVI))
+                     " -dvilua -pdfdvi")
+                    ((and (not TeX-PDF-mode)
+                          TeX-DVI-via-PDFTeX)
+                     " -dvilua -ps")
+                    ;; This covers the case:
+                    ;; (and TeX-PDF-mode (not (TeX-PDF-from-DVI)))
+                    (t
+                     " -pdflua")))
+             ;; This covers everything else since we ignore 'omega:
+             (t
+              (cond ((and TeX-PDF-mode
+                          (not (TeX-PDF-from-DVI)))
+                     " -pdf")
+                    ((and TeX-PDF-mode
+                          (string= (TeX-PDF-from-DVI) "Dvips"))
+                     " -pdfps")
+                    ;; FIXME: This might be inaccurate:
+                    ((and TeX-PDF-mode
+                          (string= (TeX-PDF-from-DVI) "Dvipdfmx"))
+                     " -pdfdvi")
+                    ((and (not TeX-PDF-mode)
+                          TeX-DVI-via-PDFTeX)
+                     " -pdflatex -dvi -ps")
+                    (t
+                     " -dvi -ps")))))))
   "List of built-in expansion strings for TeX command names.

 This should not be changed by the user who can use
@@ -2200,7 +2236,8 @@ Must be the car of an entry in `TeX-command-list'."
     "\\.glo" "\\.gls" "\\.idx" "\\.ilg" "\\.ind"
     "\\.lof" "\\.log" "\\.lot" "\\.nav" "\\.out"
     "\\.snm" "\\.toc" "\\.url" "\\.synctex\\.gz"
-    "\\.bcf" "\\.run\\.xml" "\\.fls" "-blx\\.bib")
+    "\\.bcf" "\\.run\\.xml" "\\.fls" "-blx\\.bib"
+    "\\.fdb_latexmk")
   "List of regexps matching suffixes of files to be cleaned.
 Used as a default in TeX, LaTeX and docTeX mode.")
--8<---------------cut here---------------end--------------->8---

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]