emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Property inheritance in beamer export [7.4]


From: Chris Kauffman
Subject: Re: [O] Property inheritance in beamer export [7.4]
Date: Mon, 14 Nov 2011 10:51:47 -0600

Hi Carsten

On Fri, Nov 11, 2011 at 10:58 AM, Carsten Dominik
<address@hidden> wrote:
> Hi Chris,
>
> On 11.11.2011, at 05:34, Chris Kauffman wrote:
>
>>
>> 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.
>
> Have you read the beamer documentation?  After reading about
> shrink, do you still mean to apply this evil thing?   :)
>

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.  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.
>

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 
> 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
> -----------------------------------------------------------------------------------------
>
> - Carsten
>
>>
>> Cheers,
>> Chris
>>
>> --Example .org File---
>> #+TITLE:     Java Lecture
>> #+AUTHOR:    Christopher Kauffman
>> #+EMAIL:     address@hidden
>> #+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]
>>
>> * Example
>> Want this shrink
>> #+BEGIN_SRC java
>> public class Mouse{
>>   private int age = 0;              // age of mouse in days
>>   private double weight = 1.0;      // weight of mouse in grams
>>   private double percentGrowthRate; // % weight increase per day
>>
>>   // This method assigns the mouse's percent growth rate.
>>   public void setPercentGrowthRate(double percentGrowthRate) {
>>     this.percentGrowthRate = percentGrowthRate;
>>   }
>>
>>   // This method simulates one day of growth for the mouse.
>>   public void grow() {
>>     this.weight += (.01 * this.percentGrowthRate * this.weight);
>>     this.age++;
>>   }
>>
>>   // This method prints the mouses's age and weight.
>>   public void display() {
>>     System.out.printf(
>>       "Age = %d, weight = %.3f\n", this.age, this.weight);
>>   }
>> }
>> #+END_SRC
>>
>> * Example
>> :PROPERTIES:
>> :BEAMER_envargs: [shrink]
>> :END:
>>
>> Must add properties every time
>> #+BEGIN_SRC java
>> public class Mouse{
>>   private int age = 0;              // age of mouse in days
>>   private double weight = 1.0;      // weight of mouse in grams
>>   private double percentGrowthRate; // % weight increase per day
>>
>>   // This method assigns the mouse's percent growth rate.
>>   public void setPercentGrowthRate(double percentGrowthRate) {
>>     this.percentGrowthRate = percentGrowthRate;
>>   }
>>
>>   // This method simulates one day of growth for the mouse.
>>   public void grow() {
>>     this.weight += (.01 * this.percentGrowthRate * this.weight);
>>     this.age++;
>>   }
>>
>>   // This method prints the mouses's age and weight.
>>   public void display() {
>>     System.out.printf(
>>       "Age = %d, weight = %.3f\n", this.age, this.weight);
>>   }
>> }
>> #+END_SRC
>>
>> --END EXAMPLE-
>>
>> current state:
>> ==============
>> (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 "\\<kauffman\\>"
>> 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))
>> )
>>
>>
>>
>
>



-- 
Karypis Research Group
Dept. of Computer Science
University of Minnesota



reply via email to

[Prev in Thread] Current Thread [Next in Thread]