4

Good evening,

I am trying to print the section and subsection titles in beamer, but I don't want them on a seperate frame, but on the first content page of this section/subsection. It is supposed to look like this:

enter image description here

The orange box is supposed to be the section title, the box directly below the subsection title and the last one should be the frame title.

My code looks something like this:

\documentclass[t,8pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}

\usepackage{tcolorbox}

\setbeamercolor{bgcolorsection}{fg=black,bg=orange!50!red}
\setbeamercolor{bgcolorsubsection}{fg=black,bg=yellow!80!orange}

\AtBeginSection[]{
\vspace*{0.1mm}
\begin{beamercolorbox}[sep=5pt,center,shadow=false,rounded=true]  {bgcolorsection}
    \Huge\textbf\insertsectionhead\par%
\end{beamercolorbox}
\vspace*{0.2mm}
}

\AtBeginSubsection[]{
\vspace*{0.1mm}
\begin{beamercolorbox}[sep=3pt,center,shadow=false,rounded=true]{bgcolorsubsection}
    \huge\textbf\insertsubsectionhead\par%
\end{beamercolorbox}
}

\setbeamertemplate{frametitle}{
\begin{tcolorbox}[
    boxrule=0.2mm,
    boxsep=0mm,
    lowerbox=ignored,
    colback=yellow,
    colframe=black
]
    \centering
    \large\insertframetitle
\end{tcolorbox}
\vspace{-4mm}
}

\begin{document}

\section{Algorithmen und ihre Beschreibung}
\subsection{Die Einordnung des Algorithmusbegriffs}

\begin{frame}{Vom Problem zum Programm}
Das ist ein Test
\end{frame}

\end{document}

Unfortunately, the section and subsection titles are printed on a separate frame. I would also prefer a solution using tcolorbox, as I already managed to get a nice box around the frame title.

Any help would be appreciated. Thanks in advance, Daniel

Edit: enter image description here

Here is an example, on the last slide the section and subsection title is printed again including the page number.

\documentclass[t,8pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}

\usepackage{tcolorbox}

\setbeamercolor{bgcolorsection}{fg=black,bg=orange!50!red}
\setbeamercolor{bgcolorsubsection}{fg=black,bg=yellow!80!orange}

\setbeamertemplate{frametitle}{%
\if\insertframenumber\insertsectionstartpage
    \vspace*{0.1mm}
    \begin{tcolorbox}[
        boxrule=0.2mm,
        boxsep=0mm,
        lowerbox=ignored,
        colback=yellow,
        colframe=black
    ]
        \centering
        \Huge\textbf\insertsectionhead\par%
    \end{tcolorbox}
    \vspace*{0.2mm}
\fi%
\if\insertframenumber\insertsubsectionstartpage
    \vspace*{0.1mm}
    \begin{tcolorbox}[
        boxrule=0.2mm,
        boxsep=0mm,
        lowerbox=ignored,
        colback=yellow,
        colframe=black
    ]
        \centering
        \huge\textbf\insertsubsectionhead\par%
    \end{tcolorbox}
\fi%
\begin{tcolorbox}[
    boxrule=0.2mm,
    boxsep=0mm,
    lowerbox=ignored,
    colback=yellow,
    colframe=black
]
    \centering
    \large\insertframetitle
\end{tcolorbox}
\vspace{-4mm}
}

\begin{document}

\section{Forschungsstand}
\subsection{Aufgabenbeschreibung}

\begin{frame}{Ausgangssituation}
Das ist ein Test
\end{frame}

\subsection{Data Mining}

\begin{frame}{Zum Begriff}

\begin{itemize}
\item \glqq{}Lehre vom \textbf{Sammeln, Säubern, Verarbeiten und Analysieren     von Daten}, um nützliche Erkenntnisse aus ihnen zu gewinnen.\grqq{}
\end{itemize}

\end{frame}


\begin{frame}{}
Test
\end{frame}

\begin{frame}{Datentypen im Bereich Data Mining}
Test
\end{frame}

\begin{frame}{}
\begin{itemize}
\item \textbf{Text Daten:} Auffassen der Daten als multidimensionale Daten,  z.\,B. Analyse von Worthäufigkeiten in einem Text.
\end{itemize}
\end{frame}

\begin{frame}{}

\begin{itemize}
\item \textbf{Räumliche Daten:} Erfassen von Daten an unterschiedlichen Orten (Luftdruck auf Meereshöhe und in den Bergen).
\end{itemize}
\end{frame}

\begin{frame}{Outlier Detection}
Outlier Detection
\end{frame}

