3

I am creating my own Beamer theme with a custom section slide. Ideally I would like the command

\frame{\sectionpage}

to have an additional, optional argument, that specifies the color of the sectionpage.

\frame{\sectionpage[yellow]}
\frame{\sectionpage[grey]}

I currently implemented the custom sectionpage as follows,

\setbeamertemplate{section page}{
  \begin{tikzpicture}[remember picture, overlay]
    \node at (current page.center) {
      \pgfuseimage{gray_divider}
    };
  \end{tikzpicture}
  \textbf{\insertsectionhead}
}

First attempt

I worked out a solution that works for one color. In the beamer inner theme class I define the following,

document.tex

\documentclass[10pt]{beamer}
\usepackage{bookmark}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage[english]{babel}
\usepackage{longtable,booktabs}
\usepackage{graphicx}
\usepackage{beamerthemeBeamerSome}

\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}


% Reduce line spacing before and after knitr chunk.
\renewenvironment{knitrout}{\setlength{\topsep}{0mm}}{}

\begin{document}

% This works.
\section*{Introduction}
\frame{\sectionpage[gray]}

% This fails.
\section*{Introduction}
\frame{\sectionpage[yellow]}

% This fails too.
\section*{Introduction}
\frame{\sectionpage}

\end{document}

beamerthemeBeamerSome.sty

\ProvidesPackage{beamerouterthemeinfolinesSome}
\mode<presentation>

% Import of standard packages
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{bookmark}
\usepackage{etoolbox}

% Set fonts to Arial
\usepackage[no-math]{fontspec}
\setmainfont{Arial}
\setsansfont{Arial}

% Implement Logo (logo should be located in the folder with this .sty file)
\pgfdeclareimage[width=\paperwidth]{titlepage}{2015_title_page.pdf}

% Color Definitions
\definecolor{gray}{RGB}{128,128,128}
\definecolor{darkgray}{RGB}{64,64,64}
\definecolor{yellow}{RGB}{255,210,0}

\usecolortheme[RGB={255,210,0}]{structure}

\providebool{SHOW_LINE_IN_FOOTER}
\providebool{SECTION_DIVIDER_YELLOW}
\boolfalse{SHOW_LINE_IN_FOOTER}
\boolfalse{SECTION_DIVIDER_YELLOW}

\newif\ifbeamer@secheader
\beamer@secheaderfalse

\DeclareOptionBeamer{secheader}{\beamer@secheadertrue}
\ProcessOptionsBeamer

\useinnertheme{Some}
\useoutertheme{infolinesSome}

\setbeamerfont{title}{size=\fontsize{15}{17}\bfseries}
\setbeamerfont{subtitle}{size=\fontsize{15}{17}\bfseries}
\setbeamerfont{date}{size =\fontsize{10.5}{11}}

\setbeamertemplate{title page}{
    \begin{tikzpicture}[remember picture, overlay]
        \node at (current page.center) {
      \pgfuseimage{titlepage}
        };
    \node [xshift = -0.2675\paperwidth, yshift = 0.1175\paperheight,
      color = darkgray, above right] at (current page.center) {
       \usebeamerfont{title}\inserttitle
    };
        \node [xshift = -0.2675\paperwidth, yshift = 0.06\paperheight,
      color = darkgray, above right] at (current page.center) {
        \usebeamerfont{subtitle}\insertsubtitle
    };
        \node [xshift = -0.2675\paperwidth, yshift = 0.037\paperheight,
      color = darkgray, below right] at (current page.center) {
        \usebeamerfont{date}\insertdate
    };
    \end{tikzpicture}
}{}

\setbeamersize{text margin left=1em,text margin right=1em}

\mode<all>

beamerinnerthemeSome.sty

\ProvidesPackage{beamerinnerthemeSome}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{xparse}

\ProcessOptionsBeamer

\mode<presentation>

\usesubitemizeitemtemplate{%
    \tiny\raise1.5pt\hbox{\color{beamerstructure}$\blacktriangleright$}%
}
\usesubsubitemizeitemtemplate{%
    \tiny\raise1.5pt\hbox{\color{beamerstructure}$\blacktriangleright$}%
}

