emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex export subtree: org-latex-export-process
@ 2013-09-25 16:35 Michael Bach
  0 siblings, 0 replies; only message in thread
From: Michael Bach @ 2013-09-25 16:35 UTC (permalink / raw)
  To: emacs-orgmode

Dear org-mode Users and Developers,

(org-mode v8.1) I use the following function for customizable latex
export processes
#+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))
    (cond ((string-match "LATEX_CMD: pdflatex" (buffer-string))
           (setq texcmd "latexmk -pdflatex=pdflatex -pdf %f"))
          ((string-match "LATEX_CMD: pdflatex-shell-escape" (buffer-string))
           (setq texcmd "latexmk -pdflatex=pdflatex --shell-escape -pdf
%f"))
          ((string-match "LATEX_CMD: xelatex" (buffer-string))
           (setq texcmd "latexmk -pdflatex=xelatex -pdf %f"))
          (t (setq texcmd "latexmk -pdf %f"))
          )
    (setq org-latex-pdf-process (list texcmd))))
(add-hook 'org-export-before-processing-hook 'my-auto-tex-cmd)
#+end_src

which essentially uses an earlier idea[1].  Now this works well if I
export an .org buffer as a whole.  If I export a subtree, the
`buffer-string` only contains the subtree without the .org buffer
header, so the `string-match` always fails.

Any ideas on how to best integrate this function during a subtree
export?  Maybe inside a hook that is run before the subtree is narrowed
down?

Best Regards,
Michael

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-25 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-25 16:35 latex export subtree: org-latex-export-process Michael Bach

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).