2

I have some trouble with beamer: I start with a simple example:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{default}
\begin{document}
\begin{frame}
    first frame
\end{frame}
\end{document}

now I want to add some "logic", so I want to define something that helps me to controll the begin of the frames:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{default}
\newcommand{\myframe}{\begin{frame}}
\newcommand{\myend}{\end{frame}}
\begin{document}
\myframe
    first frame
\myend
\myframe
    second frame
\myend
\end{document}

and get errors when compiling:

Runaway argument?
\let \AtEndDocument \@firstofone \@enddocumenthook \@checkend {docume\ETC.
! File ended while scanning use of \beamer@collect@@body

Any Idea how can I redefine the beginning of beamer frames?

added simple example for if/then/else:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{default}
\usepackage{ifthen}
\newcommand{\myframe}{\begin{frame}}
\newcommand{\myend}{\end{frame}}
\newboolean{boolvar}
\setboolean{boolvar}{false}
\begin{document}
\begin{frame}
        \ifthenelse{\boolean{boolvar}}{truecase}{falsecase}
\end{frame}
\end{document}

I want to have slides with different frametitels and/or subtitles, one of the problems are the repeated frametitles in articlemode. And I can't use allowframebreaks because that will break overlays including /pause. So the easiest solution, I guess, would be adding new frames (/end{frame}/begin{frame}{/oldframetitle}{newsubtitle}) for second/third slide of frame when in presentation mode and when in article mode ignore it or just add a newline or maybe the new subtile as a paragraph headline.

So the idea is:

\documentclass{beamer}
\newcommand{\nextslideyesno}{\ifthenelse{\boolean{boolvar}}{\end{frame}\begin{frame}}{falsecase}}
\usepackage[utf8]{inputenc}
\usepackage{default}
\newcommand{\myframe}{\begin{frame}}
\newcommand{\myend}{\end{frame}}
\begin{document}
\begin{frame}
    first text
\nextslideyesno{}
    second text
\end{frame}
\end{document}

but it also returns lots of errors.

4
  • Why don't you just use \frame{ contents} no re-defining needed!
    – user11232
    Commented Jan 30, 2015 at 23:11
  • Because I want to do something like "if variable had been defined in last frame make new frame, if not do something else", but I ran into problems at early stage Commented Jan 30, 2015 at 23:15
  • Can you add the conditional with a sample use case?
    – user11232
    Commented Jan 30, 2015 at 23:16
  • You may want to use \newenvironment to define a myframe environment instead.
    – Herr K.
    Commented Jan 30, 2015 at 23:27

1 Answer 1

1

No need to redefine frame; if I understand your question correctly, you can use overlays and \mode.

Here's a simple example document:

\documentclass{beamer}
%\documentclass{article}
%\usepackage{beamerarticle}

\begin{document}

\begin{frame}
\frametitle{%
  \mode<presentation>{%
    \only<1>{Title A}%
    \only<2>{Title B}%
    \only<3>{Title C}%
  }%
  \mode<article>{\noindent Title for article}%
}
\framesubtitle{%
  \mode<presentation>{%
    \only<1>{Subtitle A}%
    \only<2>{Subtitle B}%
    \only<3>{Subtitle C}%
  }%
  \mode<article>{\noindent Subtitle for article}%
}
Here is the contents of the frame with a list:
\begin{enumerate}[<+->]
\item First.
\item Second.
\item Third.
\end{enumerate}
\end{frame}

\end{document}

Processing the above code, as is you will get a presentation with one frame having three slides; each slide has its own title and subtitle and overlays are used to reveal a list stepwise:

enter image description here

Now using article mode; i.e., changing to

%\documentclass{beamer}
\documentclass{article}
\usepackage{beamerarticle}

you obtain the following result (notice that there's just one title and subtitle):

enter image description here

2
  • Thanks for the example, I tried but unfortunatly it didnt work, I need "framebreaks" because some content has to be put on the next slide. But using [allowframebreaks] breaks other things. Therefore I assume it has to be the more complicated way: simulation of framebreaks by creating new slides via if/then/else. Commented Feb 1, 2015 at 10:04
  • @user2567875 Sorry, but with such a vague description, little more can be offered. Please, instead of vague descriptions, add to your question a real case scenario showing your real intent. Commented Feb 1, 2015 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .