emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
@ 2015-03-09 21:56 Matthew Gidden
  2015-03-09 23:19 ` Nicolas Goaziou
  2015-03-09 23:50 ` Rasmus
  0 siblings, 2 replies; 10+ messages in thread
From: Matthew Gidden @ 2015-03-09 21:56 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 999 bytes --]

Hi folks,

I ran into the issue that many others have cited: an inability to add short
titles, etc., to org-mode-generated Beamer presentations [1, 2, 3]. This
patch allows such capability through a BEAMER_HEADER_EXTRA tag, which is
placed after title, author, etc., but before `\begin{document}`.  Short
titles, for example, can now be added via

```
#+BEAMER_HEADER_EXTRA: \title[A Short Title]{ \inserttitle }
```

Something like this appears to have been in the original org-beamer.el, but
was not present in the current master HEAD ox-beamer.el. If the
community/BD deems this to be worthy, I'd be happy to clean it up as needed.

Cheers,
Matt

[1] http://comments.gmane.org/gmane.emacs.orgmode/57450
[2] https://lists.gnu.org/archive/html/emacs-orgmode/2011-01/msg00176.html
[3]
http://stackoverflow.com/questions/26760125/org-mode-beamer-how-to-create-a-short-title-author-date


-- 
Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

[-- Attachment #1.2: Type: text/html, Size: 1577 bytes --]

[-- Attachment #2: 0001-adds-a-BEAMER_HEADER_EXTRA-tag-that-can-be-used-to-i.patch --]
[-- Type: text/x-patch, Size: 3407 bytes --]

From e666fc06512dad866a10dd763c3d42117dfff31f Mon Sep 17 00:00:00 2001
From: Matthew Gidden <matthew.gidden@gmail.com>
Date: Mon, 9 Mar 2015 16:25:15 -0500
Subject: [PATCH] adds a BEAMER_HEADER_EXTRA tag that can be used to inject
 code after title, author, etc. but before \begin{document}

---
 lisp/ox-beamer.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e10d36c..d15e5b0 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -239,7 +239,8 @@ Return overlay specification, as a string, or nil."
     (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
     (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
     (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
-    (:beamer-header-extra "BEAMER_HEADER" nil nil newline)
+    (:beamer-header "BEAMER_HEADER" nil nil newline)
+    (:beamer-header-extra "BEAMER_HEADER_EXTRA" nil nil newline)
     (:beamer-environments-extra nil nil org-beamer-environments-extra)
     (:beamer-frame-default-options nil nil org-beamer-frame-default-options)
     (:beamer-outline-frame-options nil nil org-beamer-outline-frame-options)
@@ -826,7 +827,7 @@ holding export options."
 		      (plist-get info :latex-header))
 		     (org-element-normalize-string
 		      (plist-get info :latex-header-extra))
-		     (plist-get info :beamer-header-extra)))))
+		     (plist-get info :beamer-header)))))
 	  info)))
      ;; 3. Insert themes.
      (let ((format-theme
@@ -866,16 +867,20 @@ holding export options."
        (format "\\date{%s}\n" (org-export-data date info)))
      ;; 7. Title
      (format "\\title{%s}\n" title)
-     ;; 8. Hyperref options.
+     ;; 8. Beamer-header-extras
+     (let ((beamer-header-extra (plist-get info :beamer-header-extra)))
+       (when beamer-header-extra
+	 (format "%s\n" (plist-get info :beamer-header-extra))))
+     ;; 9. Hyperref options.
      (when (plist-get info :latex-hyperref-p)
        (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
 	       (or (plist-get info :keywords) "")
 	       (or (plist-get info :description) "")
 	       (if (not (plist-get info :with-creator)) ""
 		 (plist-get info :creator))))
-     ;; 9. Document start.
+     ;; 10. Document start.
      "\\begin{document}\n\n"
-     ;; 10. Title command.
+     ;; 11. Title command.
      (org-element-normalize-string
       (cond ((not (plist-get info :with-title)) nil)
 	    ((string= "" title) nil)
@@ -884,7 +889,7 @@ holding export options."
 			   org-latex-title-command)
 	     (format org-latex-title-command title))
 	    (t org-latex-title-command)))
