Skip to content

Commit

Permalink
Add (sub)section page + fix frame numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
pcafrica committed Oct 19, 2017
1 parent 68f9e9f commit 27f3fd8
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Demo
----
![](https://github.com/elauksap/beamerthemepolimi/blob/master/demo-bgphoto.jpg)
![](https://github.com/elauksap/beamerthemepolimi/blob/master/demo-bgwhite.jpg)
![](https://github.com/elauksap/beamerthemepolimi/blob/master/demo-sectionpage.jpg)
![](https://github.com/elauksap/beamerthemepolimi/blob/master/demo-slide.jpg)

Instructions
Expand Down
42 changes: 39 additions & 3 deletions beamerinnerthemepolimi.sty
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
\mode<presentation>

% Background.
\setbeamertemplate{background}{
\defbeamertemplate*{background}{polimi}{
% Titlepage.
\ifnum\c@framenumber=1
\ifnum\c@framenumber=0
\begin{tikzpicture}[overlay, remember picture]
\if@bgphoto
\node at (current page.north) [anchor=north, inner sep=0pt] {\includegraphics[width=\paperwidth]{bgphoto_cut.jpg}};
Expand All @@ -29,6 +29,13 @@
\fi
}

% Only footer background.
\defbeamertemplate*{background}{footer}{
\begin{tikzpicture}[overlay, remember picture]
\node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.105\paperheight, fill=bluePolimi] {};
\end{tikzpicture}
}

% Title page.
\defbeamertemplate*{title page}{polimi}[1][]
{
Expand All @@ -55,9 +62,38 @@

\vfill

\addtocounter{page}{-1}
\addtocounter{framenumber}{-1}
}

% Table of Contents.
\setbeamertemplate{section in toc}[circle]
\setbeamertemplate{subsection in toc}{\leavevmode \leftskip=0.7em {\color{bluePolimi} $\bullet$} \hskip1pt \inserttocsubsection\par}

% Section page.
\defbeamertemplate*{section page}{polimi}{
\begin{tikzpicture}[overlay, remember picture]
\node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.4415\paperheight, fill=bluePolimi] {};
\node at ([shift={(0, -0.1)}] foot.north) {\includegraphics[width=0.99\paperwidth]{decoration.png}};
\path let \p1 = ([shift={(0, 0.105\paperheight+0.25)}] current page.south east), \p2 = (current page.west) in (\paperwidth,\y1) edge [white, line width=0.5] (\x2,\y1);
\node at ([shift={(\xshift, 3.5)}] current page.south west) [anchor=north west, inner sep=0pt, text width=\textwidth+1cm]
{
{\color{white}\Large\bf \insertsection}
};
\end{tikzpicture}
}
\setbeamertemplate{section page}[polimi]


% Subsection page.
\defbeamertemplate*{subsection page}{polimi}{
\begin{tikzpicture}[overlay, remember picture]
\node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.4415\paperheight, fill=bluePolimi] {};
\node at ([shift={(0, -0.1)}] foot.north) {\includegraphics[width=0.99\paperwidth]{decoration.png}};
\path let \p1 = ([shift={(0, 0.105\paperheight+0.25)}] current page.south east), \p2 = (current page.west) in (\paperwidth,\y1) edge [white, line width=0.5] (\x2,\y1);
\node at ([shift={(\xshift, 3.5)}] current page.south west) [anchor=north west, inner sep=0pt, text width=\textwidth+1cm]
{
{\color{white}\Large\bf \insertsubsection}
};
\end{tikzpicture}
}
\setbeamertemplate{subsection page}[polimi]
40 changes: 29 additions & 11 deletions beamerouterthemepolimi.sty
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,40 @@
\defbeamertemplate*{frametitle}{polimi}
{
\begin{tikzpicture}[overlay, remember picture]
\node at ([shift={(\xshift, -0.35)}] current page.north west) [anchor=north west, inner sep=0pt]
\node at ([shift={(\xshift, -0.6)}] current page.north west) [anchor=south west, inner sep=0pt]
{
{\small \insertsection \ifx\insertsubsection\empty\else\ - \insertsubsection\fi\leavevmode}
{\small \insertsectionhead \ifx\insertsubsection\empty\else\ - \insertsubsectionhead\fi\leavevmode}
};
\node at ([shift={(\xshift, -0.85)}] current page.north west) [anchor=north west, inner sep=0pt]
\node at ([shift={(\xshift, -1.25)}] current page.north west) [anchor=south west, inner sep=0pt]
{
\insertframetitle
};
\end{tikzpicture}
\vspace{1.1cm}
}

% Header.
\defbeamertemplate*{frametitle}{plain}{}

% Use frametitle template even if \frametitle is empty.
\patchcmd{\endbeamer@frameslide}{\ifx\beamer@frametitle\@empty}{\iffalse}{}{\errmessage{Failed to patch frametitle.}}

\defbeamertemplate{headline}{page number}
\defbeamertemplate{headline}{frame number}
{
\ifnum\c@framenumber>1
\vspace{\baselineskip}
\setbeamertemplate{footline}[page number]
\usebeamertemplate{footline}
\ifnum\c@framenumber>0
\begin{tikzpicture}[overlay, remember picture]
\node at ([shift={(-\xshift, -1.25)}] current page.north east) [anchor=south west, inner sep=0pt]
{
{\color{white} \tiny \insertframenumber/\inserttotalframenumber}
};
\end{tikzpicture}
\fi
}

% Footer.
\defbeamertemplate{footline}{polimi}{
\begin{minipage}[b][1cm][c]{\paperwidth}
\ifnum\c@framenumber>1
\ifnum\c@framenumber>0
\hspace{\xshift}
{\small\color{white}\insertauthor}
\hspace*{\fill}
Expand All @@ -48,12 +54,24 @@

% Enable nonumber option.
\BeforeBeginEnvironment{frame}{
\setbeamertemplate{headline}[page number]
\setbeamertemplate{background}[polimi]
\setbeamertemplate{frametitle}[polimi]
\setbeamertemplate{headline}[frame number]
}

\makeatletter
\define@key{beamerframe}{nonumber}[true]{
\setbeamertemplate{headline}{}
\addtocounter{page}{-1}
\addtocounter{framenumber}{-1}
}
\makeatother

% Enable plain option.
\makeatletter
\define@key{beamerframe}{plain}[true]{
\setbeamertemplate{background}[footer]
\setbeamertemplate{frametitle}[plain]
\setbeamertemplate{headline}{}
\addtocounter{framenumber}{-1}
}
\makeatother
1 change: 1 addition & 0 deletions beamerthemepolimi.sty
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
\ProcessOptions

\RequirePackage{tikz}
\usetikzlibrary{calc}
\graphicspath{{beamerthemepolimi_img/}}

\RequirePackage{etoolbox} % \patchcmd
Expand Down
Binary file modified demo-bgphoto.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo-bgwhite.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo-sectionpage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo-slide.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo.pdf
Binary file not shown.
15 changes: 12 additions & 3 deletions demo.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
\title{Title}
\subtitle{Subtitle}
\author{Author}
\date{01 mar 2017}
\date{dd mm yyyy}

\begin{document}
\begin{frame}
Expand All @@ -37,11 +37,19 @@
\end{frame}

\section{Section 1}
% Section page.
\begin{frame}[plain]{}
\sectionpage
\end{frame}

\begin{frame}{Slide 1}
\lipsum[1]
\end{frame}

\subsection{Subsection 1.1}
\begin{frame}[plain]{}
\subsectionpage
\end{frame}
\begin{frame}
This frame has an empty title.
\vfill
Expand All @@ -57,20 +65,21 @@
\end{frame}

\subsection{Subsection 1.2}

% Slide without numbering.
\begin{frame}[nonumber]{Slide 1.2 without numbering}
\lipsum[2]
\end{frame}

\section{Section 2}
\section[Short]{Section 2}
\begin{frame}{Slide 2}
\begin{block}{Block}
Text.
\end{block}
\pause
\begin{alertblock}{Alert block}
Alert \alert{text}.
\end{alertblock}
\pause
\begin{exampleblock}{Example block}
Example \textcolor{greenPolimi}{text}.
\end{exampleblock}
Expand Down

0 comments on commit 27f3fd8

Please sign in to comment.