emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Beamer title is (incorrectly?) outside of a frame
@ 2013-12-22 10:38 James Harkins
  2013-12-22 10:42 ` James Harkins
  0 siblings, 1 reply; 9+ messages in thread
From: James Harkins @ 2013-12-22 10:38 UTC (permalink / raw)
  To: orgmode

Hi,

Is there a reason why Beamer export does not place "\maketitle" in a frame?

The beamer user guide (I.3.4) specifies the following:

\begin{frame}
\titlepage
\end{frame}

But org-mode simply writes "\maketitle" outside of a frame.

This is important when you are using the same source to produce both a 
beamer presentation and a beamerarticle print version. For the 
presentation, you should use the ignorenonframetext class option, which 
omits everything that is not between \begin{frame} and \end{frame}. Since 
org doesn't write a frame for the title, then the title disappears.

Bug? I suspect so, as Beamer export is not following the format described 
in the beamer manual.

See also 
http://tex.stackexchange.com/questions/80277/beamer-with-ignorenonframetext-ignores-maketitle-command-too-why

hjh

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2013-12-22 10:38 Beamer title is (incorrectly?) outside of a frame James Harkins
@ 2013-12-22 10:42 ` James Harkins
  2013-12-22 13:36   ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: James Harkins @ 2013-12-22 10:42 UTC (permalink / raw)
  To: orgmode

On Sunday, December 22, 2013 6:38:02 PM HKT, James Harkins wrote:
> Hi,
>
> Is there a reason why Beamer export does not place "\maketitle" in a 
frame?
>
> The beamer user guide (I.3.4) specifies the following:
>
> \begin{frame}
> \titlepage
> \end{frame}
>
> But org-mode simply writes "\maketitle" outside of a frame.

Oh, I think I see the issue... there's only one org-latex-title-command.

     ;; 10. Title command.
     (org-element-normalize-string
      (cond ((string= "" title) nil)
	    ((not (stringp org-latex-title-command)) nil)
	    ((string-match "\\(?:[^%]\\|^\\)%s"
			   org-latex-title-command)
	     (format org-latex-title-command title))
	    (t org-latex-title-command)))

An isolated \maketitle is ok for articles, but not for Beamer. So I suppose 
it's incorrect to press the same variable into service for both.

hjh

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2013-12-22 10:42 ` James Harkins
@ 2013-12-22 13:36   ` Nicolas Goaziou
  2013-12-23  3:33     ` James Harkins
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2013-12-22 13:36 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

>> The beamer user guide (I.3.4) specifies the following:
>>
>> \begin{frame}
>> \titlepage
>> \end{frame}
>>
>> But org-mode simply writes "\maketitle" outside of a frame.
>
> Oh, I think I see the issue... there's only one org-latex-title-command.
>
>     ;; 10. Title command.
>     (org-element-normalize-string
>      (cond ((string= "" title) nil)
> 	    ((not (stringp org-latex-title-command)) nil)
> 	    ((string-match "\\(?:[^%]\\|^\\)%s"
> 			   org-latex-title-command)
> 	     (format org-latex-title-command title))
> 	    (t org-latex-title-command)))
>
> An isolated \maketitle is ok for articles, but not for Beamer. So
> I suppose it's incorrect to press the same variable into service for
> both.

I don't think the variable is problematic as you can wrap a frame around
it. Anyway, patch welcome.


Regards,

-- 
Nicolas Goaziou

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2013-12-22 13:36   ` Nicolas Goaziou
@ 2013-12-23  3:33     ` James Harkins
  2013-12-23  8:25       ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: James Harkins @ 2013-12-23  3:33 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Sunday, December 22, 2013 9:36:34 PM HKT, Nicolas Goaziou wrote:
>> Oh, I think I see the issue... there's only one org-latex-title-command.
>> 
>> ;; 10. Title command.
>> (org-element-normalize-string
>> (cond ((string= "" title) nil)
>> ((not (stringp org-latex-title-command)) nil)
>  ...
>
> I don't think the variable is problematic as you can wrap a frame around
> it. Anyway, patch welcome.

Sure, I can work on a patch. I'll need this in another month or so.

One question, though: How would I determine the LaTeX document class 
programmatically?

"Beamerarticle" uses the article class, with \usepackage{beamerarticle} in 
the preamble. This package redefines beamer commands so that they print 
somewhat reasonably well in article format. So, org needs to generate 
beamer-style commands, and that's done by the beamer backend.

That is:

Exporting as presentation (normal)
- Backend = beamer
- Document class = beamer

Exporting as article
- Backend = beamer
- Document class = article

In the former case, the title command should be wrapped in a frame. In the 
latter, it should not.

Currently, I'm working around it by #+bind'ing org-latex-title-command, but 
I'd like that to be automatic.

hjh

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2013-12-23  3:33     ` James Harkins
@ 2013-12-23  8:25       ` Nicolas Goaziou
  2013-12-26  5:50         ` James Harkins
       [not found]         ` <bc14736f-f98c-4112-8f54-b35dcb5416a9@dewdrop-world.net>
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2013-12-23  8:25 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

> One question, though: How would I determine the LaTeX document class
> programmatically?

  (plist-get info :latex-class)


Regards,

-- 
Nicolas Goaziou

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2013-12-23  8:25       ` Nicolas Goaziou
@ 2013-12-26  5:50         ` James Harkins
       [not found]         ` <bc14736f-f98c-4112-8f54-b35dcb5416a9@dewdrop-world.net>
  1 sibling, 0 replies; 9+ messages in thread