-     ;; 11. Table of contents.
+     ;; 12. Table of contents.
      (let ((depth (plist-get info :with-toc)))
        (when depth
 	 (concat
@@ -896,16 +901,16 @@ holding export options."
 	    (format "\\setcounter{tocdepth}{%d}\n" depth))
 	  "\\tableofcontents\n"
 	  "\\end{frame}\n\n")))
-     ;; 12. Document's body.
+     ;; 13. Document's body.
      contents
-     ;; 13. Creator.
+     ;; 14. Creator.
      (let ((creator-info (plist-get info :with-creator)))
        (cond
 	((not creator-info) "")
 	((eq creator-info 'comment)
 	 (format "%% %s\n" (plist-get info :creator)))
 	(t (concat (plist-get info :creator) "\n"))))
-     ;; 14. Document end.
+     ;; 15. Document end.
      "\\end{document}")))
 
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-09 21:56 [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc Matthew Gidden
@ 2015-03-09 23:19 ` Nicolas Goaziou
  2015-03-09 23:46   ` Matthew Gidden
  2015-03-09 23:50 ` Rasmus
  1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-03-09 23:19 UTC (permalink / raw)
  To: Matthew Gidden; +Cc: emacs-orgmode

Hello,

Matthew Gidden <gidden@wisc.edu> writes:

> I ran into the issue that many others have cited: an inability to add short
> titles, etc. to org-mode-generated Beamer presentations [1, 2, 3]. This
> patch allows such capability through a BEAMER_HEADER_EXTRA tag, which is
> placed after title, author, etc., but before `\begin{document}`.  Short
> titles, for example, can now be added via
>
> ```
> #+BEAMER_HEADER_EXTRA: \title[A Short Title]{ \inserttitle }
> ```

Thanks for the patch. 

BEAMER_HEADER_EXTRA is not a good name, as LATEX_HEADER_EXTRA means
something entirely different. If it's just about short titles, we could
add a BEAMER_SHORT_TITLE keyword.

However what is in the "etc." above?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-09 23:19 ` Nicolas Goaziou
@ 2015-03-09 23:46   ` Matthew Gidden
  2015-03-10 14:44     ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Gidden @ 2015-03-09 23:46 UTC (permalink / raw)
  To: Matthew Gidden, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2370 bytes --]

HI Nic,



On Mon, Mar 9, 2015 at 6:19 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Matthew Gidden <gidden@wisc.edu> writes:
>
> > I ran into the issue that many others have cited: an inability to add
> short
> > titles, etc. to org-mode-generated Beamer presentations [1, 2, 3]. This
> > patch allows such capability through a BEAMER_HEADER_EXTRA tag, which is
> > placed after title, author, etc., but before `\begin{document}`.  Short
> > titles, for example, can now be added via
> >
> > ```
> > #+BEAMER_HEADER_EXTRA: \title[A Short Title]{ \inserttitle }
> > ```
>
> Thanks for the patch.
>
> BEAMER_HEADER_EXTRA is not a good name, as LATEX_HEADER_EXTRA means
> something entirely different. If it's just about short titles, we could
> add a BEAMER_SHORT_TITLE keyword.
>
> However what is in the "etc." above?

In many outerthemes (i.e., the beamer header and footer formatting), the
"short" version of title, author, institution, and date are used. While
this is the (my) primary use case I can think of, the positioning
<something other than>BEAMER_HEADER_EXTRA serves as final preamble
injection point. I just reread your discussion with Sebastien [1] and agree
the proposed name is bad.

From what I can tell, the current ox-beamer.el does not support beamer's
institution macor or the short version of title, author, institution or
date. I can think of two options to get around this:

   - do not use #+Title, etc., and simply use BEAMER_HEADER or similar
   - use #+Title plus something like this patch to inject fixes *after*
   \title

As a user, I prefer the latter, because it maximizes the portability of my
code (so I can use something like org-reveal [2]).

Another option would be to simply move BEAMER_HEADER to inject code where I
have implemented BEAMER_HEADER_EXTRA. That would provide the same
functionality with a reasonable name. I still need to better format my
commit message (I forgot to before submitting), so I can make any other
updates that are deemed necessary.

Let me know what you (and others) think.

Cheers,
Matt

[1] http://comments.gmane.org/gmane.emacs.orgmode/78582
[2]
http://orgmode.org/worg/org-tutorials/non-beamer-presentations.html#sec-6

>
>
> Regards,
>
> --
> Nicolas Goaziou
>



-- 
Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

[-- Attachment #2: Type: text/html, Size: 3664 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-09 21:56 [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc Matthew Gidden
  2015-03-09 23:19 ` Nicolas Goaziou
@ 2015-03-09 23:50 ` Rasmus
  1 sibling, 0 replies; 10+ messages in thread
From: Rasmus @ 2015-03-09 23:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi Matthew,

Matthew Gidden <gidden@wisc.edu> writes:

Thanks for the patch.

> I ran into the issue that many others have cited: an inability to add short
> titles, etc., to org-mode-generated Beamer presentations [1, 2, 3]. This
> patch allows such capability through a BEAMER_HEADER_EXTRA tag, which is
> placed after title, author, etc., but before `\begin{document}`.  Short
> titles, for example, can now be added via
>
> ```
> #+BEAMER_HEADER_EXTRA: \title[A Short Title]{ \inserttitle }
> ```

From you patch, it seems that you want to adds something akin
to #+LATEX_HEADER or #+LATEX_HEADER_EXTRA.  IOW there's no formatting
going on and these lines expect raw latex code.

Could you not get the same by using org-latex-classes?  Or at the latex
level solution could presumably be archived with etoolbox.  Anyway,
another keyword doesn't hurt anybody.

—Rasmus

-- 
It was you, Jezebel, it was you

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-09 23:46   ` Matthew Gidden
@ 2015-03-10 14:44     ` Nicolas Goaziou
  2015-03-10 14:45       ` Matthew Gidden
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-03-10 14:44 UTC (permalink / raw)
  To: Matthew Gidden; +Cc: emacs-orgmode

Matthew Gidden <gidden@wisc.edu> writes:

> Another option would be to simply move BEAMER_HEADER to inject code where I
> have implemented BEAMER_HEADER_EXTRA. That would provide the same
> functionality with a reasonable name. I still need to better format my
> commit message (I forgot to before submitting), so I can make any other
> updates that are deemed necessary.

Fair enough. We can insert BEAMER_HEADER lines later and use
LATEX_HEADER for early lines.

Regards,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-10 14:44     ` Nicolas Goaziou
@ 2015-03-10 14:45       ` Matthew Gidden
  2015-03-10 15:15         ` Matthew Gidden
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Gidden @ 2015-03-10 14:45 UTC (permalink / raw)
  To: Matthew Gidden, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

On Tue, Mar 10, 2015 at 9:44 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Matthew Gidden <gidden@wisc.edu> writes:
>
> > Another option would be to simply move BEAMER_HEADER to inject code
> where I
> > have implemented BEAMER_HEADER_EXTRA. That would provide the same
> > functionality with a reasonable name. I still need to better format my
> > commit message (I forgot to before submitting), so I can make any other
> > updates that are deemed necessary.
>
> Fair enough. We can insert BEAMER_HEADER lines later and use
> LATEX_HEADER for early lines.
>
I was writing a longer email confirming that I think this is the best way
forward. I'll update the source and commit message and reply to this with a
new patch. Let me know if I should make a new mail instead.

Cheers,
Matt

>
> Regards,
>



-- 
Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

[-- Attachment #2: Type: text/html, Size: 1611 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-10 14:45       ` Matthew Gidden
@ 2015-03-10 15:15         ` Matthew Gidden
  2015-03-10 15:44           ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Gidden @ 2015-03-10 15:15 UTC (permalink / raw)
  To: Matthew Gidden, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1215 bytes --]

Updated patch with updated commit message attached.

On Tue, Mar 10, 2015 at 9:45 AM, Matthew Gidden <gidden@wisc.edu> wrote:

>
>
> On Tue, Mar 10, 2015 at 9:44 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Matthew Gidden <gidden@wisc.edu> writes:
>>
>> > Another option would be to simply move BEAMER_HEADER to inject code
>> where I
>> > have implemented BEAMER_HEADER_EXTRA. That would provide the same
>> > functionality with a reasonable name. I still need to better format my
>> > commit message (I forgot to before submitting), so I can make any other
>> > updates that are deemed necessary.
>>
>> Fair enough. We can insert BEAMER_HEADER lines later and use
>> LATEX_HEADER for early lines.
>>
> I was writing a longer email confirming that I think this is the best way
> forward. I'll update the source and commit message and reply to this with a
> new patch. Let me know if I should make a new mail instead.
>
> Cheers,
> Matt
>
>>
>> Regards,
>>
>
>
>
> --
> Matthew Gidden
> Ph.D. Candidate, Nuclear Engineering
> The University of Wisconsin -- Madison
> Ph. 225.892.3192
>



-- 
Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

[-- Attachment #1.2: Type: text/html, Size: 2357 bytes --]

[-- Attachment #2: 0001-org-beamer.el-Enable-custom-beamer-input-before-begi.patch --]
[-- Type: text/x-patch, Size: 3703 bytes --]

From dd0ac869afb9f13ce4d893bb34599864a9d43253 Mon Sep 17 00:00:00 2001
From: Matthew Gidden <matthew.gidden@gmail.com>
Date: Mon, 9 Mar 2015 16:25:15 -0500
Subject: [PATCH] org-beamer.el: Enable custom beamer input before
 \begin{document}

* lisp/ox-beamer.el (`beamer-header'): Move BEAMER_HEADER injection to
  final part of preamble (after themes, title, etc.). Allows for
  custom short titles, etc., with #+BEAMER_HEADER: \title[Short]{Long}.

Previously, TITLE was being injected after BEAMER_HEADER, so short
titles (and related) could not be added. BEAMER_HEADER now serves as a
final preamble injection point.

TINYCHANGE
---
 lisp/ox-beamer.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e10d36c..359ccdc 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -239,7 +239,7 @@ Return overlay specification, as a string, or nil."
     (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
     (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
     (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
-    (:beamer-header-extra "BEAMER_HEADER" nil nil newline)
+    (:beamer-header "BEAMER_HEADER" nil nil newline)
     (:beamer-environments-extra nil nil org-beamer-environments-extra)
     (:beamer-frame-default-options nil nil org-beamer-frame-default-options)
     (:beamer-outline-frame-options nil nil org-beamer-outline-frame-options)
@@ -825,8 +825,7 @@ holding export options."
 	     (concat (org-element-normalize-string
 		      (plist-get info :latex-header))
 		     (org-element-normalize-string
-		      (plist-get info :latex-header-extra))
-		     (plist-get info :beamer-header-extra)))))
+		      (plist-get info :latex-header-extra))))))
 	  info)))
      ;; 3. Insert themes.
      (let ((format-theme
@@ -866,16 +865,20 @@ holding export options."
        (format "\\date{%s}\n" (org-export-data date info)))
      ;; 7. Title
      (format "\\title{%s}\n" title)
-     ;; 8. Hyperref options.
+     ;; 8. Beamer-header
+     (let ((beamer-header (plist-get info :beamer-header)))
+       (when beamer-header
+	 (format "%s\n" (plist-get info :beamer-header))))
+     ;; 9. Hyperref options.
      (when (plist-get info :latex-hyperref-p)
        (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
 	       (or (plist-get info :keywords) "")
 	       (or (plist-get info :description) "")
 	       (if (not (plist-get info :with-creator)) ""
 		 (plist-get info :creator))))
-     ;; 9. Document start.
+     ;; 10. Document start.
      "\\begin{document}\n\n"
-     ;; 10. Title command.
+     ;; 11. Title command.
      (org-element-normalize-string
       (cond ((not (plist-get info :with-title)) nil)
 	    ((string= "" title) nil)
@@ -884,7 +887,7 @@ holding export options."
 			   org-latex-title-command)
 	     (format org-latex-title-command title))
 	    (t org-latex-title-command)))
