From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Kauffman Subject: Re: Property inheritance in beamer export [7.4] Date: Mon, 14 Nov 2011 10:51:47 -0600 Message-ID: References: <1CD72022-E05E-477E-8AF0-F569AE3F5FFA@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:32949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPzlK-0006yK-2z for emacs-orgmode@gnu.org; Mon, 14 Nov 2011 11:52:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPzlC-000123-38 for emacs-orgmode@gnu.org; Mon, 14 Nov 2011 11:52:02 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:65034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPzlB-00011f-Qu for emacs-orgmode@gnu.org; Mon, 14 Nov 2011 11:51:54 -0500 Received: by faas10 with SMTP id s10so3527505faa.0 for ; Mon, 14 Nov 2011 08:51:47 -0800 (PST) In-Reply-To: <1CD72022-E05E-477E-8AF0-F569AE3F5FFA@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: Carsten Dominik Cc: emacs-orgmode@gnu.org Hi Carsten On Fri, Nov 11, 2011 at 10:58 AM, Carsten Dominik wrote: > Hi Chris, > > On 11.11.2011, at 05:34, Chris Kauffman wrote: > >> >> I use org for constructing simple slide presentations quite a >> bit. =A0I'd like to be able to set a global property which shrinks >> all text to fit in the allotted space; this is great for source >> examples. > > Have you read the beamer documentation? =A0After reading about > shrink, do you still mean to apply this evil thing? =A0 :) > For some situations, it is very appropriate, such as including a full code example in a single slide for copying/pasting into an editor. This keeps the code with the presentation and alleviates the need to copy from multiple slides or go to a separate site for the code. In general, I find it peculiar that anyone would include documentation to the effect "never use this option." The point of including functionality is to enable use in situations the writer can't anticipate. If the option is truly evil, remove it from the codebase altogether. I have found it incredibly useful and will continue ignoring such requests. >> After some experimentation I put >> >> #+PROPERTY: BEAMER_envargs [shrink] >> >> in the preamble and evaluated >> >> (set-variable (quote org-use-property-inheritance) t nil) >> >> According to my understanding of the documentation, this should >> make very outline entry inherit the property BEAMER_envargs, >> regardless of whether it has a properties list itself. > > Yes, I agree this is what the documentation looks like. =A0However, the > imlementation of org-beamer.el only looks at the local properties. > TO speed up processing, Org grabs all properties at each headline > and stores them - without inheritance. > A small note in the documentation to that effect might prevent confusion from folks like me. The patch you gave below in combination with the elisp code works. I will continue using this patched version. Please consider including such functionality in a future org-mode release as, despite the hit in efficiency, I feel allowing globally inherited properties as a mode of operation would eliminate a lot of tedium in copying properties over manually. Cheers, Chris >> After >> reloading the file, internally this seems to work fine: I move to >> any heading and eval the following lisp >> >> (org-entry-get (point) "BEAMER_envargs" 1) >> >> which gives the result "[shrink]". >> >> However, on exporting the org file to pdf, the shrinking does not >> seem to happen. The source code runs off the page. Is property >> inheritance not respected during export? > > Could you please set in .emacs > > (setq org-beamer-inherited-properties '("BEAMER_envargs")) > > and then try the following experimental patch > > -------------------------------------------------------------------------= ---------------- > diff --git a/lisp/org-beamer.el b/lisp/org-beamer.el > index 118aa75..2208c60 100644 > --- a/lisp/org-beamer.el > +++ b/lisp/org-beamer.el > @@ -482,4 +482,10 @@ The effect is that these values will be accessible d= uring export." > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(looking-at ".*?:B_\\(note\\(NH\\)= ?\\):")) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 (push (cons "BEAMER_env" (match-string 1)) pr= ops)) > + =A0 =A0 =A0 =A0 =A0(when (org-bound-and-true-p org-beamer-inherited-pro= perties) > + =A0 =A0 =A0 =A0 =A0 =A0(mapc (lambda (p) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unless (assoc p props) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(let ((v (org-entry-get nil = p 'inherit))) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(and v (push (cons p v) = props))))) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-beamer-inherited-properties)) > =A0 =A0 =A0 =A0 =A0 (put-text-property (point-at-bol) (point-at-eol) 'org= -props props))) > =A0 =A0 =A0 (setq org-export-latex-options-plist > -------------------------------------------------------------------------= ---------------- > > - Carsten > >> >> Cheers, >> Chris >> >> --Example .org File--- >> #+TITLE: =A0 =A0 Java Lecture >> #+AUTHOR: =A0 =A0Christopher Kauffman >> #+EMAIL: =A0 =A0 kauffman77@gmail.com >> #+LANGUAGE: =A0en >> #+OPTIONS: =A0 H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t >> #+OPTIONS: =A0 TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in= -toc >> #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 >> path:http://orgmode.org/org-info.js >> #+EXPORT_SELECT_TAGS: export >> #+EXPORT_EXCLUDE_TAGS: noexport >> #+STARTUP: beamer >> #+STARTUP: showall >> #+LaTeX_CLASS: beamer >> #+BEAMER_FRAME_LEVEL: 1 >> #+PROPERTY: BEAMER_envargs [shrink] >> >> * Example >> Want this shrink >> #+BEGIN_SRC java >> public class Mouse{ >> =A0 private int age =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0// age of mouse in= days >> =A0 private double weight =3D 1.0; =A0 =A0 =A0// weight of mouse in gram= s >> =A0 private double percentGrowthRate; // % weight increase per day >> >> =A0 // This method assigns the mouse's percent growth rate. >> =A0 public void setPercentGrowthRate(double percentGrowthRate) { >> =A0 =A0 this.percentGrowthRate =3D percentGrowthRate; >> =A0 } >> >> =A0 // This method simulates one day of growth for the mouse. >> =A0 public void grow() { >> =A0 =A0 this.weight +=3D (.01 * this.percentGrowthRate * this.weight); >> =A0 =A0 this.age++; >> =A0 } >> >> =A0 // This method prints the mouses's age and weight. >> =A0 public void display() { >> =A0 =A0 System.out.printf( >> =A0 =A0 =A0 "Age =3D %d, weight =3D %.3f\n", this.age, this.weight); >> =A0 } >> } >> #+END_SRC >> >> * Example >> :PROPERTIES: >> :BEAMER_envargs: [shrink] >> :END: >> >> Must add properties every time >> #+BEGIN_SRC java >> public class Mouse{ >> =A0 private int age =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0// age of mouse in= days >> =A0 private double weight =3D 1.0; =A0 =A0 =A0// weight of mouse in gram= s >> =A0 private double percentGrowthRate; // % weight increase per day >> >> =A0 // This method assigns the mouse's percent growth rate. >> =A0 public void setPercentGrowthRate(double percentGrowthRate) { >> =A0 =A0 this.percentGrowthRate =3D percentGrowthRate; >> =A0 } >> >> =A0 // This method simulates one day of growth for the mouse. >> =A0 public void grow() { >> =A0 =A0 this.weight +=3D (.01 * this.percentGrowthRate * this.weight); >> =A0 =A0 this.age++; >> =A0 } >> >> =A0 // This method prints the mouses's age and weight. >> =A0 public void display() { >> =A0 =A0 System.out.printf( >> =A0 =A0 =A0 "Age =3D %d, weight =3D %.3f\n", this.age, this.weight); >> =A0 } >> } >> #+END_SRC >> >> --END EXAMPLE- >> >> current state: >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> (setq org-export-latex-after-initial-vars-hook >> '(org-beamer-after-initial-vars) org-speed-command-hook >> '(org-speed-command-default-hook org-babel-speed-command-hook) >> org-agenda-files '("~/mypubs/worklog") org-agenda-window-setup >> 'other-window org-metaup-hook '(org-babel-load-in-session-maybe) >> org-after-todo-state-change-hook '(org-clock-out-if-current) >> org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup) >> org-export-latex-format-toc-function >> 'org-export-latex-format-toc-default org-tab-first-hook >> '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe >> org-babel-hide-result-toggle-maybe) org-src-mode-hook >> '(org-src-babel-configure-edit-buffer >> org-src-mode-configure-edit-buffer) >> org-confirm-shell-link-function 'yes-or-no-p >> org-export-first-hook '(org-beamer-initialize-open-trackers) >> org-agenda-before-write-hook '(org-agenda-add-entry-text) >> outline-mode-hook '((lambda nil >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key "\356" (quote >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 outline-next-visible-heading)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key "\360" (quote >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 outline-previous-visible-heading= )) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key (quote [f12]) (qu= ote >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ck-outline-toggle))) ) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-pre-tangle-hook '(save-= buffer) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-cycle-hook >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'(org-cycle-hide-archived-subtree= s >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-cycle-hide-drawers >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-cycle-show-empty-lines >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-optimize-window-after-visibil= ity-change) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-export-preprocess-before-norm= alizing-links-hook >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'(org-remove-file-link-modifiers) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-mode-hook '((lambda >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0nil (local-set-key " d" (quote >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0insert-date-heading)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key " =A0" (quote org-agenda)= ) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key "\232" (quote format-floa= t-column)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key " e" (quote org-example)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key " v" (quote org-verbatim)= ) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (local-set-key " q" (quote org-quote)) (= auto-fill-mode 1) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq org-agenda-window-setup (quote >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0other-window))) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#[nil "\300\301\302\303\304$\207" [org-ad= d-hook >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0change-major-mode-hook org-show-block-all= append >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0local] 5] #[nil "\300\301\302\303\304$\20= 7" >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[org-add-hook change-major-mode-hook >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-show-result-all append local] 5= ] >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-result-hide-spec >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-hide-all-hashes) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-ctrl-c-ctrl-c-hook '(org-babel-hash-a= t-point >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-execute-safely-maybe) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-confirm-elisp-link-function 'yes-or-n= o-p >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-export-interblocks '((lob >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org-babel-exp-lob-one-liners) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (src org-babel-exp-inlin= e-src-blocks)) >> org-occur-hook '(org-first-headline-recenter) >> org-from-is-user-regexp "\\" >> org-export-preprocess-before-selecting-backend-code-hook >> '(org-beamer-select-beamer-code) org-export-latex-final-hook >> '(org-beamer-amend-header org-beamer-fix-toc >> org-beamer-auto-fragile-frames >> org-beamer-place-default-actions-for-lists) org-metadown-hook >> '(org-babel-pop-to-session-maybe) org-export-blocks '((src >> org-babel-exp-src-blocks nil) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(comment org-export-blocks-format= -comment t) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(ditaa org-export-blocks-format-d= itaa nil) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(dot org-export-blocks-format-dot= nil)) >> ) >> >> >> > > --=20 Karypis Research Group Dept. of Computer Science University of Minnesota