6

I want to create a new environment, based on the frame environment, but I want to modify the command \frametitle so it also shows the title of the current section.

juanuni
  • 1,987
  • 1
    That's no bigger problem however knowing which theme you are using would make things much easier. So maybe you could provide a MWE. – bloodworks Jan 20 '13 at 20:11

2 Answers2

8

It would be much easier if you can simply put a simple MWE. It's only six lines of code anyway. So here is my guess.

\documentclass{beamer}
\newenvironment{slide}[1]
{\begin{frame}[environment=slide]
\frametitle{\insertsection-#1}}
{\end{frame}}

\begin{document}
\section{Sec shun 1}
\frame{Dummy frames}
\begin{slide}{My title 1}
Some stufff
\end{slide}


\section{Sec shun 2}
\begin{slide}{My title 2}
Some other stufff
\end{slide}
\frame{Dummy frames}
\end{document}
percusse
  • 157,807
7

With the handy xpatch package, you can simply add the section to the frametitle. No need to define a new environment and run into all the problems this new environment will cause.

\documentclass{beamer}
\usepackage{xpatch}

\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{\insertsection-\insertframetitle}{}{}
\makeatother

\begin{document}
\section{Sec shun 1}
\frame{Dummy frames}
\begin{frame}{My title 1}
Some stufff
\end{frame}


\section{Sec shun 2}
\begin{frame}{My title 2}
Some other stufff
\end{frame}
\frame{Dummy frames}
\end{document}

enter image description here