-     ;; 11. Table of contents.
+     ;; 12. Table of contents.
      (let ((depth (plist-get info :with-toc)))
        (when depth
 	 (concat
@@ -896,16 +899,16 @@ holding export options."
 	    (format "\\setcounter{tocdepth}{%d}\n" depth))
 	  "\\tableofcontents\n"
 	  "\\end{frame}\n\n")))
-     ;; 12. Document's body.
+     ;; 13. Document's body.
      contents
-     ;; 13. Creator.
+     ;; 14. Creator.
      (let ((creator-info (plist-get info :with-creator)))
        (cond
 	((not creator-info) "")
 	((eq creator-info 'comment)
 	 (format "%% %s\n" (plist-get info :creator)))
 	(t (concat (plist-get info :creator) "\n"))))
-     ;; 14. Document end.
+     ;; 15. Document end.
      "\\end{document}")))
 
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-10 15:15         ` Matthew Gidden
@ 2015-03-10 15:44           ` Nicolas Goaziou
  2015-03-10 16:10             ` Matthew Gidden
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-03-10 15:44 UTC (permalink / raw)
  To: Matthew Gidden; +Cc: emacs-orgmode

Matthew Gidden <gidden@wisc.edu> writes:

> Updated patch with updated commit message attached.

Thank you.

> Subject: [PATCH] org-beamer.el: Enable custom beamer input before
>  \begin{document}

"ox-beamer". Also the summary is too long.

> * lisp/ox-beamer.el (`beamer-header'): Move BEAMER_HEADER injection to
>   final part of preamble (after themes, title, etc.). Allows for
>   custom short titles, etc., with #+BEAMER_HEADER: \title[Short]{Long}.
>
> Previously, TITLE was being injected after BEAMER_HEADER, so short
> titles (and related) could not be added. BEAMER_HEADER now serves as a
> final preamble injection point.

