For orgmode, I have a setup that calls up latexmk and automatically
provides the proper flags for luatex and xetex based on detection of a
string in the buffer like "#+LATEX_CMD: lualatex".*

I'm wondering how to:

(1) Add Latexmk as a C-c C-c command for AUCTeX, and set it as default.
(2) Institute something similar which searches the buffer for something
like "LATEX_CMD: lualatex" and set the flags for running latexmk
accordingly.


Thanks!


[* - The orgmode elisp looks like this:

(defun my-auto-tex-cmd ()
  "When exporting from .org with latex, automatically run latex,
     pdflatex, or xelatex as appropriate, using latexmk."
  (let ((texcmd)))
  ;; default command: oldstyle latex via dvi
  (setq texcmd "latexmk -dvi -pdfps -quiet %f")
  ;; pdflatex -> .pdf
  (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
      (setq texcmd "latexmk -pdf -quiet %f"))
  ;; xelatex -> .pdf
  (if (string-match "LATEX_CMD: xelatex" (buffer-string))
      (setq texcmd "latexmk -pdflatex=xelatex -pdf -quiet %f"))
  ;; lualatex -> .pdf
  (if (string-match "LATEX_CMD: lualatex" (buffer-string))
      (setq texcmd "latexmk -pdflatex=lualatex -pdf -quiet %f"))
  ;; LaTeX compilation command
  (setq org-latex-to-pdf-process (list texcmd)))

(add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)

]


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{sent by mu4e on Emacs running under GNU/Linux}

_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to