Search code examples
latextextimeline

How to create a timeline with LaTeX?


In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?


Solution

  • The tikz package seems to have what you want.

    \documentclass{article}
    \usepackage{tikz}
    \usetikzlibrary{snakes}
    
    \begin{document}
    
      \begin{tikzpicture}[snake=zigzag, line before snake = 5mm, line after snake = 5mm]
        % draw horizontal line   
        \draw (0,0) -- (2,0);
        \draw[snake] (2,0) -- (4,0);
        \draw (4,0) -- (5,0);
        \draw[snake] (5,0) -- (7,0);
    
        % draw vertical lines
        \foreach \x in {0,1,2,4,5,7}
          \draw (\x cm,3pt) -- (\x cm,-3pt);
    
        % draw nodes
        \draw (0,0) node[below=3pt] {$ 0 $} node[above=3pt] {$   $};
        \draw (1,0) node[below=3pt] {$ 1 $} node[above=3pt] {$ 10 $};
        \draw (2,0) node[below=3pt] {$ 2 $} node[above=3pt] {$ 20 $};
        \draw (3,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
        \draw (4,0) node[below=3pt] {$ 5 $} node[above=3pt] {$ 50 $};
        \draw (5,0) node[below=3pt] {$ 6 $} node[above=3pt] {$ 60 $};
        \draw (6,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
        \draw (7,0) node[below=3pt] {$ n $} node[above=3pt] {$ 10n $};
      \end{tikzpicture}
    
    \end{document}
    

    I'm not too expert with tikz, but this does give a good timeline, which looks like:

    enter image description here