3

I have a problem with moving nodes of my timeline. I want the node to be positioned always like the first one in my example no matter how long the text is. How can I do that? I'm very new to LaTeX so please ELI5 if possible.

Thanks in advance!

Code:

\begin{tikzpicture}
\draw[-stealth] (0,0) -- (25,0);
\foreach \x in {0,2,4,6,8,10,12,14,16,18,20,22,24} \draw (\x cm,3pt) -- (\x,-3pt);

\draw (0,0) node[below=3pt] {Nov/Dez} node[right=10pt,above=10pt,rotate=45] {iod};
\draw (2,0) node[below=3pt] {445 v.Chr.} node[right=20pt,above=20pt,rotate=45] {sjfiosjfeiojfweofejiod};
\draw (4,0) node[below=3pt] {Jan/Feb} node[above=3pt] {slejfeoijf};
\draw (6,0) node[below=3pt] {Feb/März} node[above=3pt] {};
\draw (8,0) node[below=3pt] {März/Apr} node[above=3pt] {};
\draw (10,0) node[below=3pt] {Apr/Mai} node[above=3pt] {};
\draw (12,0) node[below=3pt] {Mai/Jun} node[above=3pt] {};
\draw (14,0) node[below=3pt] {Jun/Jul} node[above=3pt] {};
\draw (16,0) node[below=3pt] {Jul/Aug} node[above=3pt] {};
\draw (18,0) node[below=3pt] {Aug/Sept} node[above=3pt] {};
\draw (20,0) node[below=3pt] {Sept/Okt} node[above=3pt] {};
\draw (22,0) node[below=3pt] {Okt/Nov} node[above=3pt] {};
\draw (24,0) node[below=3pt] {Nov/Dez} node[above=3pt] {};
\end{tikzpicture}

Output:

Output

2

Use a ROT style, e.g., like this ROT/.style={above,rotate=45,anchor=south west}, and all nodes take the option [ROT] to follow the same behavior. You may choose above=5pt to lift the label up a bit as you wish.

\documentclass[tikz]{standalone}
\begin{document}

\begin{tikzpicture}[ROT/.style={above,rotate=45,anchor=south west}]
\draw[-stealth] (0,0) -- (25,0);
\foreach \x in {0,2,4,6,8,10,12,14,16,18,20,22,24} \draw (\x cm,3pt) -- (\x,-3pt);

\draw (0,0) node[below=3pt] {Nov/Dez} node[ROT] {iod};
\draw (2,0) node[below=3pt] {445 v.Chr.} node[ROT] {sjfiosjfeiojfweofejiod};
\draw (4,0) node[below=3pt] {Jan/Feb} node[ROT] {slejfeoijf};
\draw (6,0) node[below=3pt] {Feb/März} node[above=3pt] {};
\draw (8,0) node[below=3pt] {März/Apr} node[above=3pt] {};
\draw (10,0) node[below=3pt] {Apr/Mai} node[above=3pt] {};
\draw (12,0) node[below=3pt] {Mai/Jun} node[above=3pt] {};
\draw (14,0) node[below=3pt] {Jun/Jul} node[above=3pt] {};
\draw (16,0) node[below=3pt] {Jul/Aug} node[above=3pt] {};
\draw (18,0) node[below=3pt] {Aug/Sept} node[above=3pt] {};
\draw (20,0) node[below=3pt] {Sept/Okt} node[above=3pt] {};
\draw (22,0) node[below=3pt] {Okt/Nov} node[above=3pt] {};
\draw (24,0) node[below=3pt] {Nov/Dez} node[above=3pt] {};
\end{tikzpicture}

\end{document}

enter image description here

|improve this answer|||||
4

You can use event/.style={anchor=south west,rotate=45,outer sep=2pt}

\documentclass[tikz,border=7pt]{standalone}
\begin{document}
  \begin{tikzpicture}[event/.style={anchor=south west,rotate=45,outer sep=2pt}]
    \draw[-stealth] (2,0) -- +(25,0);
    \foreach[count=\i] \m in {Nov/Dez,445 v.Chr.,Jan/Feb,Feb/März,März/Apr,Apr/Mai,Mai/Jun,Jun/Jul,Jul/Aug,Aug/Sept,Sept/Okt,Okt/Nov,Nov/Dez}{
      \draw ({2*\i},-3pt) -- +(0,6pt) node[midway, below=3pt] {\m};
    }
    % events
    \foreach \x/\y in {1/iod,2/sjfiosjfeiojfweofejiod,3/slejfeoijf}
      \node[event] at ({2*\x},0) {\y};
  \end{tikzpicture}
\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.