emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Cubizolles <j.cubizolles@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: Different set of packages for LaTeX export
Date: Tue, 06 Oct 2015 12:17:44 +0200	[thread overview]
Message-ID: <87wpv0uwqf.fsf@free.fr> (raw)
In-Reply-To: 20151001204426.6393bd1d@arcor.com

Manfred Lotz <manfred.lotz@arcor.de> writes:

> Hi all,
> I have configured LaTeX export for using xelatex. For this I have
> defined a list of packages in org-latex-default-packages-alist. One of
> those packages is hyperref with certain options.
>
> When creating a normal document, e.g. using class article that works
> fine.
>
> When creating slides, i.e using beamer I get an option clash
> during compiling the tex file because beamer did already load hyperref.
>
> How can I solve it? 

The way I do it: I have different classes for different types of export
(beamer, or "normal") and I'm using different projects to choose from at
export time. The following code is at the beginning of the org file and
has to be run (C-c C-c) when you open the org file. The publishing
functions are just here to rename the pdf file.


--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp :tangle yes :exports none
  (setq org-publish-project-alist
        `(("TeX"
           :base-directory "./"
           :publishing-directory "./"
           :publishing-function org-beamer-publish-to-latex
           :exclude ".*"
           :latex-class "mpsi_beamer"
           :include ,(list (file-name-nondirectory buffer-file-name))
           )
          ("beamer"
           :base-directory "./"
           :publishing-directory "./"
           :publishing-function org-beamer-publish-to-pdf
           :exclude ".*"
           :latex-class "mpsi_beamer"
           :include ,(list (file-name-nondirectory buffer-file-name))
           :completion-function jc-org-publish-rename-beamer-pdf
           )
          ("notes"
           :base-directory "./"
           :publishing-directory "./"
           :preparation-function jc-org-latex-notes-preparation
           :publishing-function org-beamer-publish-to-latex
           :exclude ".*"
           :latex-class "mpsi-beamerarticle"
           :include ,(list (file-name-nondirectory buffer-file-name))
           :completion-function jc-org-publish-rename-notes-pdf
           )
          ("eleves"
           :base-directory "./"
           :publishing-directory "./"
           :preparation-function jc-org-latex-notes-preparation
           :publishing-function org-beamer-publish-to-pdf
           :exclude ".*"
           :latex-class "mpsi-beamerarticle-eleves"
           :include ,(list (file-name-nondirectory buffer-file-name))
           :select-tags ("eleves")
           :completion-function jc-org-publish-rename-eleves-pdf
           )          
          ("cours" :components ("beamer" "notes" "eleves"))))
#+end_src
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(defun jc-org-publish-rename-beamer-pdf ()
  "Rename file.pdf to file-beamer.pdf and file.tex to file-beamer.tex when buffer is visiting file.org"
  (jc-org-publish-rename '"pdf" '"beamer")
  (jc-org-publish-rename '"tex" '"beamer"))
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(defun jc-org-publish-rename (suffix version)
    "Rename file.suffix to file-version.suffix when buffer is visiting file.org"
    (let*   ((file-base-name (remove-org-suffix (buffer-file-name)))
	     (file-suffix-name (concat file-base-name "." suffix))
	     (file-version-suffix-name (concat file-base-name "-" version  "." suffix)))
    (if (file-exists-p file-suffix-name)
	(rename-file file-suffix-name file-version-suffix-name t))
    )
    )
--8<---------------cut here---------------end--------------->8---

Julien.

      parent reply	other threads:[~2015-10-06 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 18:44 Different set of packages for LaTeX export Manfred Lotz
2015-10-01 19:21 ` Rasmus
2015-10-02  3:30   ` Manfred Lotz
2015-10-02  4:50     ` Fabrice Popineau
2015-10-02  8:41       ` Manfred Lotz
2015-10-06 10:17 ` Julien Cubizolles [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpv0uwqf.fsf@free.fr \
    --to=j.cubizolles@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).