6

Can anyone explain how to use chronology.sty or provide a link to some live (useful) documentation?

In more detail: I am creating an outline and timetable schedule for my academic thesis. I started with https://stackoverflow.com/questions/217834/how-to-create-a-timeline-with-latex and I have found that chronology.sty by Levi Wiseman produces something very close to my desired output but the documentation that should be found at http://tug.org/texlive/Contents/live/texmf-dist/doc/latex/chronology/chronology.pdf is no longer live. I have examined the chronology.sty file to the best of my ability and deduce that argument #1 = stepsize, #2 = yearstart, #3 = yearstop, #4 = unit and #5 = timelinewidth. However I can't seem to get my timeline to behave as desired.

I would like my timeline period to be 18 months Mid-2013 to End-2014, with large dividers every month and small dividers every week. My "events" will require the \decimaldate precision. I am aware that the package may have some bugs see link Chronology adds arbitrary gaps. I will email this request to Levi Wiseman.

1 Answers1

5

Here's an unflexible and slow first concept for the timeline using tikz and datenumber, I'll work a bit further on this tomorrow:

Code

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows}
\usepackage{datenumber}
\usepackage{xifthen}

\begin{document}

\setdatenumber{2013}{06}{19}
% 560 days or 80 weeks until new years eve 2014

\begin{tikzpicture}
    \draw[-stealth] (0,0) -- (16,0) -- ++(0.3,0);
    % 16cm = 80 weeks --> one week = 0.2cm
    \pgfmathsetmacro{\width}{16/560}
    \foreach \x in {0,...,80}
    { \draw (\x/5,0) -- (\x/5,-0.05) node[left,rotate=90,font=\tiny] {\thedateday-\thedatemonth-\thedateyear};
        \addtocounter{datenumber}{7}
        \setdatebynumber{\thedatenumber}
    }
    \setdatenumber{2013}{06}{19}
    \foreach \x in {0,...,560}
    { \ifthenelse{\thedateday = 1}
        { \ifcase\thedatemonth
            \or \xdef\monthname{Jan}
            \or \xdef\monthname{Feb}
            \or \xdef\monthname{Mar}
            \or \xdef\monthname{Apr}
            \or \xdef\monthname{May}
            \or \xdef\monthname{Jun}
            \or \xdef\monthname{Jul}
            \or \xdef\monthname{Aug}
            \or \xdef\monthname{Sep}
            \or \xdef\monthname{Oct}
            \or \xdef\monthname{Nov}
            \or \xdef\monthname{Dec}    
            \else       
            \fi
            \draw (\x/35,0) -- (\x/35,0.25) node[right,rotate=90,font=\tiny] {\monthname\ \thedateyear};
            %\draw (\x/35,0) -- (\x/35,0.25) node[right,rotate=90,font=\tiny] {\thedatemonth \thedateyear};
        }{}
        \addtocounter{datenumber}{1}
        \setdatebynumber{\thedatenumber}
    }
\end{tikzpicture}

\end{document}

Output

enter image description here


Edit 1: Here's an automatic version that's actually a little customizable, and has a command to add entries. There's a lot of room for improvement, for instance one could incorporate the timeline pasrameters in the \drawtimeline command, a key-value interface would be nice etc. etc.

Code

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows}
\usepackage{datenumber}
\usepackage{xifthen}

% counters for calculating with dates
\newcounter{startdate}
\newcounter{enddate}
\newcounter{tempdate}
\newcounter{dateone}
\newcounter{datetwo}

