4

What is the best way to make a timeline like this?
Can I make this more systematic, maybe with tcolorbox etc.?

enter image description here

\documentclass[a4paper]{article}
\usepackage[margin=2cm, showframe=true]{geometry}
\usepackage{tikz}
    
\begin{document}
\pgfmathsetlengthmacro\xGap{5mm}
\pgfmathsetlengthmacro\LwGap{5.9pt}
\pgfmathsetlengthmacro\xShift{(\linewidth-2*\LwGap-0*\xGap)/50}
\pgfmathsetlengthmacro\yShift{-3.9cm}
\def\ShowValues{0}

\noindent\begin{tikzpicture}[align=center,
font=\footnotesize
]
%\draw[red] (0,0) circle(1pt); % Origin
\foreach[count=\n from 0, 
evaluate={\x=int(mod(\n,50))},
evaluate={\X=int(mod(\t,10))},
evaluate={\y=int(div(\n,50))},
evaluate={\T=int(mod(\t,100))},
] \t in {1800,1801,...,1950}{%%
% Years, Coordinates
\path[draw=brown, %draw=none, 
xshift=\x*\xShift+1*\xGap,  yshift=\y*\yShift 
] circle(1pt) coordinate[label=] (y\t) node[anchor=south west, font=\tiny, rotate=45] {%
\ifnum\ShowValues=1 t:\t, n:\n %, X:\X, x:\x, y:\y, T:\T
\fi};
% Horicontals
\ifnum\x=0 \draw[blue, yshift=\y*\yShift ] (0,0) -- (\linewidth-\LwGap,0);\fi
% Decades
\ifnum\X=0
\draw[xshift=\x*\xShift,   yshift=\y*\yShift 
] (\xGap,2pt) -- (\xGap,-2pt) node[below]{%
\ifnum\T=0 \textbf{\t} \else \T \fi 
\ifnum\ShowValues=1 \\ t:\t \\ T:\T \\ n:\n \\ x:\x \\ y:\y \fi
};\fi
}%%

% Dates
\fill[] (y1803) circle(1pt); 
\draw[] (y1803)  -- ++(0,10mm) -- ++(135:5mm) node[anchor=east, draw, text width=1cm, inner sep=1pt, align=left]{An important happening in 1803.};

\fill[] (y1811) circle(1pt); 
\draw[] (y1811)  -- ++(0,10mm) node[anchor=south, draw, text width=1.5cm, inner sep=1pt, align=left]{Something in the year 1811.};

\draw[brown] (y1863)  -- ++(0,10mm) node[anchor=south, draw, text width=1.5cm, inner sep=1pt, align=left]{The brown circles where not show normally.};

\fill[] (y1922) circle(1pt); 
\draw[] (y1922)  -- ++(0,10mm) -- ++(135:5mm) node[anchor=east, draw, text width=2cm, inner sep=1pt, align=left]{The half centuries can contain different numbers of events.};
\end{tikzpicture}
\end{document}

1 Answer 1

1

I suggest taking a look at \usepackage{pgfgantt}, which helps you to produce different styles of timelines.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .