Re: [O] Conditional source-block execution based on LaTeX document class?
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 org-export-current-backend 'beamer) "none" "results") Ah... that's really cool. I hadn't realized you could run lisp in the header arguments. I couldn't check the current export backend because the org markup uses beamer-specific features. The way to export the article format is to use the beamer backend, but with document class = article and a "\usepackage{beamerarticle}" line in the preamble. But, I figured out a little hack: to put this at the top of the container 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 runs each #+call once. When I export from the article container (where I have the calls in the container), it runs the calls for the article container but it does *not* execute the calls redundantly for the two slide 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 project is over. The help from Nicolas, you and others has been invaluable. hjh
Re: [O] Conditional source-block execution based on LaTeX document class?
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 org-export-current-backend 'beamer) "none" "results") Best, James Harkins writes: > Just ran into something that I'm really not sure how to handle. I thought I > could handle it with export filters, but actually it involves babel, and > that makes it more involved than I initially suspected. > > I'm working on a large project involving five beamer presentations (one per > day), and the sources for these will be combined into one massive > beamerarticle document for the workshop attendees' reference. (If they want > to print it out, it will look okay, but I won't encourage the killing of > trees -- actually my early versions of the article layout looks fine on a > tablet.) > > I'm using LaTeX's glossaries package for indexed references at the end. > But, \newglossaryentry is really annoying. So I made some org tables for > the glossary entries and I wrote some emacs-lisp src blocks to convert them > into the right syntax for LaTeX. So here's the problem... > > In the individual beamer slideshows, I need to put the \newglossaryentry > commands within a frame (because I'm also using beamer's > "ignorenonframetext" class option, so that I can have text that appears > only in the article but not the slides). That is (if I have H:3): > > *** Some frame > A block > Some text > > #+call: makegloss > #+results: makegloss > > ... then the results of the src block to go into the frame, and then beamer > doesn't ignore them and everything works. > > For the final article, I need a structure like this: > > #+options: H:4 > > * Day 1 > #+include "01-intro/01-contents.org" > > * Day 2 > #+include "02-synthesis/02-contents.org" > > And the problem is, if the #+call commands are replicated in each > 0x-contents file, then I will have redundant \newglossaryentry commands in > the LaTeX output (in the end, multiplied five times). > > If there's no other way, I could live with that, but ideally, I'd like to > be able to put the #+call lines into the master file for the article, and > then be able to suppress their execution in the #+includes. Ideally, this > would be automatic based on the LaTeX document class. > > Any way to do this? I suppose, at worst, I can just put all of the #+call > lines in, and simply say "no" to the ones I don't want in the final > compilation. > > Thanks, > hjh > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D
Re: [O] Conditional source-block execution based on LaTeX document class?
Dnia 2014-01-26, o godz. 23:44:48 James Harkins napisaĆ(a): > Just ran into something that I'm really not sure how to handle. I > thought I could handle it with export filters, but actually it > involves babel, and that makes it more involved than I initially > suspected. > > I'm working on a large project involving five beamer presentations > (one per day), and the sources for these will be combined into one > massive beamerarticle document for the workshop attendees' reference. > (If they want to print it out, it will look okay, but I won't > encourage the killing of trees -- actually my early versions of the > article layout looks fine on a tablet.) > > I'm using LaTeX's glossaries package for indexed references at the > end. But, \newglossaryentry is really annoying. So I made some org > tables for the glossary entries and I wrote some emacs-lisp src > blocks to convert them into the right syntax for LaTeX. So here's the > problem... > > In the individual beamer slideshows, I need to put the > \newglossaryentry commands within a frame (because I'm also using > beamer's "ignorenonframetext" class option, so that I can have text > that appears only in the article but not the slides). That is (if I > have H:3): > > *** Some frame > A block > Some text > > #+call: makegloss > #+results: makegloss > > ... then the results of the src block to go into the frame, and then > beamer doesn't ignore them and everything works. > > For the final article, I need a structure like this: > > #+options: H:4 > > * Day 1 > #+include "01-intro/01-contents.org" > > * Day 2 > #+include "02-synthesis/02-contents.org" > > And the problem is, if the #+call commands are replicated in each > 0x-contents file, then I will have redundant \newglossaryentry > commands in the LaTeX output (in the end, multiplied five times). > > If there's no other way, I could live with that, but ideally, I'd > like to be able to put the #+call lines into the master file for the > article, and then be able to suppress their execution in the > #+includes. Ideally, this would be automatic based on the LaTeX > document class. > > Any way to do this? I suppose, at worst, I can just put all of the > #+call lines in, and simply say "no" to the ones I don't want in the > final compilation. Ugly hack, but what about redefining \newglossaryentry? In general, since Org-to-LaTeX export is a bit "simplistic" (as compared to (La)TeX itself), I guess that solving such problems on the LaTeX side might be easier. (That said, beamer is rather opposite of "simplistic", so it might as well be not true...) > Thanks, > hjh HTH, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
[O] Conditional source-block execution based on LaTeX document class?
Just ran into something that I'm really not sure how to handle. I thought I could handle it with export filters, but actually it involves babel, and that makes it more involved than I initially suspected. I'm working on a large project involving five beamer presentations (one per day), and the sources for these will be combined into one massive beamerarticle document for the workshop attendees' reference. (If they want to print it out, it will look okay, but I won't encourage the killing of trees -- actually my early versions of the article layout looks fine on a tablet.) I'm using LaTeX's glossaries package for indexed references at the end. But, \newglossaryentry is really annoying. So I made some org tables for the glossary entries and I wrote some emacs-lisp src blocks to convert them into the right syntax for LaTeX. So here's the problem... In the individual beamer slideshows, I need to put the \newglossaryentry commands within a frame (because I'm also using beamer's "ignorenonframetext" class option, so that I can have text that appears only in the article but not the slides). That is (if I have H:3): *** Some frame A block Some text #+call: makegloss #+results: makegloss ... then the results of the src block to go into the frame, and then beamer doesn't ignore them and everything works. For the final article, I need a structure like this: #+options: H:4 * Day 1 #+include "01-intro/01-contents.org" * Day 2 #+include "02-synthesis/02-contents.org" And the problem is, if the #+call commands are replicated in each 0x-contents file, then I will have redundant \newglossaryentry commands in the LaTeX output (in the end, multiplied five times). If there's no other way, I could live with that, but ideally, I'd like to be able to put the #+call lines into the master file for the article, and then be able to suppress their execution in the #+includes. Ideally, this would be automatic based on the LaTeX document class. Any way to do this? I suppose, at worst, I can just put all of the #+call lines in, and simply say "no" to the ones I don't want in the final compilation. Thanks, hjh