\setbeamertemplate{items}[triangle]
\setbeamertemplate{section in toc}{
    {\color{yellow} $\blacktriangleright$} {\color{gray} \inserttocsection}
}
\setbeamertemplate{subsection in toc}{
  \hspace*{\itemindent} {\color{yellow} \tiny $\blacktriangleright$}
  {\color{gray} \tiny \inserttocsubsection} \par
}

\pgfdeclareimage[width=\paperwidth]{gray_divider}{gray_divider.pdf}
\pgfdeclareimage[width=\paperwidth]{yellow_divider}{yellow_divider.pdf}

\setbeamertemplate{section page}{
  \global\boolfalse{SHOW_LINE_IN_FOOTER}
  \begin{tikzpicture}[remember picture, overlay]
    \node at (current page.center) {
      \pgfuseimage{gray_divider}
    };
  \end{tikzpicture}

  % Code from my frametitle.
  \vskip4pt
  % Code from beamerouterthemedefault.sty
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,#1,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    \strut\insertsectionhead\strut%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
}

beamerouterthemeinfolinesSome.sty

\ProvidesPackage{beamerouterthemeinfolinesSome}
\usepackage{etoolbox}

\mode<presentation>

\setbeamercolor*{author in head/foot}{parent=palette tertiary}
\setbeamercolor*{title in head/foot}{parent=palette secondary}
\setbeamercolor*{footer info}{parent=palette primary}

\setbeamercolor*{section in head/foot}{parent=palette tertiary}
\setbeamercolor*{subsection in head/foot}{parent=palette primary}

\setbeamercolor{normal text}{fg=darkgray}
\setbeamercolor{palette primary}{fg=darkgray,bg=white}
\setbeamercolor{palette secondary}{fg=white,bg=darkgray}
\setbeamercolor*{palette tertiary}{fg=darkgray, bg=white}
\setbeamercolor{normal text}{fg=darkgray}
\setbeamercolor{section number projected}{fg=white,bg=darkgray}

\setbeamertemplate{frametitle}
{
    \vskip4pt
    \color{darkgray}
    \textbf{\insertframetitle}
    %\par
    %\vskip5pt

  \color{yellow}
  \centering
  \rule{0.94\paperwidth}{0.9pt}
}

\setbeamertemplate{footline}
{
  \leavevmode
  \centering

  \ifbool{SHOW_LINE_IN_FOOTER}{%
    \rule{0.94\paperwidth}{0.2pt}}{\global\booltrue{SHOW_LINE_IN_FOOTER}}
  \vskip5pt
  \hbox{
      \begin{beamercolorbox}[wd=.02\paperwidth,ht=0.0ex,dp=3ex,left]{footer info}%
       % dummy box
      \end{beamercolorbox}%

      \begin{beamercolorbox}[wd=.1\paperwidth,ht=4ex,dp=1ex,left]{footer info}%
        \usebeamerfont{author in head/foot}
         Page \insertframenumber{}
      \end{beamercolorbox}%

      \begin{beamercolorbox}[wd=.2\paperwidth,ht=4ex,dp=1ex,center]{footer info}%
        \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
      \end{beamercolorbox}%

      \begin{beamercolorbox}[wd=.5\paperwidth,ht=4ex,dp=1ex,left]{footer info}%
        \usebeamerfont{date in head/foot}\insertshorttitle
      \end{beamercolorbox}

      \begin{beamercolorbox}[wd=.13\paperwidth,ht=4ex,dp=3ex,right]{footer info}%
    \includegraphics[height=0.5cm]{Logo_New.pdf}
      \end{beamercolorbox}

      \begin{beamercolorbox}[wd=.03\paperwidth,ht=0.0ex,dp=3ex,left]{footer info}%
       % dummy box
      \end{beamercolorbox}%
  }
  \vskip2pt
}

\makeatletter
\defbeamertemplate{note page}{plain2}
{
  \vskip2.25em
  \nointerlineskip
  \begin{minipage}{0.95\textwidth} % this is an addition
  \insertnote
  \end{minipage}               % this is an addition
}
\makeatother
\setbeamertemplate{note page}[plain2]

