I would like to use the solution of Timeline shared in several Beamer frames to
make a vertical timeline, that is, with the arrow pointing to the bottom of the slide.
\documentclass[t]{beamer}
%----------- width and color of progressbar
\usetheme[progressbar=frametitle,
% outer/progressbar=foot
]{metropolis}
\makeatletter
\setlength{\metropolis@titleseparator@linewidth}{2pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
\setlength{\metropolis@progressinheadfoot@linewidth}{2pt}
\makeatother
%------------
\setbeamertemplate{frame numbering}[fraction]
% \setbeamertemplate{navigation symbols}{}
% \useoutertheme{metropolis}
% \useinnertheme{metropolis}
\usefonttheme{metropolis}
\usetikzlibrary{overlay-beamer-styles}
\setbeamercovered{transparent=7}
\tikzset{
highlight on/.style={alt={#1{fill=red!80!black,color=red!80!black}{fill=gray!30!white,color=gray!30!white}}},
}
\begin{document}
\begin{frame}[t]{Timeline}
\frametitle{Timeline}
\begin{tikzpicture}[xscale=0.5]
\draw[line width=1.5mm,-latex,red!20] (-0.2,0) -- (20+0.2,0);
\foreach \X [evaluate=\X as \Y using int(\X-2005),count=\Z] in {2009,2010,2012,2015,2016,2017} %<- these are the years not to be highlighted
{
\draw[highlight on=<0>] ({\Y-0.2},-0.5) -- ({\Y+0.2},-0.5) -- (\Y,-0.1) -- cycle;
\node[anchor=south,highlight on=<0>,fill=white,rotate=45,anchor=south
west,inner sep=0pt] at (\Y,0.2) {\X};
}
\foreach \X [evaluate=\X as \Y using int(\X-2000),count=\Z] in {} %<- these are the years which are to be highlighted
{
\draw[highlight on=<\Z>] ({\Y-0.2},-0.5) -- ({\Y+0.2},-0.5) -- (\Y,-0.1) -- cycle;
\node[anchor=south,highlight on=<\Z>,fill=white,rotate=45,anchor=south
west,inner sep=0pt] at (\Y,0.2) {\X};
}
\end{tikzpicture}
\begin{itemize}
\item<1> frame 1
\item<2> frame 2
\item<3> frame 3
\item<4> frame 4
\item<5> frame 5
\item<6> frame 6
\end{itemize}
\end{frame}
%--- Next Frame ---%
\end{document}
I would like also to know how to show two dates (e.g. 2009 and 2012) with the same item list (e.g. the first item in the itemize).
I also would like to know how I can control the length of the arrow and the separation between dates.
Best Answer
The solution below uses columns, the first one for the timeline and the second one for the itemized list.
The length of the timeline is determined by the y coordinates in the
\draw
command and by thescale
factor. Here, the line starts at0.5
and goes down to-17
(the idea being that each decrement of 1 corresponds to 1 year). Thescale
factor is0.38
. The vertical position of the picture relative to the itemized list can be controlled by changing the magic number-5.5
in thebaseline
option.Each item on the timeline is described by three values: the
\Label
, the\Offset
in years, and the\Overlay
specification. For the timeline in the example below, the list of items is specified asThe overlay specifications in this list as well as in the itemized list determine when to highlight an item. If two items appear with the same frame number, they will be highlighted at the same time. You can also use more complex specifications to specify ranges etc.
Regarding the arrow heads, note the options
-latex
and-{Latex[length=8]}
in the two draw commands. The first determines the arrow head of the timeline, the second the arrows marking the years on the timeline. You can replace them by any arrow in the tikz libraryarrows.meta
.How to obtain an animated gif from pdf pages: Converting PDF slides to animated GIFs and videos with ImageMagick