1

I would like to know how to replicate the style of this vertical timeline where the arrows are pointing toward the relevant times on the line. If that is too broad of a request, it would be very helpful to simply guide me toward the basic structure. Any help is appreciated.

enter image description here

  • 2
    Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. – Stefan Pinnow Apr 19 '16 at 18:49
  • Do you use something like this very often? If no, use Inkscape. If yes, circumscribe how it should work: Inserting this, automatically do this, inserting that, automatic...... – MaestroGlanz Apr 19 '16 at 20:12
  • I do not. I will use Inkscape. Thank you! – Yrenia Sala Apr 19 '16 at 20:26
  • If you look through the list of 'related' questions on the right, you'll see a number concerning timelines, including vertical ones. Perhaps you could begin with one of those and then add the arrows? If you pick a TikZ-based solution, you should be able to do this, for example. (OK, there's one exception to this. But apart from that, which isn't for vertical timelines anyhow.) – cfr Apr 19 '16 at 21:44
  • The image posted is not as clear as it might be: on the left of the time line itself, the confusion of year labels on the line, description text and arrows is not going to make things easy for the reader and looks rather messy, to be honest. – cfr Apr 19 '16 at 21:57
2

If you cannot avoid needing labels on both sides of the line, I would recommend putting the year labels on the line itself in the centre rather than off to one side. Here's a not terribly sophisticated format:

unsophisticated timeline

Obviously, it is possible to make the overall appearance much fancier according to preference, audience and content. However, the following kronos style provides the fundamental structure and determines the placement of labels and events according to the values of various variables which may be modified (start, end, step, height and width). \kronosevent*[]{} can then be used to place events on the line. The starred version places them right; the unstarred left. The first, optional argument can be used to set, for example, year to something other than the default (presumably required unless all events happen at the same time, in which case a timeline is of little use) and the mandatory argument specifies the event's description.

The above, for instance was specified using an optional argument to the tikzpicture environment, kronos. This sets the timeline up with the default values for start, end, step, width and height.

The picture then specifies 3 events - 2 on the left and 1 on the right. The first

  \kronosevent{Something here}

uses the default settings, which puts the event at 1850 to the left of the line. The second

  \kronosevent[year=300]{Something\\with a long\\description\\happened\\a while ago}

puts an event at the specified time (300CE) to the left of the line, while the third

  \kronosevent*[year=1457]{Major changes}

puts an event at 1457CE to the right of the line.

Complete code:

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage{xparse}
\usetikzlibrary{arrows.meta}
\pgfkeys{/pgf/number format,
  int detect,
  set thousands separator={},
}
\tikzset{
  kronos/.code={% http://tex.stackexchange.com/a/159856/ - Claudio Fiandrino
    \tikzset{%
      align=center,
      anchor=mid,
      /kronos/.cd,
      #1
    }%
    \pgfmathsetmacro\kronosunit{(\kronosheight-20pt)/(\kronosend-\kronosstart)}%
    \draw [line width=1pt]  (-.5*\kronoswidth,10pt) coordinate (kronos tl) ++(3.5pt,0) coordinate (kronos pre) -- ++(0,-\kronosheight) ++(\kronoswidth-3.5pt,0) coordinate (kronos br) ++(-3.5pt,0) coordinate (kronos post) -- (kronos post |- kronos pre);
    \coordinate (kronos start) at (0,0);
    \coordinate (kronos end) at ([yshift=10pt]kronos post);
    \pgfmathsetmacro\tempa{int(\kronosstart+\kronosstep)}%
    \foreach \i in {\kronosstart,\tempa,...,\kronosend} {%
      \node (\i) [font=\sffamily] at (0,{(\kronosstart-\i)*\kronosunit pt}) {\i};
      \draw [thick] (\i.west -| kronos pre) -- +(-3.5pt,0) (\i.east -| kronos post) -- +(3.5pt,0);
    }
  },
  kronos arrow/.style={{Stealth[]}-, thick, shorten <=2.5pt},
  kronos event/.search also={/kronos,/tikz},
  kronos event/year/.store in=\kronosyear,
  kronos event/year=1850,
  /kronos/.search also={/tikz},
  /kronos/.cd,
  start/.store in=\kronosstart,
  end/.store in=\kronosend,
  step/.store in=\kronosstep,
  width/.store in=\kronoswidth,
  height/.store in=\kronosheight,
  start=200,
  end=2000,
  width=10mm,
  height=100mm,
  step=200,
}
\NewDocumentCommand\kronosevent { s O {} m }
{%
  \tikzset{%
    kronos event/.cd,
    #2
  }
  \coordinate (a) at (0,{(\kronosstart-\kronosyear)*\kronosunit pt});
  \IfBooleanTF {#1}
  {%
    \draw [kronos arrow] (a -| kronos br) -- ++(30pt,0) node [anchor=west, align=left, font=\footnotesize\sffamily] {\textbf{\kronosyear} #3};
  }{%
    \draw [kronos arrow] (a -| kronos tl) -- ++(-30pt,0) node [anchor=east, align=left, font=\footnotesize\sffamily] {\textbf{\kronosyear} #3};
  }
}
\begin{document}
\begin{tikzpicture}
  [kronos]
  \kronosevent{Something here}
  \kronosevent[year=300]{Something\\with a long\\description\\happened\\a while ago}
  \kronosevent*[year=1457]{Major changes}
\end{tikzpicture}
\end{document}

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.