\mode
<all>

Error

I added \tracingall to investigate the problem and found that the following in the log file,

\@writefile #1#2->
#1<-nav
#2<-\headcommand {\slideentry {7}{0}{60}{60/60}{}{0}}
{blank space  }

\@writefile #1#2->
#1<-nav
#2<-\headcommand {\beamer@framepages {60}{60}}
{blank space  }

\HyPL@Entry #1->\expandafter \gdef \expandafter \HyPL@Labels \expandafter {\HyP
L@Labels #1}
)
Runaway argument?
{60<< 
! File ended while scanning use of \HyPL@Entry.
<inserted text> 

I am not sure where this HyPL is coming from.

Update

I figured where the issue is. Apparently the underscore in the file name that is included causes the issue. This code works,

\pgfdeclareimage[width=\paperwidth]{yellowdivider}{gray_divider.pdf}
\pgfdeclareimage[width=\paperwidth]{graydivider}{gray_divider.pdf}

\setbeamertemplate{section page}{
  \global\boolfalse{SHOW_LINE_IN_FOOTER}
\ifbool{DIVIDER_IS_YELLOW}{%
    \begin{tikzpicture}[remember picture, overlay]
      \node at (current page.center) {
        \pgfuseimage{yellowdivider}
      };
    \end{tikzpicture}}{%
    \begin{tikzpicture}[remember picture, overlay]
      \node at (current page.center) {
        \pgfuseimage{graydivider}
      };
    \end{tikzpicture}}

  \global\booltrue{DIVIDER_IS_YELLOW}%
  % Code from beamerouterthemedefault.sty
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    %\if@tempswa\else\csname beamer@fte#1\endcsname\fi%
    \strut\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
  \textbf{\insertsectionhead}
}

if I replace the filename in the first pgfdeclare everything goes wrong. So it seems more an issue in pgfdeclare.

Any advise how to resolve this issue is more than welcome.

2
  • Thanks! I already posted a question but it turned out that I made an error. Hope to get this one sorted out.
    – Stereo
    Commented Aug 23, 2015 at 1:48
  • 1
    Throwing your code into a minimal document produces no errors for me. Can you post code that demonstrates the problem. Preferably in a form that can be cut and pasted for testing. The current coding you have can be simply placed in the preamble section of a beamer latex file. Commented Aug 23, 2015 at 10:18

1 Answer 1

0

I solved the issue as follows,

The inner theme file contains the following code,

 \setbeamertemplate{section page}{
   \global\boolfalse{SHOW_LINE_IN_FOOTER}
   \ifbool{DIVIDER_IS_YELLOW}{%
     \begin{tikzpicture}[remember picture, overlay]
       \node at (current page.center) {
         \includegraphics[width=\paperwidth]{yellow_divider.pdf}
       };
     \end{tikzpicture}}{%
     \begin{tikzpicture}[remember picture, overlay]
       \node at (current page.center) {
         \includegraphics[width=\paperwidth]{gray_divider.pdf}
       };
     \end{tikzpicture}}

   \global\booltrue{DIVIDER_IS_YELLOW}%
   % Code from beamerouterthemedefault.sty
   \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
   \@tempdima=\textwidth%
   \advance\@tempdima by\beamer@leftmargin%
   \advance\@tempdima by\beamer@rightmargin%
   \begin{beamercolorbox}[sep=0.3cm,wd=\the\@tempdima]{frametitle}
     \usebeamerfont{frametitle}%
     \vbox{}\vskip-1ex%
     %\if@tempswa\else\csname beamer@fte#1\endcsname\fi%
     \strut\insertframetitle\strut\par%
     {%
       \ifx\insertframesubtitle\@empty%
       \else%
       {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
       \fi
     }%
     \vskip-1ex%
     \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
   \end{beamercolorbox}%
   \textbf{\insertsectionhead}
 }

My conclusion is that ifbool and pgfdeclare do not play nicely.

You must log in to answer this question.

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