From mboxrd@z Thu Jan 1 00:00:00 1970 From: Seb Frank Subject: Re: customizing org-beamer--format-frame Date: Sun, 27 Apr 2014 10:14:06 -0400 Message-ID: References: <87fvl09r7h.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01175f5dc9e56104f806cfdf Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WePqL-0002mG-4I for emacs-orgmode@gnu.org; Sun, 27 Apr 2014 10:14:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WePqJ-0005R3-Nz for emacs-orgmode@gnu.org; Sun, 27 Apr 2014 10:14:09 -0400 Received: from mail-ig0-x243.google.com ([2607:f8b0:4001:c05::243]:35245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WePqJ-0005Ql-GA for emacs-orgmode@gnu.org; Sun, 27 Apr 2014 10:14:07 -0400 Received: by mail-ig0-f195.google.com with SMTP id uq10so1154041igb.2 for ; Sun, 27 Apr 2014 07:14:06 -0700 (PDT) In-Reply-To: <87fvl09r7h.fsf@ucl.ac.uk> 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: Seb Frank , emacs-orgmode@gnu.org --089e01175f5dc9e56104f806cfdf Content-Type: text/plain; charset=UTF-8 Thanks so much! I was trying to get a bit more flexibility with that separate slide (e.g., have the title in the centre of the page and no toc). So I took inspiration from your great solution and defined a latex macro #+begin_src latex \newcommand{\singleslide}[1]{{% \usebeamerfont{title} \begin{frame}[plain,c] \begin{center} \begin{minipage}[h]{.75\textwidth} \centering \textcolor{title}{\Large#1} \end{minipage} \end{center} \end{frame} }} #+end_src and a latex class #+begin_src emacs-lisp (add-to-list 'org-latex-classes '("my-org-beamer" "\\documentclass{beamer} ("\\singleside{%s}" . "\\singleslide{%s}"))))) #+end_src which did the job. Best, Seb On Sat, Apr 26, 2014 at 9:05 AM, Eric S Fraga wrote: > On Friday, 25 Apr 2014 at 08:24, Seb Frank wrote: > > Hi there, > > > > I have customized org-beamer--format-frame to change the way headlines > are > > treated (as I want a separate slide with only the headline in the center > > and plain frames not showing headlines after that). The way I currently > do > > this is by redefining the function itself (using "defun > > org-beamer--format-frame"). This works, but is there any way to make this > > more modular, i.e. tell org-mode somewhere to use a different function > > (e.g., my-org-beamer--format-frame) to format a frame, so that it's easy > to > > switch back and forth between different ones, as well as to revert to the > > default? > > > > Thanks, > > Seb > > As you haven't explained why you want this, it's difficult to understand > the actual use case. So, guessing at your intent, I wonder whether you > have thought about making use of section headings as well as frame > headings to accomplish what you want? > > Assuming you are using org v8.x and not something older, if you set > option H:2, second level headings define frames and top level headings > define sections. You can then have section headings appear as a > separate slide using code such as this: > > #+begin_src org > ,#+latex_header: > \AtBeginSection[]{\begin{frame}\frametitle{Topic}\tableofcontents[currentsection]\end{frame}} > #+end_src > > In this case, any time a section heading is encountered (i.e. top level > org heading), you'll get a slide with a table of contents with that > heading emphasised. You can obviously do something different which more > closely matches what you want. > > If you don't want individual frames to have headings, simply don't put > any text in the headline for that frame. > > This way, you do not need to manipulate how beamer displays frames. An > example set of slides with two sections and two out of four slides > having no headline would look like this: > > #+begin_src org > ,#+options: H:2 > ,#+latex_header: > \AtBeginSection[]{\begin{frame}\frametitle{Topic}\tableofcontents[currentsection]\end{frame}} > ,* Introduction > ,** First slide > some text on the first slide > ,** > some text on the second slide which has no heading > ,* Results > ,** > some third slide text, also on a slide with no heading > ,** conclusions > This was a great talk. > #+end_src > > HTH, > eric > -- > : Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org > release_8.2.5h-1027-g4c0a29 > --089e01175f5dc9e56104f806cfdf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks so much! I was trying to get a bit more flexibility= with that separate slide (e.g., have the title in the centre of the page a= nd no toc). So I took inspiration from your great solution and defined a la= tex macro

#+begin_src latex
\newcommand{\singleslide}[1]{{%
=C2=A0=C2=A0=C2=A0 = \usebeamerfont{title}
=C2=A0=C2=A0=C2=A0 \begin{frame}[plain,c]
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 \begin{center}
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 \begin{minipage}[h]{.75\textwidth}
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \centering
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 \textcolor{title}{\Large#1}
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \end{minipage}
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 \end{center}
=C2=A0=C2=A0=C2=A0 \end{frame}
}}
#+end_src

and a latex class

#+begin_src emacs-lisp
(add-to-list 'org-latex-classes
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 '("my-org-beamer"
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 "\\documentclass{beamer}

("\\singleside= {%s}" . "\\singleslide{%s}")))))
#+end_src

which did the job.

Best,
=C2=A0 Seb

On Sat, Apr 26, 2014 at 9:05 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
On Friday, 25 Apr 2014 at 08:24, Seb Fran= k wrote:
> Hi there,
>
> I have customized org-beamer--format-frame to change the way headlines= are
> treated (as I want a separate slide with only the headline in the cent= er
> and plain frames not showing headlines after that). The way I currentl= y do
> this is by redefining the function itself (using "defun
> org-beamer--format-frame"). This works, but is there any way to m= ake this
> more modular, i.e. tell org-mode somewhere to use a different function=
> (e.g., my-org-beamer--format-frame) to format a frame, so that it'= s easy to
> switch back and forth between different ones, as well as to revert to = the
> default?
>
> Thanks,
> =C2=A0 Seb

As you haven't explained why you want this, it's diffic= ult to understand
the actual use case. =C2=A0So, guessing at your intent, I wonder whether yo= u
have thought about making use of section headings as well as frame
headings to accomplish what you want?

Assuming you are using org v8.x and not something older, if you set
option H:2, second level headings define frames and top level headings
define sections. =C2=A0You can then have section headings appear as a
separate slide using code such as this:

#+begin_src org
=C2=A0 ,#+latex_header: \AtBeginSection[]{\begin{frame}<beamer>\frame= title{Topic}\tableofcontents[currentsection]\end{frame}}
#+end_src

In this case, any time a section heading is encountered (i.e. top level
org heading), you'll get a slide with a table of contents with that
heading emphasised. =C2=A0You can obviously do something different which mo= re
closely matches what you want.

If you don't want individual frames to have headings, simply don't = put
any text in the headline for that frame.

This way, you do not need to manipulate how beamer displays frames. =C2=A0A= n
example set of slides with two sections and two out of four slides
having no headline would look like this:

#+begin_src org
=C2=A0 ,#+options: H:2
=C2=A0 ,#+latex_header: \AtBeginSection[]{\begin{frame}<beamer>\frame= title{Topic}\tableofcontents[currentsection]\end{frame}}
=C2=A0 ,* Introduction
=C2=A0 ,** First slide
=C2=A0 some text on the first slide
=C2=A0 ,**
=C2=A0 some text on the second slide which has no heading
=C2=A0 ,* Results
=C2=A0 ,**
=C2=A0 some third slide text, also on a slide with no heading
=C2=A0 ,** conclusions
=C2=A0 This was a great talk.
#+end_src

HTH,
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-1027-g4c0a= 29

--089e01175f5dc9e56104f806cfdf--