>>>>> Ikumi Keita <[email protected]> writes:
> Hi Arash,
>>>>> Arash Esbati <[email protected]> writes:
>> I knew you would understand me ;-) Can you do me a favor please and have
>> a look at the code I posted? I'm not sure how (XeLaTeX/)Dvipdfmx works
>> in .dvi mode, I think you have more experience in that area. I'd
>> appreciate if you can give a me hint where to put that stuff. I took
>> the conditional from our style/graphicx.el.
> I don't use latexmk either, but I expect that an article[1] posted in
> Japanese TeX users community would provide some insights about dvipdfmx
> usage for us. I'll take a look tomorrow.
> [1] https://texwiki.texjp.org/?AUCTeX
I expect the attached patch basically works. It still has shortcomings:
1. It uses single quote to prevent variable expansion of '$dvipdf' in
the shell command line. However, it doesn't work for windows.
2. After C-c C-c LaTeXMK, in dvi+dvips case, C-c C-c View offers xdvi,
not postscript viewer, as default candidate. Similarly, in
dvi+dvipdfmx case, C-c C-c offers Dvipdfmx, not View, as default
candidate.
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW
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.")