Two spaces are required after sentences.

Otherwise, the patch looks good.

Could you add a footnote about this change at (info "(org) Beamer
export"), close to #+BEAMER_HEADER reference, in "org.texi"?


Regards,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-10 15:44           ` Nicolas Goaziou
@ 2015-03-10 16:10             ` Matthew Gidden
  2015-03-10 20:22               ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Gidden @ 2015-03-10 16:10 UTC (permalink / raw)
  To: Matthew Gidden, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1119 bytes --]

Updated patch attached

On Tue, Mar 10, 2015 at 10:44 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Matthew Gidden <gidden@wisc.edu> writes:
>
> > Updated patch with updated commit message attached.
>
> Thank you.
>
> > Subject: [PATCH] org-beamer.el: Enable custom beamer input before
> >  \begin{document}
>
> "ox-beamer". Also the summary is too long.
>
> > * lisp/ox-beamer.el (`beamer-header'): Move BEAMER_HEADER injection to
> >   final part of preamble (after themes, title, etc.). Allows for
> >   custom short titles, etc., with #+BEAMER_HEADER: \title[Short]{Long}.
> >
> > Previously, TITLE was being injected after BEAMER_HEADER, so short
> > titles (and related) could not be added. BEAMER_HEADER now serves as a
> > final preamble injection point.
>
> Two spaces are required after sentences.
>
> Otherwise, the patch looks good.
>
> Could you add a footnote about this change at (info "(org) Beamer
> export"), close to #+BEAMER_HEADER reference, in "org.texi"?
>
>
> Regards,
>



-- 
Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

[-- Attachment #1.2: Type: text/html, Size: 1752 bytes --]

[-- Attachment #2: 0001-ox-beamer.el-Update-BEAMER_HEADER-placement.patch --]
[-- Type: text/x-patch, Size: 4787 bytes --]

From 08f163ee4891e49d8884e7c43418b9091badfb11 Mon Sep 17 00:00:00 2001
From: Matthew Gidden <matthew.gidden@gmail.com>
Date: Mon, 9 Mar 2015 16:25:15 -0500
Subject: [PATCH] ox-beamer.el: Update BEAMER_HEADER placement

* lisp/ox-beamer.el (`beamer-header'): Move BEAMER_HEADER injection to
  final part of preamble (after themes, title, etc.).  Allows for
  custom short titles, etc., with #+BEAMER_HEADER:
  \title[Short]{Long}.

* doc/org.texi: Updated BEAMER_HEADER entry with a relevant footnote.

Previously, TITLE, etc., was being injected after BEAMER_HEADER, so
short titles (and related) could not be added.  BEAMER_HEADER now
serves as a final preamble injection point.

TINYCHANGE
---
 doc/org.texi      |  8 +++++---
 lisp/ox-beamer.el | 23 +++++++++++++----------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index edb6cf0..6c72302 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11038,9 +11038,11 @@ Beamer export introduces a number of keywords to insert code in the
 document's header.  Four control appearance of the presentation:
 @code{#+BEAMER_THEME}, @code{#+BEAMER_COLOR_THEME},
 @code{#+BEAMER_FONT_THEME}, @code{#+BEAMER_INNER_THEME} and
-@code{#+BEAMER_OUTER_THEME}.  All of them accept optional arguments
-within square brackets.  The last one, @code{#+BEAMER_HEADER}, is more
-generic and allows you to append any line of code in the header.
+@code{#+BEAMER_OUTER_THEME}.  All of them accept optional arguments within
+square brackets.  The last one, @code{#+BEAMER_HEADER}, is more generic and
+allows you to append any line of code in the header@footnote{Lines are
+appended at the end of the header/preamble, allowing for any final
+customization such as the inclusion of short titles}.
 
 @example
 #+BEAMER_THEME: Rochester [height=20pt]
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e10d36c..359ccdc 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -239,7 +239,7 @@ Return overlay specification, as a string, or nil."
     (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
     (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
     (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
-    (:beamer-header-extra "BEAMER_HEADER" nil nil newline)
+    (:beamer-header "BEAMER_HEADER" nil nil newline)
     (:beamer-environments-extra nil nil org-beamer-environments-extra)
     (:beamer-frame-default-options nil nil org-beamer-frame-default-options)
     (:beamer-outline-frame-options nil nil org-beamer-outline-frame-options)
@@ -825,8 +825,7 @@ holding export options."
 	     (concat (org-element-normalize-string
 		      (plist-get info :latex-header))
 		     (org-element-normalize-string
-		      (plist-get info :latex-header-extra))
-		     (plist-get info :beamer-header-extra)))))
+		      (plist-get info :latex-header-extra))))))
 	  info)))
      ;; 3. Insert themes.
      (let ((format-theme
@@ -866,16 +865,20 @@ holding export options."
        (format "\\date{%s}\n" (org-export-data date info)))
      ;; 7. Title
      (format "\\title{%s}\n" title)
-     ;; 8. Hyperref options.
+     ;; 8. Beamer-header
+     (let ((beamer-header (plist-get info :beamer-header)))
+       (when beamer-header
+	 (format "%s\n" (plist-get info :beamer-header))))
+     ;; 9. Hyperref options.
      (when (plist-get info :latex-hyperref-p)
        (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
 	       (or (plist-get info :keywords) "")
 	       (or (plist-get info :description) "")
 	       (if (not (plist-get info :with-creator)) ""
 		 (plist-get info :creator))))
-     ;; 9. Document start.
+     ;; 10. Document start.
      "\\begin{document}\n\n"
-     ;; 10. Title command.
+     ;; 11. Title command.
      (org-element-normalize-string
       (cond ((not (plist-get info :with-title)) nil)
 	    ((string= "" title) nil)
@@ -884,7 +887,7 @@ holding export options."
 			   org-latex-title-command)
 	     (format org-latex-title-command title))
 	    (t org-latex-title-command)))
