6

Hi I'm building from scratch a new beamer theme. I would like to define an option in the theme where I can define the conference name which can be used afterwards for the footline. Up to now I've done the following. In the main theme I've defined

\DeclareOptionBeamer{conference}{\PassOptionsToPackage{conference=#1}{beamerouterthememytheme}}

and in the beameroutermytheme.sty I've defined the following

\def\beamer@mytheme@conference{}
\DeclareOptionBeamer{conference}{\def\beamer@mytheme@conference{#1}}

In the footline I've done the following

\defbeamertemplate*{footline}{mytheme}[1]{
\begin{beamercolorbox}[ht=0.15\paperwidth,leftskip=.3cm,rightskip=.3cm,sep=0.1cm]{footlinecolor}
\usebeamerfont{section in head/foot}%
\insertshortauthor~-~\@date~-~\beamer@mytheme@conference \hfill 
\insertframenumber{}/\inserttotalframenumber{}
\end{beamercolorbox}%
}

Unfortunately it does not work although I can't understand why.

Any suggestion?

As asked I try to provide a working example. Actually I hope it works as I've done definition for all inner,outer,color and main theme. In any case the file theme beamerthemeMytheme.sty sounds like

\mode<presentation>
\RequirePackage{pgf}
\DeclareOptionBeamer{conference}{\PassOptionsToPackage{conference=#1}{beamerouterthememytheme}}
\DeclareOptionBeamer{pageofpages} 
{\PassOptionsToPackage{pageofpages=#1} 
{beamerouterthememytheme}}
\ProcessOptionsBeamer
\useoutertheme{mytheme}
\mode
<all>

The file beameroutermytheme.sty sounds like

\mode<presentation>
\RequirePackage{pgf}

% efda colors
\definecolor{eblue}{rgb}{.258,.38,0.63}
\definecolor{e2blue}{rgb}{0.411,0.521,0.709}
% horizontal shading for footer
\pgfdeclarehorizontalshading{beamer@topshade}{\paperwidth}{% 
color(0pt)=(eblue); 
color(0.5\paperwidth)=(eblue!50);
color(\paperwidth)=(e2blue!50)}

% define the heigth of the footer
\newlength{\beamer@mytheme@headheight}
\setlength\beamer@mytheme@headheight{0.13\paperwidth}
%for date definition
\def\date#1{\def\@date{#1}}
% for page counting
\def\beamer@mytheme@pageofpages{of} 
\DeclareOptionBeamer{pageofpages}
{\def\beamer@mytheme@pageofpages{#1}} 
\ExecuteOptionsBeamer{pageofpages=of} 
\ProcessOptionsBeamer
\def\beamer@mytheme@conference{}
\DeclareOptionBeamer{conference}{\def\beamer@mytheme@conference{#1}}
\defbeamertemplate*{footline}{mytheme}[1]
{%
\begin{pgfpicture}{0pt}{0pt}{\paperwidth}
  {0.3\beamer@mytheme@headheight} 
  \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}
    {0.3\beamer@mytheme@headheight}} \pgfusepath{clip}
  \pgftext [ left , base ]{\pgfuseshading{beamer@topshade}}
\end{pgfpicture}
\vskip-0.3\beamer@mytheme@headheight
\begin{beamercolorbox}    [ht=0.3\beamer@mytheme@headheight,leftskip=.3cm,rightskip=.3cm,sep=0.1cm]{footlinecolor}
\usebeamerfont{section in head/foot}%
\insertshortauthor~-~\@date~-~\beamer@mytheme@conference \hfill 
\insertframenumber{}\hskip1pt\beamer@mytheme@pageofpages{}
\hskip1pt\inserttotalframenumber{}
\end{beamercolorbox}%
}

Finally the example is the following

\documentclass[12pt]{beamer}
\usetheme[conference=Prova]{mytheme}
\title[Prova]{Prova}
\author[myself]{Io}
\date{\today}
\begin{document}
\begin{frame}{Prerequisites \& Goals}
\begin{block}{LaTeX}
\begin{itemize}
\item Obviously some basic LaTeX knowledge is necessary
\item Some more features will be provided here
\end{itemize}
\end{block}
\end{frame}
\end{document}
Nicola Vianello
  • 645
  • 7
  • 15
  • Probably because you defined \beamer@jet@conference and later you tried to use it as \beamer@mytheme@conference – Claudio Fiandrino Apr 12 '12 at 13:01
  • Sorry the definition is consistent. Only in the question I prefer to avoid the real name of the theme. I've edited the question consistently. By the way in this way I think that the -1 vote can be avoided – Nicola Vianello Apr 12 '12 at 13:12
  • 1
    @NicolaVianello Please, try and show a real MWE. As it stands the question is not answerable. – egreg Apr 12 '12 at 13:13
  • I noticed you edit your question. I think the problem arises when you defined \beamer@mytheme@conference{} and the consequent option after \ProcessOptionsBeamer in your outer theme. – Claudio Fiandrino Apr 12 '12 at 13:40

1 Answers1

7

Let us suppose you named your main file beamerthemeX.sty. There you place your option as:

\DeclareOptionBeamer{conference}{\PassOptionsToPackage{conference=#1}{beamerouterthemeX}}
\ProcessOptionsBeamer

Then in your beamerouterthemeX.sty:

\DeclareOptionBeamer{conference}{\def\beamer@X@conference{#1}}    
\ProcessOptionsBeamer

initially to define the option, while for the footline:

\defbeamertemplate*{footline}{X theme}[1]{
\begin{beamercolorbox}[ht=0.15\paperwidth,leftskip=.3cm,rightskip=.3cm,sep=0.1cm]{Location bar}
\usebeamerfont{section in head/foot}%
\insertshortauthor~-~\@date~-~\beamer@X@conference \hfill 
\insertframenumber{}/\inserttotalframenumber{}
\end{beamercolorbox}%
}

Now your presentation.tex will call:

\usetheme[conference=Name]{X}