From: James Harkins @ 2013-12-26  5:50 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Monday, December 23, 2013 4:25:50 PM HKT, Nicolas Goaziou wrote:
> James Harkins <jamshark70@gmail.com> writes:
>
>> One question, though: How would I determine the LaTeX document class
>> programmatically?
>
>   (plist-get info :latex-class)

Thanks. I'm very busy now at the end of the semester, but I have this:

** TODO Beamer conditionally wrap title in frame
   (plist-get info :latex-class)

Definitely in January.

hjh

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

* Re: Beamer title is (incorrectly?) outside of a frame
       [not found]         ` <bc14736f-f98c-4112-8f54-b35dcb5416a9@dewdrop-world.net>
@ 2014-01-11  6:39           ` James Harkins
  2014-01-11  8:44             ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: James Harkins @ 2014-01-11  6:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Emacs-orgmode


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

On Monday, December 23, 2013 4:25:50 PM HKT, Nicolas Goaziou wrote:
>
> James Harkins <jamshark70@gmail.com> writes:
>
>> One question, though: How would I determine the LaTeX document class
>> programmatically?
>
>
>   (plist-get info :latex-class)

Patch attached. The patch is based on release_8.2.4 (as noted in my bug
report from a few minutes ago, I can't perform any Beamer export against
current master). If it doesn't apply against master, I'll be happy to tweak
it, once the other bug is fixed.

Let me know if there are any other problems, say, LISP style errors. I
wrapped my change in a (let...) to isolate it from other bits of the code.

Tests:

- Export to beamer, presentation mode, without ignorenonframetext option:
Title appears in its own frame, exactly as before.

- Export to beamer, presentation mode, *with* ignorenonframetext option:
Title appears in its own frame. Without the patch, the title frame was
missing.

- Export to beamer, using article class and the beamerarticle package:
Title appears, without begin/end{frame} (same behavior as without the
patch).

I haven't signed FSF papers, though... I guess I should get on that.

hjh

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

