diff --git a/tex.el b/tex.el index 053a0ade..6386ff24 100644 --- a/tex.el +++ b/tex.el @@ -250,6 +250,10 @@ 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") + ;; Suppress "-recorder" option because %l expantion can include + ;; "\input", after which latexmk inserts "-recorder". + ("LaTeXMK" "latexmk -recorder- %(latexmk-opt) %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 +676,35 @@ 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-opt)" + (lambda () + (cond ((eq TeX-engine 'luatex) ; Running lualatex: + (if TeX-PDF-mode + " -pdflua -pdflualatex='%`%l%(mode)%''" + " -dvilua -ps -dvilualatex='%`%l%(mode)%''")) + ((eq TeX-engine 'xetex) ; Running xetex in any mode: + ;; FIXME: What to do when TeX-PDF-mode is nill? + " -pdfxe -pdfxelatex='%`%l%(mode)%''") + (t ; For anything else; we don't care Omega: + (cond ((and TeX-PDF-mode + ;; We want to produce a pdf + ;; Return t if default compiler produces PDF, + ;; nil for "Dvips" or "Dvipdfmx" + (not (TeX-PDF-from-DVI))) + ;; We're using pdflatex in pdf-mode + " -pdf -pdflatex='%`%l%(mode)%''") + ;; We're generating a .dvi to process with dvips or + ;; dvipdfmx. + ((and TeX-PDF-mode + (equal (TeX-PDF-from-DVI) "Dvipdfmx")) + " -pdfdvi -latex='%`%l%(mode)%'' -e '$dvipdf=q/dvipdfmx %%O -o %%D %%S/'") + ((and TeX-PDF-mode + (equal (TeX-PDF-from-DVI) "Dvips")) + " -pdfps -latex='%`%l%(mode)%''") + (t + " -dvi -ps -latex='%`%l%(mode)%''"))))))) "List of built-in expansion strings for TeX command names. This should not be changed by the user who can use @@ -2200,7 +2232,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.")