From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Bach Subject: Re: [New Exporter] org-export-latex-after-initial-vars-hook Date: Thu, 6 Jun 2013 12:48:10 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkZcL-0006XM-Iq for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 08:48:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkZcG-0001Vq-Kh for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 08:48:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:58505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkZcG-0001Ve-CC for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 08:48:32 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UkZcA-0007bX-CY for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 14:48:26 +0200 Received: from arcss01.ait.ac.at ([62.218.164.126]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Jun 2013 14:48:26 +0200 Received: from phaebz by arcss01.ait.ac.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Jun 2013 14:48:26 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org > Is there a hook that is run before actual LaTeX export of a given > org-mode buffer in the new exporter engine? > For reference: I got it to work by adapting the snippet from Bruno Tavernier[1]: #+begin_src emacs-lisp (defun my-auto-tex-cmd (backend) "When exporting from .org with latex, automatically run latex, pdflatex, or xelatex as appropriate, using latexmk." (let ((texcmd)) (setq texcmd "latexmk -pdf %f") (if (string-match "LATEX_CMD: pdflatex" (buffer-string)) (setq texcmd "latexmk -pdflatex=pdflatex -pdf %f")) (if (string-match "LATEX_CMD: pdflatex-shell-escape" (buffer-string)) (setq texcmd "latexmk -pdflatex=pdflatex --shell-escape -pdf %f")) (if (string-match "LATEX_CMD: xelatex" (buffer-string)) (setq texcmd "latexmk -pdflatex=xelatex -pdf %f")) (setq org-latex-pdf-process (list texcmd)))) (add-hook 'org-export-before-parsing-hook 'my-auto-tex-cmd) #+end_src One thing that tripped me up initially was the requirement for the function to accept exactly one argument (unused in this case). [1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html