emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [New Exporter] org-export-latex-after-initial-vars-hook
@ 2013-04-29 15:46 Søren Mikkelsen
  2013-04-29 17:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Søren Mikkelsen @ 2013-04-29 15:46 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I have just upgraded to the Org 8.0. Nice work! :)

But I have a problem with the exporter:

I have modified by org-exporter to export latex-files with the xelatex 
compiler. The implementation uses the 
"org-export-latex-after-initial-vars-hook"-hook to reconfigure the 
default process, however, this hook seems to be deleted and I'm not able 
to find equivalent hook.

Cheers,
Søren

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [New Exporter] org-export-latex-after-initial-vars-hook
  2013-04-29 15:46 Søren Mikkelsen
@ 2013-04-29 17:16 ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2013-04-29 17:16 UTC (permalink / raw)
  To: Søren Mikkelsen; +Cc: emacs-orgmode

Hello,

Søren Mikkelsen <soren@aamikkelsen.dk> writes:

> But I have a problem with the exporter:
>
> I have modified by org-exporter to export latex-files with the xelatex
> compiler. The implementation uses the
> "org-export-latex-after-initial-vars-hook"-hook to reconfigure the
> default process, however, this hook seems to be deleted and I'm not
> able to find equivalent hook.

Isn't it sufficient to customize `org-latex-pdf-process' so it uses
xelatex?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [New Exporter] org-export-latex-after-initial-vars-hook
@ 2013-06-06  8:38 Michael Bach
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Bach @ 2013-06-06  8:38 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

Nicolas Goaziou <address@hidden> writes:

> Søren Mikkelsen <address@hidden> writes:

>>* But I have a problem with the exporter:*
>>**
>*> I have modified by org-exporter to export latex-files with the xelatex*
>*> compiler. The implementation uses the*
>*> "org-export-latex-after-initial-vars-hook"-hook to reconfigure the*
>>* default process, however, this hook seems to be deleted and I'm not*
>>* able to find equivalent hook.*

> Isn't it sufficient to customize `org-latex-pdf-process' so it uses

> xelatex?

I assume Søren is using a similar snippet [1] as I do which is very
convenient (credit goes to Bruno Tavernier). This approach lets you
specify a #+LATEX_CMD (think of xelatex, -shell-escape, etc.) on a per
file basis and allows LaTeX package 'injection'.

Is there a hook that is run before actual LaTeX export of a given
org-mode buffer in the new exporter engine?

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

[-- Attachment #2: Type: text/html, Size: 1757 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [New Exporter] org-export-latex-after-initial-vars-hook
@ 2013-06-06  8:59 Michael Bach
  2013-06-06 12:48 ` Michael Bach
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Bach @ 2013-06-06  8:59 UTC (permalink / raw)
  To: emacs-orgmode

To minimize risk of eye cancer (previous version was sent from gmail
web interface at work without plain text setting) here it goes again:

Nicolas Goaziou <address@hidden> writes:

> Søren Mikkelsen <address@hidden> writes:

>> But I have a problem with the exporter:
>>
>> I have modified by org-exporter to export latex-files with the xelatex
>> compiler. The implementation uses the
>> "org-export-latex-after-initial-vars-hook"-hook to reconfigure the
>> default process, however, this hook seems to be deleted and I'm not
>> able to find equivalent hook.

> Isn't it sufficient to customize `org-latex-pdf-process' so it uses
> xelatex?

I assume Søren is using a similar snippet [1] as I do which is very
convenient (credit goes to Bruno Tavernier). This approach lets you
specify a #+LATEX_CMD (think of xelatex, -shell-escape, etc.) on a per
file basis and allows LaTeX package 'injection'.

Is there a hook that is run before actual LaTeX export of a given
org-mode buffer in the new exporter engine?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [New Exporter] org-export-latex-after-initial-vars-hook
  2013-06-06  8:59 Michael Bach
@ 2013-06-06 12:48 ` Michael Bach
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Bach @ 2013-06-06 12:48 UTC (permalink / raw)
  To: emacs-orgmode

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-06 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06  8:38 [New Exporter] org-export-latex-after-initial-vars-hook Michael Bach
  -- strict thread matches above, loose matches on Subject: below --
2013-06-06  8:59 Michael Bach
2013-06-06 12:48 ` Michael Bach
2013-04-29 15:46 Søren Mikkelsen
2013-04-29 17:16 ` Nicolas Goaziou

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).