7

I'm working on wrapping up some patterns used in my research group for creating posters. Since we're using beamer and beamerposter to make these, all documents go essentially like this:

\documentclass{beamer}

\begin{document}
\begin{frame}

\end{frame}
\end{document}

I'd like to simplify this to like:

\documentclass{ourposter}

\begin{poster}

\end{poster}

So I tried to implement the poster environment as \newenvironment{poster}{\begin{document}\begin{frame}}{\end{frame}\end{document}}.

Unfortunately, that seems to be the wrong thing to do, since latex responds with: LaTeX Error: \begin{poster} on input line 10 ended by \end{document}. I can work around it by replacing the begin/end document with \document/\enddocument, but I'm a bit wary of that.

Is the right approach to just sidestep the LaTeX environment stuff and use the commands directly, or is there a better approach here?

2 Answers 2

3

In general something like

\documentclass{ourposter}
\begin{document}
\end{document}

with

\AtBeginDocument{\begin{frame}}
\AtEndDocument{\end{frame}}

in your class should work. With a document classes based on beamer, however, it doesn't work. It appears the beamer frame environment is touchy about how it is called and when it is started and closed. With the beamer class you can do the following

\documentclass{beamer}
\usepackage{etoolbox}
\AfterEndPreamble{\begin{frame}}
\let\myenddocument\enddocument
\def\enddocument{\end{frame}\myenddocument}
\begin{document}
hello world
\end{document}
6
  • I'd agree that this is the more regular LaTeX syntax. The document is enclosed with \begin{document}...\end{document}, not \begin{ document class name }...\end{ document class name }. Nov 20, 2012 at 12:59
  • Using poster instead of document is based on things like letter.cls using \begin{letter}. Your solution works, I guess, but I'd also like to add an optional argument that gets passed to the \begin{frame}. For a presentation Beamer's default of vertical centering is good, but for posters sometimes we're going to prefer \begin{document}\begin{frame}[t] which is was planning to expose as \begin{poster}[t]. Is that possible with \AtBeginDocument?
    – arnsholt
    Nov 20, 2012 at 14:39
  • @arnsholt the letter class still requires \begin{document} and works like your original usage of \begin{document}\begin{frame}. You didn't ask for a way to rename the frame environment, rather your question suggests you want only one \begin{}. As for options, why not add it as an option to your class \documentclass[t]{ourposter}
    – StrongBad
    Nov 20, 2012 at 14:53
  • Oh, my mistake. And adding the alignment as a package option makes perfect sense. There'll always be just a single frame, after all. Cheers!
    – arnsholt
    Nov 20, 2012 at 14:56
  • I was a bit too quick it seems. Doing this gives me the error "! Illegal parameter number in definition of \test.". Some googling led me to try \AtBeginDocument{\begin{frame}[fragile]} but that simply moves the error a bit (or so it seems): "! Illegal parameter number in definition of \beamer@test.". Any idea what's happening?
    – arnsholt
    Nov 20, 2012 at 15:29
2
\documentclass{beamer}
\newenvironment{poster}
  {\document\begin{frame}}
  {\end{frame}\enddocument}
\begin{poster}
\frametitle{My Frame}
foo \pause bar
\end{poster}

However, I cannot see that this make really sense ...

You must log in to answer this question.

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