Hi Keita,

Ikumi Keita <[email protected]> writes:

> I realized that %l played an important role for Japanese LaTeX document,
> too; it gave latex binary name such as "platex" as well as its
> supplementary option such as "-kanji=xxx".
> However, I haven't come up with a good solution which is compatible for
> both windows and non-windows with respect to quoting. :-(

thanks for looking at this.  Maybe you come up with something later, I
think there is no rush :-)

> I concluded that AUCTeX should incorporate your simple proposal and
> users who need other non-default options, e.g. Japanese latex binary
> names, should prepare their own config file such as .latexmkrc.
>
> It isn't a literal "OOB" solution, but I think it is the most practical
> approach and is user-friendly enough. :-)

So lets call it a preliminary solution ;-)  I plan to install this
change as a starter:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index c905981d..233a6c43 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,44 @@ 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 is essentially (eq TeX-engine 'default) since we
+             ;; ignore 'omega completely:
+             (t
+              (cond ((and TeX-PDF-mode
+                          (not (TeX-PDF-from-DVI)))
+                     " -pdf")
+                    ((and TeX-PDF-mode
+                          (TeX-PDF-from-DVI))
+                     " -pdfdvi")
+                    ;; FIXME: Which LaTeXMK options cover this:
+                    ;; ((and TeX-PDF-mode
+                    ;;       (string= (TeX-PDF-from-DVI) "Dvipdfmx"))
+                    ;;  " ???")
+                    ((and TeX-PDF-mode
+                          (string= (TeX-PDF-from-DVI) "Dvips"))
+                     " -pdfps")
+                    ((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 +2240,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---

Maybe we get some feedback about it from the actual users and we can
then go on.  There is also the issue with non-recognized View command,
but again, this is preliminary.

Best, Arash

Reply via email to