I've changed a timeline of mine to look like the one asked in this question: timeline and tikz
Everything went smoothly but I have a problem. I don't know how to automatically set the nodes' position.
Basically their positions should "fixed", starting from (3,0) and then one after the other with a fixed distance between them (regardless if they are one-line or not). After that I'd be making the lines. How can I tell Tikz to automatically get the coordinates of each text node without setting it manually? (This would mean removing the second argument for the command \evento.)
I expect the final result to look like the one in the question or like Tom Bombadil's answer but using my code:
\documentclass[]{article}
\usepackage[a4paper, margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{xparse,expl3}
\usetikzlibrary{fit, arrows,backgrounds,patterns,shapes,shapes.multipart,positioning,calc,decorations.markings}
\pgfplotsset{compat=1.7}
\pagestyle{empty}
\tikzset{
opera/.style={draw, rectangle, align=center, text width=6cm, fill=white, font=\scriptsize},
typnode/.style={anchor=north west, text width=12cm, inner sep=0mm},
data/.style={draw=gray, rectangle, fill=white, font=\scriptsize, inner sep=0.5mm},
datum/.style={font=\scriptsize, rotate=90, inner sep=1mm},
}
\newcommand*{\evento}[3]{
\coordinate (A) at (0,{(#1-1600)/10});
\coordinate (B) at (3,{#2});%
\coordinate[right=5mm of A] (Z);
\coordinate[left=1cm of B] (Y);
\draw (A) -- (Z);
\draw[-|] (Y) -- (B) node[data, pos=0.55] {#1};
\draw (Z) -- (Y);
\node[right=3mm of B, typnode] (D) {#3};
}
\begin{document}
\footnotesize
\begin{tikzpicture}[x=1cm,y=-7mm]
\centering
%draw horizontal line
\draw[|->, -latex, draw] (0,0) -- (0,39);
\draw[-, dashed] (0,-0.5) -- (0,0);
\draw[|->, -latex, draw] (34,0) -- (34,39);
\draw[-, dashed] (34,-0.5) -- (34,39);
%draw years
\foreach \y [evaluate=\y as \xear using int(1600+\y*10)] in {0,1,...,38}{
\draw (0,\y) node[left=2pt,anchor=east,xshift=0,font=\scriptsize] {$\xear$};
\draw (-0.1,\y) -- (0.1,\y);
}
\foreach \y [evaluate=\y as \xear using int(1600+\y*10)] in {0,1,...,37}{
\draw (0,\y) node[left=2pt,anchor=east,xshift=0,font=\scriptsize] {};
\draw (0,\y+.5) -- (0.1,\y+.5);
}
\evento{1603}{0}{King James VI of Scotland ascends to the English throne, becoming James I of England and uniting the crowns - but not the parliaments - of the two kingdoms};
\evento{1605}{2}{\textbf{5 November} - Gunpowder Plot: A plot in which Guy Fawkes and other Catholic associates conspired to blow up King James VI and I and the Parliament of England was uncovered.};
\evento{1618}{3}{Walter Raleigh was executed.};
\evento{1639}{5}{Bishops' Wars: A war with Scotland began which would last until 1640.};
\evento{1640}{6}{Long Parliament: The Parliament was convened.};
\evento{1642}{7}{English Civil War: The war began (see timeline of the English Civil War).};
\evento{1649}{8}{January Trial and execution of Charles I\\Interregnum began with the First Commonwealth};
\evento{1653}{9}{The Protectorate began under the Lord Protector Oliver Cromwell};
\evento{1659}{10}{Second Commonwealth a period of great political instability};
\evento{1660}{11}{Restoration of the monarchy};
\evento{1666}{12}{\textbf{2 September} - Great Fire of London: A fire began in London.\\\textbf{6 September} - Great Fire of London: The fire ended.};
\end{tikzpicture}
\end{document}

\Text) or the ones with the year in it? The main nodes are on the chain and are automatically namedch1-1,ch1-2, and so on (ch1is the name of the chain as defined with thestart chainkey). The first and the last node are also namedch1-beginandch1-endrespectively. – Qrrbrbirlbel Oct 04 '13 at 21:41\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}}What do those numbers stand for? Thanks! – Alenanno Oct 09 '13 at 18:06positioninglibrary and my linkedpositioning-pluslibrary for examples. The macro\tikz@lib@place@handle@checks#1forofand then executes certain macros and sets the new node’snorth westbelow (-1 * <node distance>) of the referenced node’ssouth westanchor (unless one is given). The0is the shifting in x direction and the1is a factor fornode distancedoes only contain one value. – Qrrbrbirlbel Oct 09 '13 at 20:05west belowis basically abelowkey that left-aligns the nodes. – Qrrbrbirlbel Oct 09 '13 at 20:08