The finished code follows below. At first i have renewed the \section
and \subsection
to add automated references. I created the funktion \calcsubsection[i]
an \calcsection[i]
to get the name of the section "sectionnumber+i" or "subsectionnumber+i", where i is positive for future sections, and i negative for older sections. e.g.:
\calcsubsection{-1}
gives the name of the previous subsectionname in the current section.
\calcsubsection{1}
gives the next subsectionname in the current section.
I have to start the lecture tomorrow, therefore I will now work with this solution. I would be happy if someone gives comments on improving
- the code
- the layout when less subsections than section appear
It really took me long time to create this code, because I never really used "this part of latex". Sorry for the old "answers", which were no answers as wanted in this forum. I deleted them.
\documentclass{beamer}
\usetheme{Warsaw}
\makeatletter
% A new section definition to automatically set labels with the name: sec:sectionnumber
\let\oldsection\section
\renewcommand{\section}[1]{\oldsection{#1}\label{sec:\thesection}}
% A new subsection definition to automatically set labels with the name: sec:sectionnumber.subsectionnumer
\let\oldsubsection\subsection
\renewcommand{\subsection}[1]{\oldsubsection{#1}\label{sec:\thesection.\thesubsection}}
%init some calculators
\newcounter{calculator}
\newcounter{calcmaxsec}
\newcounter{calcmaxsubsec}
\newcommand{\calcsubsection}[1]%procedure to get the name of section thissection+i
{
\setcounter{calculator}{\thesubsection}\addtocounter{calculator}{#1}
\@ifundefined{r@sec:\thesection.\thecalculator}{}{\color{fg!40!bg}\nameref{sec:\thesection.\thecalculator}}
}
\newcommand{\calcsection}[1]%procedure to get the name of subsection thissection.thissubsection+i
{
\setcounter{calculator}{\thesection}\addtocounter{calculator}{#1}
\@ifundefined{r@sec:\thesection}{}{\color{fg!40!bg}\nameref{sec:\thecalculator}}
}
\newcommand{\Testframe}%some testframe definition
{
\begin{frame}
The Section: \thesection\\
The Subsection: \thesubsection\\
The Calculator: \thecalculator\\
Count\thesection
\end{frame}
}
%Defining the layout%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{headline}
{%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.125ex%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb,right,rightskip=1em]{section in head/foot}%
\vbox to \@tempdimb{%
\setcounter{calcmaxsec}{\thesection}\addtocounter{calcmaxsec}{-\beamer@sectionmax}
\ifnum\thecalcmaxsec>-1\vfill{\calcsection{-3}}\fi%
\ifnum\thecalcmaxsec>-2\vfill{\calcsection{-2}}\fi%
\ifnum\thesection>1\vfill{\calcsection{-1}}\fi%
\ifnum\thesection>0\vfill\insertsectionhead\fi
\ifnum\thecalcmaxsec<0\vfill{\calcsection{1}}\fi
\ifnum\thecalcmaxsec<-1\vfill{\calcsection{2}}\fi
\ifnum\thesection<2\vfill{\calcsection{3}}\fi
\ifnum\thesection<1\vfill{\calcsection{4}}\fi
\vfill%
}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to \@tempdimb{%
\setcounter{calcmaxsubsec}{\thesubsection}\addtocounter{calcmaxsubsec}{-\beamer@subsectionmax}
\ifnum\thecalcmaxsubsec>-1 \vfill{\calcsubsection{-3}}\fi%
\ifnum\thecalcmaxsubsec>-2 \vfill{\calcsubsection{-2}}\fi%
\ifnum\thesubsection>1 \vfill{\calcsubsection{-1}}\fi%
\ifnum\thesubsection>0 \vfill\insertsubsectionhead\fi
\ifnum\beamer@subsectionmax>1{\ifnum\thecalcmaxsubsec<0\vfill{\calcsubsection{1}}\fi}\fi
\ifnum\beamer@subsectionmax>2{\ifnum\thecalcmaxsubsec<-1\vfill{\calcsubsection{2}}\fi}\fi
\ifnum\beamer@subsectionmax>3{\ifnum\thesubsection<2\vfill{\calcsubsection{3}}\fi}\fi
\ifnum\beamer@subsectionmax>4{\ifnum\thesubsection<1\vfill{\calcsubsection{4}}\fi}\fi
\vfill%
}%
\end{beamercolorbox}%
\fi%
}%
\makeatother %%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section{test one}\Testframe
\subsection{sub 1}\Testframe
\subsection{sub 2}\Testframe
\subsection{sub 3}\Testframe
\subsection{sub 4}\Testframe
\subsection{sub 5}\Testframe
\subsection{sub 6}\Testframe
\subsection{sub 7}\Testframe
\section{test two}\Testframe
\subsection{sub 1}\Testframe
\subsection{sub 2}\Testframe
\section{test three}\Testframe
\subsection{sub 1}\Testframe
\subsection{sub 2}\Testframe
\subsection{sub 3}\Testframe
\section{test four}\Testframe
\subsection{sub 1}\Testframe
\subsection{sub 2}\Testframe
\subsection{sub 3}\Testframe
\subsection{sub 4}\Testframe
\section{test five}\Testframe
\subsection{sub 1}\Testframe
\section{test six}\Testframe
\subsection{sub 1}\Testframe
\end{document}
:)
)