\begin{frame}{}
\glqq{}An outlier is an observation which deviates so much from the other   observations as to arouse suspicions that it was generated by a different  mechanism.\grqq{}\footnote{Hawkins, 1980}
\end{frame}

\section{Erstellung der Bachelorarbeit}
\subsection{Ablauf}

\begin{frame}{Zeitplan}
Hier steht der Zeitplan
\end{frame}

\begin{frame}{Gliederung der Bachelorarbeit}
Gliederung
\end{frame}

\begin{frame}{Quellen}
Quellen
\end{frame}

\end{document}
3

You can conditionally display these boxes as part of the frametitle:

\documentclass[t,8pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}

\usepackage{tcolorbox}

\setbeamercolor{bgcolorsection}{fg=black,bg=orange!50!red}
\setbeamercolor{bgcolorsubsection}{fg=black,bg=yellow!80!orange}

\setbeamertemplate{frametitle}{%
\ifnum\insertframenumber=\insertsectionstartpage
    \vspace*{0.1mm}
    \begin{tcolorbox}[
        boxrule=0.2mm,
        boxsep=0mm,
        lowerbox=ignored,
        colback=yellow,
        colframe=black
    ]
        \centering
        \Huge\textbf\insertsectionhead\par%
    \end{tcolorbox}
    \vspace*{0.2mm}
\fi%
\ifnum\insertframenumber=\insertsubsectionstartpage
    \vspace*{0.1mm}
    \begin{tcolorbox}[
        boxrule=0.2mm,
        boxsep=0mm,
        lowerbox=ignored,
        colback=yellow,
        colframe=black
    ]
        \centering
        \huge\textbf\insertsubsectionhead\par%
    \end{tcolorbox}
\fi%
\begin{tcolorbox}[
    boxrule=0.2mm,
    boxsep=0mm,
    lowerbox=ignored,
    colback=yellow,
    colframe=black
]
    \centering
    \large\insertframetitle
\end{tcolorbox}
\vspace{-4mm}
}

\begin{document}

\section{Forschungsstand}
\subsection{Aufgabenbeschreibung}

\begin{frame}{Ausgangssituation}
Das ist ein Test
\end{frame}

\subsection{Data Mining}

\begin{frame}{Zum Begriff}

\begin{itemize}
\item \glqq{}Lehre vom \textbf{Sammeln, Säubern, Verarbeiten und Analysieren     von Daten}, um nützliche Erkenntnisse aus ihnen zu gewinnen.\grqq{}
\end{itemize}

\end{frame}


\begin{frame}{}
Test
\end{frame}

\begin{frame}{Datentypen im Bereich Data Mining}
Test
\end{frame}

\begin{frame}{}
\begin{itemize}
\item \textbf{Text Daten:} Auffassen der Daten als multidimensionale Daten,  z.\,B. Analyse von Worthäufigkeiten in einem Text.
\end{itemize}
\end{frame}

\begin{frame}{}

\begin{itemize}
\item \textbf{Räumliche Daten:} Erfassen von Daten an unterschiedlichen Orten (Luftdruck auf Meereshöhe und in den Bergen).
\end{itemize}
\end{frame}

\begin{frame}{Outlier Detection}
Outlier Detection
\end{frame}

\begin{frame}{}
\glqq{}An outlier is an observation which deviates so much from the other   observations as to arouse suspicions that it was generated by a different  mechanism.\grqq{}\footnote{Hawkins, 1980}
\end{frame}

\section{Erstellung der Bachelorarbeit}
\subsection{Ablauf}

\begin{frame}{Zeitplan}
Hier steht der Zeitplan
\end{frame}

\begin{frame}{Gliederung der Bachelorarbeit}
Gliederung
\end{frame}

\begin{frame}{Quellen}
Quellen
\end{frame}

\end{document}

enter image description here

  • Thank you very much :) It's a very nice solution and exactly what I wanted. – Daniel Wehner Nov 4 '16 at 20:51
  • Sometimes the pagenumber is printed above the boxes (see above). Do you have an idea why this is happening? – Daniel Wehner Nov 7 '16 at 21:14
  • Could it be that it prints the framenumber because of the if-statement? (\if\insertframenumber\insertsectionstartpage%) – Daniel Wehner Nov 7 '16 at 21:16
  • @DanielWehner Can you create a MWE that demonstrates this problem? The if-statmemts just test if the frame is the first one in (sub)section. – user36296 Nov 7 '16 at 23:46
  • I added an example, you can see the effect on the last slide. Maybe it's because not all slides have a frame title? – Daniel Wehner Nov 8 '16 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.