From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Property inheritance in beamer export [7.4] Date: Sun, 22 Apr 2012 16:37:26 +0200 Message-ID: References: <1CD72022-E05E-477E-8AF0-F569AE3F5FFA@gmail.com> Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:51992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLxv0-0007tj-GK for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 10:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SLxuy-00076p-3S for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 10:37:38 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:63930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLxux-00075t-OC for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 10:37:36 -0400 Received: by eaal1 with SMTP id l1so2945049eaa.0 for ; Sun, 22 Apr 2012 07:37:32 -0700 (PDT) In-Reply-To: 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: Chris Kauffman Cc: emacs-orgmode@gnu.org On 14.11.2011, at 17:51, Chris Kauffman wrote: > Hi Carsten >=20 > On Fri, Nov 11, 2011 at 10:58 AM, Carsten Dominik > wrote: >> Hi Chris, >>=20 >> On 11.11.2011, at 05:34, Chris Kauffman wrote: >>=20 >>>=20 >>> I use org for constructing simple slide presentations quite a >>> bit. I'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. >>=20 >> Have you read the beamer documentation? After reading about >> shrink, do you still mean to apply this evil thing? :) >>=20 >=20 > 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. >=20 > 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. >=20 >>> After some experimentation I put >>>=20 >>> #+PROPERTY: BEAMER_envargs [shrink] >>>=20 >>> in the preamble and evaluated >>>=20 >>> (set-variable (quote org-use-property-inheritance) t nil) >>>=20 >>> 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. >>=20 >> Yes, I agree this is what the documentation looks like. However, 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. >>=20 >=20 > A small note in the documentation to that effect might prevent > confusion from folks like me. >=20 > 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. I have merged the patch now. - Carsten >=20 > Cheers, > Chris >=20 >>> After >>> reloading the file, internally this seems to work fine: I move to >>> any heading and eval the following lisp >>>=20 >>> (org-entry-get (point) "BEAMER_envargs" 1) >>>=20 >>> which gives the result "[shrink]". >>>=20 >>> 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? >>=20 >> Could you please set in .emacs >>=20 >> (setq org-beamer-inherited-properties '("BEAMER_envargs")) >>=20 >> and then try the following experimental patch >>=20 >> = --------------------------------------------------------------------------= --------------- >> 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 during export." >> (looking-at ".*?:B_\\(note\\(NH\\)?\\):")) >> (push (cons "BEAMER_env" (match-string 1)) props)) >> + (when (org-bound-and-true-p = org-beamer-inherited-properties) >> + (mapc (lambda (p) >> + (unless (assoc p props) >> + (let ((v (org-entry-get nil p 'inherit))) >> + (and v (push (cons p v) props))))) >> + org-beamer-inherited-properties)) >> (put-text-property (point-at-bol) (point-at-eol) 'org-props = props))) >> (setq org-export-latex-options-plist >> = --------------------------------------------------------------------------= --------------- >>=20 >> - Carsten >>=20 >>>=20 >>> Cheers, >>> Chris >>>=20 >>> --Example .org File--- >>> #+TITLE: Java Lecture >>> #+AUTHOR: Christopher Kauffman >>> #+EMAIL: kauffman77@gmail.com >>> #+LANGUAGE: en >>> #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t = <:t >>> #+OPTIONS: 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] >>>=20 >>> * Example >>> Want this shrink >>> #+BEGIN_SRC java >>> public class Mouse{ >>> private int age =3D 0; // age of mouse in days >>> private double weight =3D 1.0; // weight of mouse in grams >>> private double percentGrowthRate; // % weight increase per day >>>=20 >>> // This method assigns the mouse's percent growth rate. >>> public void setPercentGrowthRate(double percentGrowthRate) { >>> this.percentGrowthRate =3D percentGrowthRate; >>> } >>>=20 >>> // This method simulates one day of growth for the mouse. >>> public void grow() { >>> this.weight +=3D (.01 * this.percentGrowthRate * this.weight); >>> this.age++; >>> } >>>=20 >>> // This method prints the mouses's age and weight. >>> public void display() { >>> System.out.printf( >>> "Age =3D %d, weight =3D %.3f\n", this.age, this.weight); >>> } >>> } >>> #+END_SRC >>>=20 >>> * Example >>> :PROPERTIES: >>> :BEAMER_envargs: [shrink] >>> :END: >>>=20 >>> Must add properties every time >>> #+BEGIN_SRC java >>> public class Mouse{ >>> private int age =3D 0; // age of mouse in days >>> private double weight =3D 1.0; // weight of mouse in grams >>> private double percentGrowthRate; // % weight increase per day >>>=20 >>> // This method assigns the mouse's percent growth rate. >>> public void setPercentGrowthRate(double percentGrowthRate) { >>> this.percentGrowthRate =3D percentGrowthRate; >>> } >>>=20 >>> // This method simulates one day of growth for the mouse. >>> public void grow() { >>> this.weight +=3D (.01 * this.percentGrowthRate * this.weight); >>> this.age++; >>> } >>>=20 >>> // This method prints the mouses's age and weight. >>> public void display() { >>> System.out.printf( >>> "Age =3D %d, weight =3D %.3f\n", this.age, this.weight); >>> } >>> } >>> #+END_SRC >>>=20 >>> --END EXAMPLE- >>>=20 >>> 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 >>> (local-set-key "\356" (quote >>> outline-next-visible-heading)) >>> (local-set-key "\360" (quote >>> outline-previous-visible-heading)) >>> (local-set-key (quote [f12]) (quote >>> ck-outline-toggle))) ) >>> org-babel-pre-tangle-hook '(save-buffer) >>> org-cycle-hook >>> '(org-cycle-hide-archived-subtrees >>> org-cycle-hide-drawers >>> org-cycle-show-empty-lines >>> org-optimize-window-after-visibility-change) >>> = org-export-preprocess-before-normalizing-links-hook >>> '(org-remove-file-link-modifiers) >>> org-mode-hook '((lambda >>> nil (local-set-key " d" (quote >>> insert-date-heading)) >>> (local-set-key " " (quote org-agenda)) >>> (local-set-key "\232" (quote format-float-column)) >>> (local-set-key " e" (quote org-example)) >>> (local-set-key " v" (quote org-verbatim)) >>> (local-set-key " q" (quote org-quote)) = (auto-fill-mode 1) >>> (setq org-agenda-window-setup (quote >>> other-window))) >>> #[nil "\300\301\302\303\304$\207" [org-add-hook >>> change-major-mode-hook org-show-block-all append >>> local] 5] #[nil "\300\301\302\303\304$\207" >>> [org-add-hook change-major-mode-hook >>> org-babel-show-result-all append local] 5] >>> org-babel-result-hide-spec >>> org-babel-hide-all-hashes) >>> org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point >>> org-babel-execute-safely-maybe) >>> org-confirm-elisp-link-function 'yes-or-no-p >>> org-export-interblocks '((lob >>> org-babel-exp-lob-one-liners) >>> (src org-babel-exp-inline-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) >>> (comment org-export-blocks-format-comment t) >>> (ditaa org-export-blocks-format-ditaa nil) >>> (dot org-export-blocks-format-dot nil)) >>> ) >>>=20 >>>=20 >>>=20 >>=20 >>=20 >=20 >=20 >=20 > --=20 > Karypis Research Group > Dept. of Computer Science > University of Minnesota