14

I'm a student of engineering and I intend to learn more about Beamer/LaTex. After a long research, I found some interesting images showing the closest style I plan to add in my work. Follow the link: http://tfischernet.files.wordpress.com/2010/08/history11.png

I have already tried to contact the author, but he did not answer me. Could anyone do me the kindness to explain me how implement this timeline?

enter image description here

  • Were the width between two consecutive ticks and the color for each segment calculated using some function? – Gonzalo Medina Jan 31 '14 at 18:39
  • maybe you could make a stacked bar plot using pgfplots? – cmhughes Jan 31 '14 at 20:03
17

I just cobbled this together, so it could be significantly expanded, but it gives three macros:

\skipyears[]{}, \showyear[]{}, and \yearwidth{}.

The first specifies a color as the optional argument and a paper distance to represent the skip of years. The second macro takes a color as an optional argument and a piece of text (the year) to set atop the line mark. The final macro defines the width of a year mark.

As shown in this example, one can \stackunder the \showyear for added notations.

\documentclass{beamer}
\usepackage{stackengine}
\renewcommand\useanchorwidth{T}
\usepackage{xcolor}
\def\theyearwidth{1.5pt}
\newlength\yrsfboxrule
\yrsfboxrule .4\fboxrule
\newcommand\yearwidth[1]{\def\theyearwidth{#1}\ignorespaces}
\newcommand\skipyears[2][white]{%
  \fboxrule\yrsfboxrule%
  \fboxsep=-\yrsfboxrule%
  \fcolorbox{gray}{#1}{\strut\hspace{#2}}%
  \ignorespaces%
}
\newcommand\showyear[2][black]{%
  \fboxsep=0pt%
  \stackon{%
    \colorbox{#1}{\strut\hspace{\theyearwidth}}%
  }{\sffamily\small#2}%
  \ignorespaces%
}
\begin{document}
\begin{frame}
Here is some text about computing hardware
\vspace{0.5in}\par
{\centering
\skipyears[cyan]{.1in}
\showyear[red]{-3000}
\skipyears[cyan]{1in}
\showyear{0}
\skipyears{.7in}
\showyear{1400}
\skipyears[cyan!50]{.3in}
\showyear{1500}
\yearwidth{.8pt}
\skipyears[cyan!50]{.05in}
\showyear{}
\skipyears[cyan!50]{0.7in}
\stackunder{\showyear{1776}}{\scriptsize\itshape American Revolution}%
\yearwidth{1.5pt}
\skipyears[cyan!50]{1.1in}
\showyear{2010}\par}
\end{frame}
\end{document}

enter image description here


For those tasks more oriented to a report, rather than beamer, here is a variation on the above that some might find more appealing:

\documentclass{article}
\usepackage{stackengine}
\renewcommand\useanchorwidth{T}
\usepackage{xcolor}
\def\theyearwidth{1.5pt}
\def\mystrut{\rule{0ex}{1ex}}
\def\myyrstrut{\rule[-1ex]{0ex}{2ex}}
\newlength\yrsfboxrule
\yrsfboxrule .4\fboxrule
\newcommand\yearwidth[1]{\def\theyearwidth{#1}\ignorespaces}
\newcommand\skipyears[2][black]{%
  \fboxrule\yrsfboxrule%
  \fboxsep=-\yrsfboxrule%
  \fcolorbox{#1}{#1}{\mystrut\hspace{#2}}%
  \ignorespaces%
}
\newcommand\showyear[2][black]{%
  \fboxsep=0pt%
  \stackunder[2pt]{%
    \colorbox{#1}{\myyrstrut\hspace{\theyearwidth}}%
  }{\tiny#2}%
  \ignorespaces%
}
\begin{document}
Here is some text
\vspace{0.5in}\par
{\centering
\yearwidth{0.8pt}
\tclap{\tiny 0}%
\skipyears[gray]{1in}
\showyear{1200}
\skipyears{.7in}
\showyear{1400}
\skipyears[cyan!50]{.3in}
\showyear{1500}
\skipyears[gray]{.05in}
\skipyears[gray]{0.7in}
{\def\stackalignment{r}\showyear{1520}
\bllap[3.7ex]{\tiny Texte A}}%
\skipyears[gray]{0.04in}%
{\def\stackalignment{l}\showyear{1525}
\brlap[3.7ex]{\tiny Texte B}}%
\skipyears{1.1in}
\tllap{\tiny 2010}\par}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.