Hi Keita,

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

> This isn't quite correct because this clause covers cases for Japanese
> LaTeX engines (`TeX-engine' being ptex or uptex※) as well.
>
> ※ `jtex' engine became obsolete and isn't maintained anymore as far as
> I know.

Thanks for your comments.  Yes, I ignored tex-jp.el completely :-[  This
is my next approximation:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index c4e4104e..a0649c73 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 -recorder %(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---

Reg. this part:

+                    ;; FIXME: This might be inaccurate:
+                    ((and TeX-PDF-mode
+                          (string= (TeX-PDF-from-DVI) "Dvipdfmx"))
+                     " -pdfdvi")

I think users have to control the behavior of $dvipdf inside their
latexmk config file; I have no idea how this should work (and don't want
to investigate further).  WDYT?

Best, Arash

Reply via email to