-     ;; 11. Table of contents.
+     ;; 12. Table of contents.
      (let ((depth (plist-get info :with-toc)))
        (when depth
 	 (concat
@@ -896,16 +899,16 @@ holding export options."
 	    (format "\\setcounter{tocdepth}{%d}\n" depth))
 	  "\\tableofcontents\n"
 	  "\\end{frame}\n\n")))
-     ;; 12. Document's body.
+     ;; 13. Document's body.
      contents
-     ;; 13. Creator.
+     ;; 14. Creator.
      (let ((creator-info (plist-get info :with-creator)))
        (cond
 	((not creator-info) "")
 	((eq creator-info 'comment)
 	 (format "%% %s\n" (plist-get info :creator)))
 	(t (concat (plist-get info :creator) "\n"))))
-     ;; 14. Document end.
+     ;; 15. Document end.
      "\\end{document}")))
 
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc.
  2015-03-10 16:10             ` Matthew Gidden
@ 2015-03-10 20:22               ` Nicolas Goaziou
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2015-03-10 20:22 UTC (permalink / raw)
  To: Matthew Gidden; +Cc: emacs-orgmode

Matthew Gidden <gidden@wisc.edu> writes:

> Updated patch attached

Applied. Thank you.


Regards,

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-10 20:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 21:56 [PATCH] Adding a BEAMER_HEADER_EXTRA tag, allows short titles, etc Matthew Gidden
2015-03-09 23:19 ` Nicolas Goaziou
2015-03-09 23:46   ` Matthew Gidden
2015-03-10 14:44     ` Nicolas Goaziou
2015-03-10 14:45       ` Matthew Gidden
2015-03-10 15:15         ` Matthew Gidden
2015-03-10 15:44           ` Nicolas Goaziou
2015-03-10 16:10             ` Matthew Gidden
2015-03-10 20:22               ` Nicolas Goaziou
2015-03-09 23:50 ` Rasmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).