[-- Attachment #2: 0001-ox-beamer-Wrap-the-title-command-in-a-frame-for-beam.patch --]
[-- Type: text/x-patch, Size: 1858 bytes --]

From 1f70f3f41b266da204abd8dbcdddfefe648868eb Mon Sep 17 00:00:00 2001
From: James Harkins <jamshark70@dewdrop-world.net>
Date: Sat, 11 Jan 2014 11:59:32 +0800
Subject: [PATCH] ox-beamer: Wrap the title command in a frame for "beamer"
 class

This supports an option, described in the beamer user guide, for
supporting material using the beamerarticle package.

1. Write presentation contents in slides.
2. Write content /outside/ of slides for the print version.
3. To make #2 invisible in the slideshow, include "ignorenonframetext"
   in the LaTeX class options.

The problem was that Beamer export writes the title command outside of
a frame. So, the title frame disappears when using
ignorenonframetext. But, you don't want the title inside a frame for
article export.

The patch tests :latex-class. If it's "beamer," it adds \begin{frame}
before and \end{frame} after the title command.
---
 lisp/ox-beamer.el |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 2868944..9f8624f 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -871,13 +871,16 @@ holding export options."
      ;; 9. Document start.
      "\\begin{document}\n\n"
      ;; 10. Title command.
-     (org-element-normalize-string
+     (let ((titlecmd (org-element-normalize-string
       (cond ((string= "" title) nil)
 	    ((not (stringp org-latex-title-command)) nil)
 	    ((string-match "\\(?:[^%]\\|^\\)%s"
 			   org-latex-title-command)
 	     (format org-latex-title-command title))
-	    (t org-latex-title-command)))
+	    (t org-latex-title-command)))))
+       (if (string= (plist-get info :latex-class) "beamer")
+	   (format "\\begin{frame}%s\\end{frame}" titlecmd)
+	 titlecmd))
      ;; 11. Table of contents.
      (let ((depth (plist-get info :with-toc)))
        (when depth
-- 
1.7.9.5


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

* Re: Beamer title is (incorrectly?) outside of a frame
  2014-01-11  6:39           ` James Harkins
@ 2014-01-11  8:44             ` Nicolas Goaziou
  2014-01-11  8:49               ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2014-01-11  8:44 UTC (permalink / raw)
  To: jamshark70; +Cc: Emacs-orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

> Patch attached. The patch is based on release_8.2.4 (as noted in my bug
> report from a few minutes ago, I can't perform any Beamer export against
> current master). If it doesn't apply against master, I'll be happy to tweak
> it, once the other bug is fixed.

Thank you for the patch.

> Let me know if there are any other problems, say, LISP style errors. I
> wrapped my change in a (let...) to isolate it from other bits of the
> code.

Comments below.

> I haven't signed FSF papers, though... I guess I should get on that.

Good idea. Meanwhile, you need to add TINYCHANGE at the end of your
commit message.

> From 1f70f3f41b266da204abd8dbcdddfefe648868eb Mon Sep 17 00:00:00 2001
> From: James Harkins <jamshark70@dewdrop-world.net>
> Date: Sat, 11 Jan 2014 11:59:32 +0800
> Subject: [PATCH] ox-beamer: Wrap the title command in a frame for "beamer"
>  class

Here, you should specify the function modified and how it was modified.

* lisp/ox-beamer (org-beamer-template): ...

> This supports an option, described in the beamer user guide, for
> supporting material using the beamerarticle package.
>
> 1. Write presentation contents in slides.
> 2. Write content /outside/ of slides for the print version.
> 3. To make #2 invisible in the slideshow, include "ignorenonframetext"
>    in the LaTeX class options.
>
> The problem was that Beamer export writes the title command outside of
> a frame. So, the title frame disappears when using
> ignorenonframetext. But, you don't want the title inside a frame for
> article export.
>
> The patch tests :latex-class. If it's "beamer," it adds \begin{frame}
> before and \end{frame} after the title command.

Actually, I was wrong. `:latex-class' will contain the name given by the
user to its Beamer configuration. It may be totally unrelated to
"beamer".

You need to use a regexp to find out what class is used:

  (let ((beamer-class-p
         (and (stringp header)
              (org-string-match-p
               "^[ \t]*\\\\documentclass\\(?:\\[.*\\]\\)?{beamer}[ \t]*$"
               (nth 1 (assoc (plist-get info :latex-class) org-latex-classes)))))))

> +       (if (string= (plist-get info :latex-class) "beamer")
> +	   (format "\\begin{frame}%s\\end{frame}" titlecmd)
> +	 titlecmd))

You need to check if TITLECMD is nil before wrapping it within a frame.
Ideally before defining BEAMER-CLASS-P. 


Regards,

-- 
Nicolas Goaziou

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

* Re: Beamer title is (incorrectly?) outside of a frame
  2014-01-11  8:44             ` Nicolas Goaziou
@ 2014-01-11  8:49               ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2014-01-11  8:49 UTC (permalink / raw)
  To: jamshark70; +Cc: Emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> You need to use a regexp to find out what class is used:
>
>   (let ((beamer-class-p
>          (and (stringp header)
>               (org-string-match-p
>                "^[ \t]*\\\\documentclass\\(?:\\[.*\\]\\)?{beamer}[ \t]*$"
>                (nth 1 (assoc (plist-get info :latex-class) org-latex-classes)))))))

I meant:

  (let* ((header (nth 1 (assoc (plist-get info :latex-class) org-latex-classes)))
         (beamer-class-p
          (and (stringp header)
               (org-string-match-p
                "^[ \t]*\\\\documentclass\\(?:\\[.*\\]\\)?{beamer}[ \t]*$"
                header)))))

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

end of thread, other threads:[~2014-01-11  8:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-22 10:38 Beamer title is (incorrectly?) outside of a frame James Harkins
2013-12-22 10:42 ` James Harkins
2013-12-22 13:36   ` Nicolas Goaziou
2013-12-23  3:33     ` James Harkins
2013-12-23  8:25       ` Nicolas Goaziou
2013-12-26  5:50         ` James Harkins
     [not found]         ` <bc14736f-f98c-4112-8f54-b35dcb5416a9@dewdrop-world.net>
2014-01-11  6:39           ` James Harkins
2014-01-11  8:44             ` Nicolas Goaziou
2014-01-11  8:49               ` Nicolas Goaziou

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