From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Harkins Subject: Re: Conditional source-block execution based on LaTeX document class? Date: Mon, 27 Jan 2014 10:30:30 +0800 Message-ID: References: <87iot6y2kf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7byL-00082H-Jx for emacs-orgmode@gnu.org; Sun, 26 Jan 2014 21:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7byD-0005Pn-5s for emacs-orgmode@gnu.org; Sun, 26 Jan 2014 21:30:49 -0500 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]:57198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7byC-0005OC-Ut for emacs-orgmode@gnu.org; Sun, 26 Jan 2014 21:30:41 -0500 Received: by mail-pb0-f53.google.com with SMTP id md12so5273796pbc.26 for ; Sun, 26 Jan 2014 18:30:40 -0800 (PST) In-Reply-To: <87iot6y2kf.fsf@gmail.com> 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: Eric Schulte Cc: orgmode On Monday, January 27, 2014 1:35:13 AM HKT, Eric Schulte wrote: > Hi James, > > Maybe you could do something like the following... > > #+name: export-hdr-arg-backend-dep > #+begin_src emacs-lisp > (message "do stuff") > #+end_src > > #+call: export-hdr-arg-backend-dep() :exports (if (eq=20 > org-export-current-backend 'beamer) "none" "results") Ah... that's really cool. I hadn't realized you could run lisp in the=20 header arguments. I couldn't check the current export backend because the org markup uses=20 beamer-specific features. The way to export the article format is to use=20 the beamer backend, but with document class =3D article and a=20 "\usepackage{beamerarticle}" line in the preamble. But, I figured out a little hack: to put this at the top of the container=20 file: # ###### top of slide container #+name: set-slide-flag #+begin_src emacs-lisp :exports results :results value latex (setq hjh-exporting-slides 't) "" #+end_src # ###### top of article container #+name: set-slide-flag #+begin_src emacs-lisp :exports results :results value latex (setq hjh-exporting-slides nil) "" #+end_src Then I can test this variable in all of the #+calls. It seems to be working. When I export from the slide container file, it=20 runs each #+call once. When I export from the article container (where I=20 have the calls in the container), it runs the calls for the article=20 container but it does *not* execute the calls redundantly for the two slide=20= show source files I have now. Thanks for the tip -- that's working a treat! I think I owe it to the org community to write up this workflow, after the=20= project is over. The help from Nicolas, you and others has been invaluable. hjh