I am trying to create a new command in Latex Beamer to automatically add the frame title and subtitle with respected to section and subsection. In general, my command will look like:
\newcommand {\myframe}[1] {
\begin{frame}
if in a section {
\frametitle{\secname}
}
if in a subsection {
\framesubtitle{\subsecname}
}
#1
\end{frame}
}
How can I detect whether the frame is in a section or subsection?