[Tex/LaTex] Problem using \textblock with \newenvironment

beamerenvironments

I want to redefine the frame environment in beamer so that the contents are inside a box in the center of the frame, but when I try defining the new environment like:

\newenvironment{hframe}[1]
{%before
\begin{frame}{{#1}}
\begin{textblock}{11}(2,2)
}{ %after
\end{textblock}
\end{frame}
}

...

\begin{document}

...

\begin{hframe}{title}
some text
\end{hframe}

\end{document}

I got a compiling error: "! File ended while scanning use of \frame.". But if instead I use the following code

\newenvironment{hframe}[1]
{%before
\begin{frame}{{#1}}
\begin{textblock}{11}(2,2)
}{ %after
%\end{textblock}
\end{frame}
}

...

\begin{document}

...

\begin{hframe}{title}
some text
\end{textblock}
\end{hframe}

\end{document}

it works… Any clue of what is happening and how can I include the \end{textblock} in the "end" argument of \newenvironment?

Best Answer

You cannot wrap the beamer frame environment up like this: it's more-or-less a verbatim situation. You'll need instead to create the appropriate beamer theme, which is constructed after the frame is collected.