6

I am preparing some slides in which I used this post. Here it is:

  \documentclass{beamer}
  \usepackage{charter}
  \usepackage{environ}
  \usepackage{tikz}
  \usetikzlibrary{calc,matrix}
  \usepackage{chronology}
  \usetheme{metropolis}   
  \usecolortheme{dolphin}
  \makeatletter
  \let\matamp=&
  \catcode`\&=13
  \def&{%
      \iftikz@is@matrix%
      \pgfmatrixnextcell%
      \else%
      \matamp%
      \fi%
  }
  \makeatother

\newcounter{lines} \def\endlr{\stepcounter{lines}\}

\newcounter{vtml} \setcounter{vtml}{0}

\newif\ifvtimelinetitle \newif\ifvtimebottomline

\tikzset{ description/.style={column 2/.append style={#1}}, timeline color/.store in=\vtmlcolor, timeline color=red!80!black, timeline color st/.style={fill=\vtmlcolor,draw=\vtmlcolor}, use timeline header/.is if=vtimelinetitle, use timeline header=false, add bottom line/.is if=vtimebottomline, add bottom line=false, timeline title/.store in=\vtimelinetitle, timeline title={}, line offset/.store in=\lineoffset, line offset=4pt, }

\NewEnviron{vtimeline}[1][]{% \setcounter{lines}{1}% \stepcounter{vtml}% \begin{tikzpicture}[column 1/.style={anchor=east}, column 2/.style={anchor=west}, text depth=0pt,text height=1ex, row sep=1ex, column sep=1em, #1 ] \matrix(vtimeline\thevtml)[matrix of nodes]{\BODY}; \pgfmathtruncatemacro\endmtx{\thelines-1}

\path[timeline color st]
($(vtimeline\thevtml-1-1.north east)!0.5!(vtimeline\thevtml-1-2.north west)$)--
($(vtimeline\thevtml-\endmtx-1.south east)!0.5!(vtimeline\thevtml-\endmtx-2.south west)$);

\foreach \x in {1,...,\endmtx}{
    \node[circle,timeline color st, inner sep=0.15pt, draw=white, thick]
    (vtimeline\thevtml-c-\x) at
    ($(vtimeline\thevtml-\x-1.east)!0.5!(vtimeline\thevtml-\x-2.west)$){};
    \draw[timeline color st](vtimeline\thevtml-c-\x.west)--++(-3pt,0);
}

\ifvtimelinetitle%
\draw[timeline color st]([yshift=\lineoffset]vtimeline\thevtml.north west)--
([yshift=\lineoffset]vtimeline\thevtml.north east);

\node[anchor=west,yshift=16pt,font=\large]
at (vtimeline\thevtml-1-1.north west)
{\textsc{Timeline \thevtml}: \textit{\vtimelinetitle}};
\else%
\relax%
\fi%

\ifvtimebottomline%
\draw[timeline color st]([yshift=-\lineoffset]vtimeline\thevtml.south west)--
([yshift=-\lineoffset]vtimeline\thevtml.south east);
\else%
\relax%
\fi%
\end{tikzpicture}
}

\begin{document} \begin{frame} \begin{vtimeline}[description={text width=8cm}, row sep=5ex, use timeline header, timeline title={Historical views}] 1691 & G. W. Leibniz (1646-1716) imagines a universal and formal language.\endlr 1879 & G. Frege (1848-1925) publishes a notational system for logic. \endlr 1893/1903 & Frege publishes a formal language for arithmetic\endlr 1906-1914 & A. Thue (1863-1922) publishes papers on words and language, introducing Thue systems.\endlr 1947 & E. L. Post (897-1954) proves the word problem for semigroups is undecidable, using Thue systems.\endlr 1956 & N. Chomsky (1928- ) introduces the Chomsky hierarchy of formal languages and grammars. \endlr \end{vtimeline}
\end{frame} \end{document}


I thought, it would be nice if I could paste a properly scaled picture of the person next to each name or at the end of each event so the audiences can see the persons.

I have in mind something like the following slide where certain pictures are put in corresponding positions. So, I have 5 non-similar pictures:

enter image description here

Thanks for your time!

Mikasa
  • 589

2 Answers2

5

Your timeline is essentially a matrix of nodes. This means that each cell already has a name which you can use afterwards to add images etc. The advantage of this approach is that it won't disturb the layout of your timeline:

\documentclass{beamer}
\usepackage{charter}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}
\usepackage{chronology}
\usetheme{moloch}% modern fork of the metropolis theme   
\usecolortheme{dolphin}
\usepackage[export]{adjustbox}
\makeatletter
\let\matamp=&
\catcode`\&=13
\def&{%
    \iftikz@is@matrix%
    \pgfmatrixnextcell%
    \else%
    \matamp%
    \fi%
}
\makeatother