% 
\newcommand{\startenddiff}[6]{%
\setmydatenumber{startdate}{#1}{#2}{#3}%
\setmydatenumber{enddate}{#4}{#5}{#6}%
\setmydatenumber{tempdate}{#4}{#5}{#6}%
\addtocounter{tempdate}{-\thestartdate}%
}

%
\newcommand{\datediff}[6]%
{   \setmydatenumber{dateone}{#1}{#2}{#3}
    \setmydatenumber{datetwo}{#4}{#5}{#6}
    \addtocounter{dateone}{-\thestartdate}
    \addtocounter{datetwo}{-\thestartdate}
}

%
\newcommand{\drawtimeline}%
{   \setdatebynumber{\thestartdate}
    \pgfmathtruncatemacro{\numberofdays}{\thetempdate}
    \pgfmathsetmacro{\daywidth}{\timelinewidth/\numberofdays}
    \draw[-stealth] (0,0) -- (\timelinewidth,0) -- ++(0.3,0);
    \foreach \x in {0,...,\numberofdays}
    { \ifthenelse{\thedateday = 1}
        { \ifcase\thedatemonth
            \or \xdef\monthname{Jan}
            \or \xdef\monthname{Feb}
            \or \xdef\monthname{Mar}
            \or \xdef\monthname{Apr}
            \or \xdef\monthname{May}
            \or \xdef\monthname{Jun}
            \or \xdef\monthname{Jul}
            \or \xdef\monthname{Aug}
            \or \xdef\monthname{Sep}
            \or \xdef\monthname{Oct}
            \or \xdef\monthname{Nov}
            \or \xdef\monthname{Dec}    
            \else       
            \fi
            \draw (\x*\daywidth,0) -- (\x*\daywidth,0.25) node[right,rotate=90,font=\tiny] {\monthname\ \thedateyear};
        }{}
        \ifthenelse{\equal{\datedayname}{Monday}}
        { \draw (\x*\daywidth,0) -- (\x*\daywidth,-0.05);
        }{}
        \addtocounter{datenumber}{1}
        \setdatebynumber{\thedatenumber}
    }
}

\newcommand{\timeentry}[8][gray]% [options] start date, end date, description
{ \datediff{#2}{#3}{#4}{#5}{#6}{#7}
    \pgfmathtruncatemacro{\numberofdays}{\thetempdate}
    \pgfmathsetmacro{\daywidth}{\timelinewidth/\numberofdays}
    \draw[opacity=0.5,line width=1.5mm,line cap=round,#1] (\thedateone*\daywidth,0) -- (\thedatetwo*\daywidth,0) node[left,rotate=60,pos=0.5] {#8};
}

\begin{document}

% ===== user's choices =========================
\startenddiff{2013}{06}{20}{2014}{03}{31}
\pgfmathsetmacro{\timelinewidth}{16}% will be 0.3cm wider for arrow tip
% ==============================================
\begin{tikzpicture}
    \drawtimeline
    \timeentry{2013}{07}{20}{2013}{08}{01}{Test}
    \timeentry{2013}{08}{20}{2013}{09}{01}{Test}
    \timeentry{2013}{09}{20}{2013}{10}{01}{Test}
    \timeentry{2013}{10}{20}{2013}{11}{01}{Test}
    \timeentry{2013}{11}{20}{2013}{12}{01}{Test}
\end{tikzpicture}

% ===== user's choices =========================
\startenddiff{2013}{07}{01}{2013}{10}{01}
\pgfmathsetmacro{\timelinewidth}{10}% will be 0.3cm wider for arrow tip
% ==============================================
\begin{tikzpicture}
    \drawtimeline
    \timeentry[red,text opacity=1]{2013}{08}{14}{2013}{08}{19}{Test}
    \timeentry[blue]{2013}{07}{08}{2013}{07}{15}{Test 2}
\end{tikzpicture}

% ===== user's choices =========================
\startenddiff{2013}{07}{01}{2014}{12}{31}
\pgfmathsetmacro{\timelinewidth}{20}% will be 0.3cm wider for arrow tip
% ==============================================
\begin{tikzpicture}
    \drawtimeline

    \timeentry[red!5]{2013}{07}{10}{2013}{08}{1}{Test}
    \timeentry[red!10]{2013}{08}{10}{2013}{09}{1}{Test}
    \timeentry[red!15]{2013}{09}{10}{2013}{10}{1}{Test}
    \timeentry[red!20]{2013}{10}{10}{2013}{11}{1}{Test}
    \timeentry[red!25]{2013}{11}{10}{2013}{12}{1}{Test}
    \timeentry[red!30]{2013}{12}{10}{2014}{01}{1}{Test}

    \timeentry[red!35]{2014}{01}{10}{2014}{02}{1}{Test}
    \timeentry[red!40]{2014}{02}{10}{2014}{03}{1}{Test}
    \timeentry[red!45]{2014}{03}{10}{2014}{04}{1}{Test}
    \timeentry[red!50]{2014}{04}{10}{2014}{05}{1}{Test}
    \timeentry[red!55]{2014}{05}{10}{2014}{06}{1}{Test}
    \timeentry[red!60]{2014}{06}{10}{2014}{07}{1}{Test}
    \timeentry[red!65]{2014}{07}{10}{2014}{08}{1}{Test}
    \timeentry[red!70]{2014}{08}{10}{2014}{09}{1}{Test}
    \timeentry[red!75]{2014}{09}{10}{2014}{10}{1}{Test}
    \timeentry[red!80]{2014}{10}{10}{2014}{11}{1}{Test}
    \timeentry[red!85]{2014}{11}{10}{2014}{12}{1}{Test}
    \timeentry[red!90]{2014}{12}{10}{2015}{01}{1}{Test}
\end{tikzpicture}

\end{document}

Output

enter image description here

Tom Bombadil
  • 40,123