Here's another version with Tikz. The command is as follows:
\nation{mm/yyyy}{mm/yyyy}{level}{color}{label}
The month mm
and year year
are typed in that format, but if you're below 10, you can enter a single digit. So for January 2010, you type 1/2010
. Level is the height of the bar relative to the timeline below.
You could automatize the coloring too, and get rid of an argument to type, it'd be easy to implement.
Output
Code
\documentclass[12pt]{article}
\usepackage[a4paper, margin=1cm, landscape]{geometry}
\usepackage{amsmath}
\usepackage{xstring}
\usepackage{tikz}
\usetikzlibrary{fit, calc}
\pagestyle{empty}
\newcommand\anno{2008} % starting year
\newcommand\target{2018} % ending year
\newcommand\alto{36} % height
\def\months{{"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"}}%
\pgfmathsetmacro\myend{\target-1-\anno}
\pgfmathsetmacro\tix{1/12}
\pgfmathsetmacro\myspacing{24/(\target-1-\anno)}
\newcommand\nation[5]{%
\StrBefore{#1}{/}[\mmstart]
\StrBehind{#1}{/}[\yystart]
\StrBefore{#2}{/}[\mmend]
\StrBehind{#2}{/}[\yyend]
\pgfmathsetmacro\ymstart{(\yystart-\anno)+(1/13*\mmstart)}
\pgfmathsetmacro\ymend{(\yyend-\anno)+(1/13*\mmend)}
\filldraw[fill=#4!50, draw=#4,] (\ymstart,#3-.45) rectangle (\ymend,#3+.45) node [font=\scriptsize, text centered, midway, inner sep=0pt] {#5};
\pgfmathsetmacro\mmone{\months[\mmstart-1]}
\pgfmathsetmacro\mmtwo{\months[\mmend-1]}
\node[rotate=90, anchor=north, inner sep=1pt, font=\tiny\scshape] at (\ymstart,#3) {\mmone};
\node[rotate=90, anchor=south, inner sep=1pt, font=\tiny\scshape] at (\ymend,#3) {\mmtwo};
}
\begin{document}
\begin{tikzpicture}[x=\myspacing cm,y=5mm]
\centering
%draw horizontal line + years
\draw[|->, -latex] (-.5,0) -- (\myend+.5,0);
\path (0,0) -- (0,\alto);
\foreach \x [evaluate=\x as \year using int(\anno+\x)] in {0,...,\myend}{
\draw (\x,0) node[below=7pt,font=\footnotesize] {$\year$};
\draw (\x,-.2) -- (\x,.2);
\draw[loosely dotted] (\x,.2) -- (\x,\alto);
}
\foreach \tick in {0,\tix,...,\myend}{
\draw (\tick,.1) -- (\tick,-.1);
}
\nation{11/2008}{10/2010}{1}{cyan}{Hungary}
\nation{12/2008}{12/2011}{2}{olive}{Latvia}
\nation{5/2009}{6/2011}{3}{gray}{Romania I}
\nation{5/2010}{6/2015}{4}{red}{Greece I \& II}
\end{tikzpicture}
\end{document}
My code can do simple styles, too, actually. However, chronology
can, at least, be adapted in ways which chronosys
simply resists. Note that it does some dodgy things in the style file, for all that, though.
\documentclass[11pt,a4paper]{article}
\usepackage{chronology,geometry}
\tikzset{flippedeventlabel/.append style={align=center}}
\begin{document}
\begin{chronology}*[2]{2007}{2017}{\the\linewidth}
\event{\decimaldate{01}{03}{2010}}{first event}
\event{\decimaldate{01}{03}{2010}}{second event}
\event{\decimaldate{01}{03}{2014}}{this is a very long description that I\\ want to break manually}
\end{chronology}
\end{document}
Do the same for eventlabel
if not 'flipping' the timeline.
Best Answer
chronos
now automatically eliminate year zero by default. (It can be reinstated if required.) It also omits minus signs for years by default and can be customised to include labels for the era (BCE/CE or whatever).Here's a default timeline showing the last day of BCE and the first of CE.
Note that I'm fully aware of the inappropriateness of calling 1st January New Year's Day etc. at this point, and that current calendars are not really appropriate here. These examples are intended for demonstration purposes only because I take it that, in most cases, timelines running partly or wholly in BCE will include only years rather than full dates anyway. If there are exceptions,
chronos
allows the date markers for events to be specified as arbitrary text on a per event basis.The year zero can be reinstated if required. The underlying code is using
pgfcalendar
which assumes a year zero (and uses minuses).Here are three possibilities for your timeline with
chronos
. Further customisation should be straightforward as the original idea was to provide a more flexible and transparent alternative tochronosys
.Note that the marks are not equidistant, because the time between 1 CE and 5 CE is obviously less than in the other cases. Obviously, you could also mark 1 BCE, but that would put the marker very close to 1 CE. The issue here is that although 1 BCE ends as 1 CE starts (i.e. there is no year 0), the years are marked at YYYY-01-01, as you'd expect. So the 'turning point' marks 31 December 1 BCE and 1 January 1 CE, but 1 BCE's marker would be at 1 January 1 BCE.
I'm not sure whether I should be marking the years at the mid-year point. But then an event on 1st April will be placed prior to the year marker (reading left to right). I'm not sure if that would be better or not and would welcome input on this as I'm really not clear what the correct answer is.
I may adapt this to produce timelines which have higher information density (of the kind I posted a while ago, though mine had a year zero). If you allow the lines to events to turn, I think the effect is neater and clearer. However, that's not how the existing packages seem to do it and I'm not really sure anybody but me is much interested!
Complete code (chronos 2016-08-15):