\newcounter{lines} \def\endlr{\stepcounter{lines}\}

\newcounter{vtml} \setcounter{vtml}{0}

\newif\ifvtimelinetitle \newif\ifvtimebottomline

\tikzset{ description/.style={column 2/.append style={#1}}, timeline color/.store in=\vtmlcolor, timeline color=red!80!black, timeline color st/.style={fill=\vtmlcolor,draw=\vtmlcolor}, use timeline header/.is if=vtimelinetitle, use timeline header=false, add bottom line/.is if=vtimebottomline, add bottom line=false, timeline title/.store in=\vtimelinetitle, timeline title={}, line offset/.store in=\lineoffset, line offset=4pt, }

\NewEnviron{vtimeline}[1][]{% \setcounter{lines}{1}% \stepcounter{vtml}% \begin{tikzpicture}[ remember picture, column 1/.style={anchor=east}, column 2/.style={anchor=west}, text depth=0pt,text height=1ex, row sep=1ex, column sep=1em, #1 ] \matrix(vtimeline\thevtml)[matrix of nodes]{\BODY}; \pgfmathtruncatemacro\endmtx{\thelines-1}

\path[timeline color st]
($(vtimeline\thevtml-1-1.north east)!0.5!(vtimeline\thevtml-1-2.north west)$)--
($(vtimeline\thevtml-\endmtx-1.south east)!0.5!(vtimeline\thevtml-\endmtx-2.south west)$);

\foreach \x in {1,...,\endmtx}{
    \node[circle,timeline color st, inner sep=0.15pt, draw=white, thick]
    (vtimeline\thevtml-c-\x) at
    ($(vtimeline\thevtml-\x-1.east)!0.5!(vtimeline\thevtml-\x-2.west)$){};
    \draw[timeline color st](vtimeline\thevtml-c-\x.west)--++(-3pt,0);
}

\ifvtimelinetitle%
\draw[timeline color st]([yshift=\lineoffset]vtimeline\thevtml.north west)--
([yshift=\lineoffset]vtimeline\thevtml.north east);

\node[anchor=west,yshift=16pt,font=\large]
at (vtimeline\thevtml-1-1.north west)
{\textsc{Timeline \thevtml}: \textit{\vtimelinetitle}};
\else%
\relax%
\fi%

\ifvtimebottomline%
\draw[timeline color st]([yshift=-\lineoffset]vtimeline\thevtml.south west)--
([yshift=-\lineoffset]vtimeline\thevtml.south east);
\else%
\relax%
\fi%
\end{tikzpicture}
}

\begin{document} \begin{frame} \begin{vtimeline}[description={text width=8.5cm}, row sep=5ex, use timeline header, timeline title={Historical views}] 1691 & G. W. Leibniz (1646-1716) imagines a universal and formal language.\endlr 1879 & G. Frege (1848-1925) publishes a notational system for logic. \endlr 1893/1903 & Frege publishes a formal language for arithmetic\endlr 1906-1914 & A. Thue (1863-1922) publishes papers on words and language, introducing Thue systems.\endlr 1947 & E. L. Post (897-1954) proves the word problem for semigroups is undecidable, using Thue systems.\endlr 1956 & N. Chomsky (1928- ) introduces the Chomsky hierarchy of formal languages and grammars. \endlr \end{vtimeline}
\begin{tikzpicture}[remember picture,overlay] \node[left] at (vtimeline\thevtml-1-1.west) {\includegraphics[height=0.5cm]{example-image-duck}}; \node[left] at (vtimeline\thevtml-3-1.west) {\includegraphics[height=0.5cm]{example-grid-100x100bp}}; \end{tikzpicture} \end{frame} \end{document}

enter image description here

4

Something like this?

enter image description here

Basic code can be:

\documentclass{beamer}
\usepackage[export]{adjustbox}    % <--- added
\usepackage{charter}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}
\usepackage{chronology}
\usetheme{metropolis}
\usecolortheme{dolphin}
\makeatletter
\let\matamp=&
\catcode`\&=13
\def&{%
\iftikz@is@matrix%
\pgfmatrixnextcell%
\else%
\matamp%
\fi%
}
\makeatother

\newcounter{lines} \def\endlr{\stepcounter{lines}\}

\newcounter{vtml} \setcounter{vtml}{0}

\newif\ifvtimelinetitle \newif\ifvtimebottomline

\tikzset{ description/.style={column 2/.append style={#1}}, timeline color/.store in=\vtmlcolor, timeline color=red!80!black, timeline color st/.style={fill=\vtmlcolor,draw=\vtmlcolor}, use timeline header/.is if=vtimelinetitle, use timeline header=false, add bottom line/.is if=vtimebottomline, add bottom line=false, timeline title/.store in=\vtimelinetitle, timeline title={}, line offset/.store in=\lineoffset, line offset=4pt, }

\NewEnviron{vtimeline}[1][]{% \setcounter{lines}{1}% \stepcounter{vtml}% \begin{tikzpicture}[column 1/.style={anchor=east}, column 2/.style={anchor=west, font=\linespread{0.92}\selectfont}, text depth=0pt,text height=1ex, row sep=1ex, column sep=1em, #1 ] \matrix(vtimeline\thevtml)[matrix of nodes]{\BODY}; \pgfmathtruncatemacro\endmtx{\thelines-1}

\path[timeline color st] ($(vtimeline\thevtml-1-1.north east)!0.5!(vtimeline\thevtml-1-2.north west)$)-- ($(vtimeline\thevtml-\endmtx-1.south east)!0.5!(vtimeline\thevtml-\endmtx-2.south west)$);

\foreach \x in {1,...,\endmtx}{ \node[circle,timeline color st, inner sep=0.15pt, draw=white, thick] (vtimeline\thevtml-c-\x) at ($(vtimeline\thevtml-\x-1.east)!0.5!(vtimeline\thevtml-\x-2.west)$){}; \drawtimeline color st--++(-3pt,0); }

\ifvtimelinetitle% \draw[timeline color st]([yshift=\lineoffset]vtimeline\thevtml.north west)-- ([yshift=\lineoffset]vtimeline\thevtml.north east);

\node[anchor=west,yshift=16pt,font=\large] at (vtimeline\thevtml-1-1.north west) {\textsc{Timeline \thevtml}: \textit{\vtimelinetitle}}; \else% \relax% \fi%

\ifvtimebottomline% \draw[timeline color st]([yshift=-\lineoffset]vtimeline\thevtml.south west)-- ([yshift=-\lineoffset]vtimeline\thevtml.south east); \else% \relax% \fi% \end{tikzpicture} } \newcommand{\image}[1]{\includegraphics[valign=t]{#1}\ } % <---

\begin{document} \begin{frame} \setkeys{Gin}{width=7.5mm, height=10mm} \hspace*{-2em}\begin{vtimeline}[description={text width=85mm}, % <--- row sep=5ex, use timeline header, timeline title={Historical views} ] \image{example-image-duck} % <--- 1691 & G. W. Leibniz (1646-1716) imagines a universal and formal language.\endlr \image{example-image-duck} 1879 & G. Frege (1848-1925) publishes a notational system for logic. \endlr 1893/1903 & Frege publishes a formal language for arithmetic\endlr \image{example-image-duck} 1906-1914 & A. Thue (1863-1922) publishes papers on words and language, introducing Thue systems.\endlr \image{example-image-duck} 1947 & E. L. Post (897-1954) proves the word problem for semigroups is undecidable, using Thue systems.\endlr \image{example-image-duck} 1956 & N. Chomsky (1928- ) introduces the Chomsky hierarchy of formal languages and grammars. \endlr \end{vtimeline} \end{frame} \end{document}

In above MWE are changes marked by % <---. For your real images you need to use in \image command names of person images files.

Zarko
  • 296,517