1

I want to create a certain section page. But I have 2 Problems left. From another question Creating fancy section pages for beamer I could create the basis.

\documentclass[svgnames]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,shadings}

\tikzset{section number/.style={
        inner sep=0pt,
        draw=none,
    },
    section/.style={
        inner sep=0pt,
        draw=none,
        text width=\the\dimexpr\paperwidth-3.8em\relax,
        text=blue,
        align=left
    },
    subsection/.style={
        inner sep=0pt,
        draw=none,
        text width=\the\dimexpr\paperwidth-3.8em\relax,
        text=gray,
        align=left
    }
}

\makeatletter
\def\sectionsubtitle#1{\gdef\@sectionsubtitle{#1}}
\AtBeginSection[]{%
    \begingroup
    \setbeamertemplate{background canvas}{%
        \begin{tikzpicture}[remember picture,overlay]
        \fill[gray!30] (current page.north west) rectangle (current page.south east);   
        \end{tikzpicture}
    }
    \begin{frame}
        \begin{beamercolorbox}[wd=\paperwidth,ht=1cm]{} 
        \begin{tikzpicture}
        \useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,1);
        \shade [left color=gray,right color=white] (0,0) rectangle (\the\paperwidth,0.02);
        \end{tikzpicture}       
    \end{beamercolorbox}
    \begin{tikzpicture}[remember picture,overlay]
    \node[section,anchor=east] at (current page.east) (title) 
    {\hfill\parbox[c][3.5em][c]{\the\dimexpr\paperwidth-4.2em\relax}{\fontsize{20}{20}\selectfont\insertsectionhead}\hfill}; 
    \node[subsection,below= 2pt of title]  (subtitle) 
    {\hfill\parbox[c][2em][c]{\the\dimexpr\paperwidth-4.2em\relax}{\@sectionsubtitle}\hfill}; 
    \end{tikzpicture}
\end{frame}
\gdef\@sectionsubtitle{}
\endgroup
}
\makeatother

\begin{document}

\sectionsubtitle{Test Subtitle One}
\section{Test Section One}
\begin{frame}
Test Frame
\end{frame}

\sectionsubtitle{Test Subtitle Two}
\section{Test Section Two}
\begin{frame}
Test Frame
\end{frame}

\end{document}

My Problems are: - to get the both texts in the middle and centered. - to move the white rectangle on top of the frame and not in the middle. Somehow it does not work to move it further up.

That's how it looks so far: enter image description here

That's how it should look: (don't bother about the colors and the background) enter image description here

1 Answer 1

1

Here is a modified version of your script. I believe that if you start using tikzpictures, use them completely and do not try to mix things with beamercolorboxes, it messes everything up :).

\documentclass[svgnames]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,shadings}

\tikzset{section number/.style={
        inner sep=0pt,
        draw=none,
    },
    section/.style={
        inner sep=0pt,
        draw=none,
        %text width=\the\dimexpr\paperwidth-3.8em\relax,
        text=blue,
        align=center
    },
    subsection/.style={
        inner sep=0pt,
        draw=none,
        %text width=\the\dimexpr\paperwidth-3.8em\relax,
        text=gray,
        align=center
    }
}

\makeatletter
\def\sectionsubtitle#1{\gdef\@sectionsubtitle{#1}}
\AtBeginSection[]{%
    \begingroup
    % Lighter, beamer native version
    \setbeamercolor{background canvas}{bg=gray!30}
    %
    \begin{frame}
    \begin{tikzpicture}[remember picture,overlay]
    \coordinate[yshift=-10mm] (rectsouthwest) at (current page.north west);
    \coordinate[yshift=-10mm] (rectsoutheast) at (current page.north east);
    \fill[white] (current page.north west) rectangle (rectsoutheast);
    \shade [left color=gray,right color=white] (rectsouthwest) rectangle +(\paperwidth,-0.02);
    \node[section,anchor=center] at (current page.center) (title) {\fontsize{20}{20}\selectfont\insertsectionhead}; 
    \node[subsection,below=5mm of title]  (subtitle) {\@sectionsubtitle}; 
    \end{tikzpicture}
\end{frame}
\gdef\@sectionsubtitle{}
\endgroup
}
\makeatother

\begin{document}

\sectionsubtitle{Test Subtitle One}
\section{Test Section One}
\begin{frame}
Test Frame
\end{frame}

\sectionsubtitle{Test Subtitle Two}
\section{Test Section Two}
\begin{frame}
Test Frame
\end{frame}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .