Background: I am designing my own
beamer
template and I've read how to design a custom Beamer theme from scratch and how to create Beamer template. I also read about how does beamer build the frame.
I have noted, that each in example found in hereinabove mentioned question, the frame is built using many beamercolorbox
-environment (with one tikzpicture
created inside each of them).
I understand that LaTeX works with boxes, but… I would like to define my template as I create a TikZ picture, i.e. using nodes positioned relatively the one to the other, and filled with macros like \insertframenumber
, \inserttitle
, \insertcontent
.
I've managed to achieve what I want for the titleframe
(see below).
However, I cannot achieve the same for a regular slide. Indeed, when I cannot superimpose TikZ pictures defined via \frametitle
, \framesubtitle
and slide content, nor position subtitle
relatively to title
.
Plus, I am not using squared text areas – as seen in the example below (done by hand):
Note that I will unlikely use blocks (such as definition
, theorem
, etc.) The trapezoid form of the paragraph will be defined using shapepar
package (see examples examples Fitting text to a shape in TikZ and Create sort of custom trapezoid text box).
Note: I am not asking you to code this template for me, but rather how can I use TikZ-nodes to define the layout of a whole frame? (i.e. positioning each component, e.g. frametitle
, slidenumber
, etc.) – its content included.
MWE
main.tex
(root document)
\documentclass[aspectratio=1610]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel=true,kerning=true]{microtype}
\usepackage{roboto}
\title{The title}
\subtitle{Here comes the subtitle\\that can be pretty long}
\date[Short date]{Long date\\ Where the talk is given}
\author[email]{John Doe}
\institute{Institute}
\newcommand{\verticalshift}{.5}
\newcommand{\horizontalshift}{1}
\usetheme{mytheme}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}%
\frametitle{There Is No Largest Prime Number}
\framesubtitle{The proof uses \textit{reductio ad absurdum}.}
There is no largest prime number.
\begin{enumerate}
\item<1-| alert@1> Suppose $p$ were the largest prime number.
\item<2-> Let $q$ be the product of the first $p$ numbers.
\item<3-> Then $q+1$ is not divisible by any of them.
\item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}
\begin{frame}{A longer title}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{frame}
\end{document}
beamerthememytheme.tex
(all the theme definitions. I have merge here the outertheme
and innertheme
files)
\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usetikzlibrary{positioning}
\defbeamertemplate*{title page}{mytheme}%[1][]
{%\leavemode%
\begin{beamercolorbox}[wd=\the\paperwidth, ht=\the\paperheight,ignorebg,center]{}
\begin{tikzpicture}[%
inner sep=0pt,
]
%= defining coordinate
\coordinate (SE') at (\the\paperwidth,0);
\coordinate (SE) at (\the\paperwidth,1);
\coordinate (NE) at (\the\paperwidth,\the\paperheight);
\coordinate (SW) at (0,1);
\coordinate (SW') at (0,0);
\coordinate (NW) at (0,\the\paperheight);
\clip (SW') rectangle (NE);
\coordinate (M) at (9.89, {10-5.56});
\node (Mbis) [above right=210 and 30 of M] {};
\node (Mter) [below left=210 and 30 of M] {};
\path [name path=top] (NW) -- (NE);
\path [name path=bottom] (SW) -- (SE);
\path [name path=left] (SW) -- (NW);
\path [name path=right] (SE) -- (NE);
\path [name path=oblique] (Mbis) -- (Mter);
\coordinate (L) at ($(NW)!(M)!(SW)$);
\coordinate (R) at ($(NE)!(M)!(SE)$);
\path [name intersections={of = oblique and top}] (intersection-1) coordinate (T);
\path [name intersections={of = oblique and bottom}] (intersection-1) coordinate (B);
%= Footer
\fill[black,opacity=1] (0,0) rectangle (\the\paperwidth,1cm);
%= Upper left corner
\fill [color=white] (L) -- (M) -- (T) -- (NW) -- cycle;
\node [%
anchor=base west,
above right= \verticalshift and \horizontalshift of L,
inner sep=0pt,
align=left,
font={\Large},
text = white!30!black,
] (subtitle) {%
\insertsubtitle
};
\node [%
above = .25 of subtitle.north west,
anchor=south west,
inner sep=0pt,
font = {\robotoslab\huge\bfseries}
] (title) {%
\inserttitle
};
%= lower right corner
\fill [color=white] (R) -- (M) -- (B) -- (SE) -- cycle;
\node [%
anchor=base east,
below left= \verticalshift and {.618*\horizontalshift} of R,
inner sep=0pt,
align=right,
font={\robotoslab\bfseries},
] (author) {%
\strut%
\insertauthor
};
\node [
below = {.5*\verticalshift} of author.base east,
anchor=north east,
inner sep=0pt,
align=right,
text=white!30!black,
font={\scriptsize}
] (institution) {%
\strut%
\insertinstitute\\
\insertshortauthor% (= email)
};
%= lower left corner
\fill [color=orange] (B) -- (M) -- (L) -- (SW) -- cycle;
\node [%
anchor=base west,
below right= .5 and 1 of L,
inner sep=0pt,
align=left,
text=orange!13!white,
font={},
] (event) {%
\strut%
\insertshortdate% = event
};
\node [
below = {.5*\verticalshift} of event.base west,
anchor=north west,
inner sep=0pt,
align=left,
text=white!42!orange,
font={\scriptsize}
] (date_n_location) {%
\strut%
\insertdate
};
%= upper right corner
\fill [color=orange] (T) -- (M) -- (R) -- (NE) -- cycle;
\end{tikzpicture}
\end{beamercolorbox}%
}
\defbeamertemplate*{frametitle}{mytheme}[1][]
{%
\begin{beamercolorbox}[wd=\paperwidth, ht=\paperheight]{frametitle}%
\leavevmode
\begin{tikzpicture}
\coordinate (SE') at (\the\paperwidth,0);
\coordinate (SE) at (\the\paperwidth,1);
\coordinate (NE) at (\the\paperwidth,\the\paperheight);
\coordinate (SW) at (0,1);
\coordinate (SW') at (0,0);
\coordinate (NW) at (0,\the\paperheight);
\node at (NW) {$\bullet$};% in order to see box boundaries
\node at (NE) {$\bullet$};
\node at (SW) {$\bullet$};
\node at (SE) {$\bullet$};
\node[%
below right = \verticalshift and \horizontalshift of NW,
anchor = north west,
text = black,
font={\Large},
] (title)
{%
\strut\insertframetitle
};
\end{tikzpicture}
\end{beamercolorbox}
}
Best Answer
[The following does not include the parshape stuff (I guess you can copy the code from the links you provided)]
Why do you want to make the effort to position frametitle etc with tikz? I think your design can be done with classic beamer tools: