9

My code

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{chronosys}
\usepackage{geometry}

\begin{document}


\startchronology[startyear=-3000,stopyear=-2000, startdate=false, color=blue!40, stopdate=false, arrow=true, height=3pt]
\setupchronoevent{textstyle=\scriptsize,datestyle=\scriptsize}
\chronograduation[event]{100}
\chronoevent[markdepth=60pt]{-2080}{IM15 (C)}
\chronoevent[markdepth=-80pt]{-2115}{IM13 (C)}
\chronoevent[markdepth=20pt]{-2115}{IM26 (B)}
\chronoevent[markdepth=100pt]{-2170}{IM20 (B)} 
\chronoevent[markdepth=-120pt]{-2190}{IIIM76 (E)}
\chronoevent[markdepth=70pt]{-2200}{IIIM353 (C)}
\chronoevent[markdepth=30pt]{-2245}{IIM69 (C)}
\chronoevent[markdepth=-70pt]{-2250}{IIM281 (C)}
\chronoevent[markdepth=-50pt]{-2145}{IM10 (B)}
\chronoevent[markdepth=-30pt]{-2240}{IIM163 (C)}
\chronoevent[markdepth=-70pt]{-2475}{IM90 (C)}
\chronoevent[markdepth=20pt]{-2480}{IM90 (B)}
\chronoevent[markdepth=-20pt]{-2500}{IIM63 (C)}
\chronoevent[markdepth=70pt]{-2550}{IM21 (A)}
\chronoevent[markdepth=-50pt]{-2570}{IM163 (B)}
\chronoevent[markdepth=30pt]{-2620}{IIM13 (C)}
\chronoevent[markdepth=-40pt]{-2690}{IM5 (B)}
\chronoevent[markdepth=40pt]{-2760}{IM130 (B)}
\chronoevent[markdepth=-15pt]{-2770}{IM65 (C)}
\chronoevent{-2935}{IM157 (B)}
\stopchronology
\end{document}

Results in this:

enter image description here

My question: How can I reduce the space between the date of an event and the text?

with \chronoperiode you can make it work like this

\chronoperiode[dateselevation=12pt]{-3000}{-2500}{blablabla}

but this does not work with \chronoevent

  • 1
    Do please note the discussion in this question and the answers to it. This package cannot really be recommended if you even think you might want to tweak the appearance of your timelines at all. – cfr Aug 8 '16 at 21:58
  • 1
    See also tex.stackexchange.com/questions/312704/…. – cfr Aug 8 '16 at 22:08
8
+50

You have to manually update the \dochronoevent macro as its constructed under a different category code setup:

enter image description here

\documentclass{article}

\usepackage{chronosys}

\begingroup
\makeatletter
\catcode`\!=11%

\gdef\dochronoevent[#1]#2#3{%
\if!chronearg \!chrtraitingargvirgule{#1}{!chr@event}\fi
% % %
\csname !chreventbarre\!chr@eventbarre\endcsname 
\csname !chreventmark\!chr@eventmark\endcsname 
\csname !chreventdate\!chr@eventdate\endcsname
\csname !chreventconversionmonth\!chr@eventconversionmonth\endcsname 
\csname !chreventyear\!chr@eventyear\endcsname
\csname !chreventifcolorbox\!chr@eventifcolorbox\endcsname
\!chreventmarkdepth\!chr@eventmarkdepth 
\!chreventiconheight\!chr@eventiconheight
\ifx\!chr@eventtextwidth\!chreventdefaulttesttextwidth 
   \!chrperiodeventtextwidth=-1pt%
\else \!chrperiodeventtextwidth\!chr@eventtextwidth
\fi
\ifdim\!chreventmarkdepth<\z@\relax
  \!chreventlocationuptrue
\else
  \!chreventlocationupfalse
\fi
% % % Evaluation de la precision de la date de l'evenement
\!chreventevalspecification{#2}%
\ifnum\count@<4\relax
  \ifcase\count@
    \or \!chreventspecifieddayfalse\!chreventspecifiedmonthfalse 
        \edef\!chreventyear{\csname !chreventspecifiedargument1\endcsname}%
    \or \!chreventspecifieddayfalse\!chreventspecifiedmonthtrue
        \edef\!chreventyear{\csname !chreventspecifiedargument2\endcsname}%
        \edef\!chreventmonth{\csname !chreventspecifiedargument1\endcsname}%
    \or \!chreventspecifieddaytrue\!chreventspecifiedmonthtrue
        \edef\!chreventyear{\csname !chreventspecifiedargument3\endcsname}%
        \edef\!chreventmonth{\csname !chreventspecifiedargument2\endcsname}%
        \edef\!chreventday{\csname !chreventspecifiedargument1\endcsname}%
  \fi %
% %On s'assure que les dates sont bien comprises dans les bornes
\ifnum\!chreventyear>\numexpr\!chrstartyear-1\relax
\ifnum\!chreventyear<\numexpr\!chrstopyear+1\relax
      \if!chreventspecifiedmonth
        \if!chreventspecifiedday 
          \count@\numexpr\!chreventday+\!chreventmonth*30\relax
        \else %
          \count@\numexpr\!chreventmonth*30\relax
        \fi
      \else \count@\z@
      \fi %
      \!chr!dimentraitement\dimexpr(\!chr!unitperyear)/365*\count@\relax%
     \count@\numexpr\!chreventyear-\!chrstartyear\relax 
     \advance\!chr!dimentraitement\dimexpr\count@\!chr!unitperyear\relax
% % % Affichage
     \dimen@i\wd\!chrflechebox
     \setbox\!chrflechebox\hbox{%
       \unhbox\!chrflechebox\kern-\dimen@i\kern\!chr!dimentraitement
       \if!chreventbarre
        \begingroup{%
        \!chrusecolor{black}%
        \kern-0.4pt\relax\vrule width0.4pt height\!chrheight depth\z@\relax
        }%
        \endgroup
       \fi
       \kern-0.4pt\raise\!chreventiconheight \hbox to\z@{\hss\!chr@eventicon\hss}%
       \lower\dimexpr\!chreventmarkdepth+2pt\relax
       \hbox to\z@{%
         \vbox to\z@{%
           \if!chreventlocationup\relax\vss\fi
           \if!chreventdate\hbox to\z@{%
             \hss \if!chreventifcolorbox \expandafter\!chreventcolorbox\fi
             {\!chr@eventdatestyle{%
               \if!chreventspecifiedday %
                 {\!chr@eventdatesstyle{\!chreventday}}\!chr@eventdatesseparation
               \fi
             {\!chr@eventdatesstyle{%
               \if!chreventspecifiedmonth 
                 \if!chreventconversionmonth\expandafter \chron@selectmonth
                 \fi 
                 \!chreventmonth
               \fi
               }%
             }%
             \if!chreventspecifiedmonth\if!chreventyear \!chr@eventdatesseparation\fi\fi 
             \if!chreventyear{\!chr@eventdatesstyle{\!chreventyear}}\fi%
             }}%
             \hss
           }%
           \fi
           \vspace{-3pt}% <------------------------- Reduce gap between date/title
           \ifdim\!chrperiodeventtextwidth > \z@ 
             \hbox to\z@{%
               \hss\setbox\z@\hbox{%
                 \vbox{%
                   \hsize\!chrperiodeventtextwidth\relax\!chr@eventtextstyle{#3}%
                   \vskip1pt\relax
                 }%
               }%
               \dimen@i\dimexpr\wd\z@+4pt\relax
               \dimen@ii\dimexpr\ht\z@+\dp\z@+2pt\relax
               \setbox\z@\hbox to\z@{%
                 \hss\begingroup{\!chrusecolor{\!chr@eventcolorbox}\vrule height\dimen@ii width\dimen@i depth2pt\relax}\endgroup \kern-\dimen@i\kern2pt\relax%
                 \box\z@\hss
               }%
               \box\z@
             }%
           \else 
             \hbox to\z@{%
               \hss\if!chreventifcolorbox\expandafter\!chreventcolorbox\fi{%
               \!chr@eventtextstyle{#3}}\hss
             }%
           \fi 
           \unless\if!chreventlocationup\relax\vss\fi
         }%
       }%
       \if!chreventmark
         \if!chreventlocationup\relax
         %\!chrstarttikzpicture \!chrdraw(0,0)--(0,\the\!chreventmarkdepth+5pt);\!chrstoptikzpicture
           \vrule height\dimexpr-\!chreventmarkdepth-5pt\relax depth\z@ \kern-0.4pt\relax
         \else \vrule height\z@ depth\!chreventmarkdepth
         \fi
         \kern-0.4pt\relax
       \fi  
       \setbox0\vbox{%
         \if!chreventdate
           \hbox{#2}%
         \fi
         \hbox{%
          \ifdim\!chrperiodeventtextwidth > \z@ 
            \vbox {%
             \hsize\!chrperiodeventtextwidth #3%
            }%
          \else #3%
          \fi 
         }%
       }%
      \begingroup\dimen@\dimexpr\dp0+\ht0+2pt\relax
      \dimen@i\dimexpr\dimen@-\!chreventmarkdepth\relax
      \if!chreventlocationup
        \ifdim \dimen@i >\!chrskipbefore \global\!chrskipbefore\dimen@i \fi
      \else
        \ifdim \dimen@ >\!chrskipafter \global\!chrskipafter\dimen@ \fi
      \fi
      \endgroup
    }%
\fi\fi\fi}%

\endgroup

\begin{document}

\startchronology[startyear=-3000,stopyear=-2000, startdate=false, color=blue!40, stopdate=false, arrow=true, height=3pt]
  \setupchronoevent{textstyle=\scriptsize,datestyle=\scriptsize}
  \chronograduation[event]{100}
  \chronoevent[markdepth=60pt]{-2080}{IM15 (C)}
  \chronoevent[markdepth=-80pt]{-2115}{IM13 (C)}
  \chronoevent[markdepth=20pt]{-2115}{IM26 (B)}
  \chronoevent[markdepth=100pt]{-2170}{IM20 (B)} 
  \chronoevent[markdepth=-120pt]{-2190}{IIIM76 (E)}
  \chronoevent[markdepth=70pt]{-2200}{IIIM353 (C)}
  \chronoevent[markdepth=30pt]{-2245}{IIM69 (C)}
  \chronoevent[markdepth=-70pt]{-2250}{IIM281 (C)}
  \chronoevent[markdepth=-50pt]{-2145}{IM10 (B)}
  \chronoevent[markdepth=-30pt]{-2240}{IIM163 (C)}
  \chronoevent[markdepth=-70pt]{-2475}{IM90 (C)}
  \chronoevent[markdepth=20pt]{-2480}{IM90 (B)}
  \chronoevent[markdepth=-20pt]{-2500}{IIM63 (C)}
  \chronoevent[markdepth=70pt]{-2550}{IM21 (A)}
  \chronoevent[markdepth=-50pt]{-2570}{IM163 (B)}
  \chronoevent[markdepth=30pt]{-2620}{IIM13 (C)}
  \chronoevent[markdepth=-40pt]{-2690}{IM5 (B)}
  \chronoevent[markdepth=40pt]{-2760}{IM130 (B)}
  \chronoevent[markdepth=-15pt]{-2770}{IM65 (C)}
  \chronoevent{-2935}{IM157 (B)}
\stopchronology

\end{document}

I've highlighted the negative vertical gap added between the date/title in the above code: \vspace{-3pt} provides a sufficient reduction without causing an overlap of the box backgrounds.

14

Current version of chronos is available at:
https://tex.stackexchange.com/a/342699/ (2016-12-06)

Here is an alternative to chronosys which uses an enhanced version of the code in this answer and this answer.

EDIT The code has been further adapted for this answer.

EDIT EDIT The format of the date displayed in events may now be customised as explained in this answer.

The advantage of this is that it is much, much, much easier to modify than chronosys. The appearance can be tweaked essentially to your liking. Here's a version based on the chronosys version you posted. It shows reduced spacing between the dates and descriptions of events.

chronos alternative

Essentially, the preamble is long because it replicates relevant parts of chronosys using PGF/TikZ, with a particular eye to making the code flexible and easy to customise. Once that is done, the timeline itself can be drawn as follows.

\begin{tikzpicture}
  [

Start our tikzpicture ready to specify some options.

    chronos={%

This triggers the timeline configuration. If value is given to chronos, it will apply the requested settings. If not, it will use defaults.

      timeline width=120mm,
      timeline height=3pt,

Width and height of the main time line.

      start date={-3000}-01-01,
      end date={-2000}-01-01,

Start and end dates in ISO format. The years must be protected by curly brackets so that the parser does not mistake the negative sign for a dash.

      events/.append style={font=\scriptsize},

This adds to the default events style. events sets the style for both single-date and temporally extended events. If required, the styles of each can then be customised separately by using, for example.

      period event/.append style={<keys for extended events>},
      event/.append style={<keys for single-date events>},

That's not needed here as we don't need any temporally extended events anyway.

      timeline year={font=\tiny},

Additional keys to customise the appearance of the nodes marking the years on the timeline.

      timeline line={blue!40, shorten >=-20mm, -{Triangle Cap[length=20mm]}},

This sets the style for the main timeline.

      only years,

By default, the code assumes that event dates are fully determined i.e. YYYY-MM-DD. Since we only have years, we'll tell TikZ this so that we don't have to manually add dummy -MM-DD every time we specify a date.

      step years=100,

By default, the code tries to mark every year on the timeline. 1,000 years is too much for A4, so we'll use somewhat larger steps.

      timeline years=below,

By default, the years are written above the timeline. This puts them below.

      timeline marks,

This creates small lines from the main timeline to the nodes containing the years.

    }
  ]

If we wished, we could further customise the line using the following keys

      lines/.append style={<keys for lines drawn to events>},
      event line/.append style={<keys for lines drawn to one-day events>},
      period event line/.append style={<keys for lines drawn to temporally extended events>},
      period/.append style={<keys for marking extended events on the timeline itself>},
      timeline mark={<additional keys to customise appearance of lines drawn from timeline to years>},
      background={<colour of page>},
      timeline border inner colour=<colour for shaded border>,
      timeline border outer colour=<other colour for shading>,
      timeline border height=<height for shaded border>,
      timeline no years,
      event years on line,

The background colour is set to white by default. This affects the default appearance of the nodes containing dates and text for the events and the years on the timeline.

If you wish to simply configure things from scratch, use .style rather than .append style, of course.

Returning to our timeline, we are ready to add some events.

The code provides two commands for adding single-day and temporally extended events to the time line.

  • \chronosevent [<options for event line>] {<date>} [<options for event node>] {<text>} (<distance of event node from timeline>)

  • \chronosperiod [<options for line marking period on timeline>] [<start date>] [<options for period event line>] {<end date>} [<options for period event node>] {<text>} (<distance of period event node from timeline>)

Expamples of \chronosevent's extended syntax and her sister command, \chronosperiod, in use are included in my earlier answer. Although I've changed the implementation in order to accommodate your timeline, the syntax of the commands remains unaltered.

In addition,

  • \chronosspecialdate{<text>} may be used to replace the date or year for the next \chronosevent with an alternative designation. For example, \chronosspecialdate{Christmas} \chronosevent{1123-12-25}{Merriment}.

Our case is quite simple. We are formatting events consistently, so we don't need the optional arguments to customise the appearance of each event. Since we only have one-day events so \chronosevent is sufficient and we don't need to customise anything other than the offset from the timeline, we can simply use

\chronosevent {<year>}{<text>}(<dimension>}

as follows

  \chronosevent {-2080}{IM15 (C)}(60pt)
  \chronosevent {-2115}{IM13 (C)}(-80pt)
  \chronosevent {-2115}{IM26 (B)}(20pt)
  \chronosevent {-2170}{IM20 (B)}(100pt)
  \chronosevent {-2190}{IIIM76 (E)}(-120pt)
  \chronosevent {-2200}{IIIM353 (C)}(70pt)
  \chronosevent {-2245}{IIM69 (C)}(30pt)
  \chronosevent {-2250}{IIM281 (C)}(-70pt)
  \chronosevent {-2145}{IM10 (B)}(-50pt)
  \chronosevent {-2240}{IIM163 (C)}(-30pt)
  \chronosevent {-2475}{IM90 (C)}(-70pt)
  \chronosevent {-2480}{IM90 (B)}(20pt)
  \chronosevent {-2500}{IIM63 (C)}(-20pt)
  \chronosevent {-2550}{IM21 (A)}(70pt)
  \chronosevent {-2570}{IM163 (B)}(-50pt)
  \chronosevent {-2620}{IIM13 (C)}(30pt)
  \chronosevent {-2690}{IM5 (B)}(-40pt)
  \chronosevent {-2760}{IM130 (B)}(40pt)
  \chronosevent {-2770}{IM65 (C)}(-15pt)
  \chronosevent {-2935}{IM157 (R)}

That's the lot

\end{tikzpicture}

so we close the tikzpicture environment to finish.

Code:

\pdfminorversion=7
\documentclass[border=10pt,multi,tikz,svgnames,HTML,rgb]{standalone}
\usepackage{pgfcalendar}
\usepackage{datenumber,xparse,fp}
\usetikzlibrary{arrows.meta,backgrounds,fixedpointarithmetic}
\makeatletter
\ExplSyntaxOn
\tl_new:N \l_chronos_dateformat_tl
\tl_set:Nn \l_chronos_dateformat_tl { Y/m/d }
% YY yn lle YYYY
\cs_new_protected_nopar:Npn \chronos_year_shorten:n #1
{
  \chronos_year_shorten_aux:w #1 \q_stop % expl3 manuaal, 46
}
\cs_new_protected_nopar:Npn \chronos_year_shorten_aux:w #1 #2 #3 #4 \q_stop
{
  #3 #4
}
\cs_generate_variant:Nn \chronos_year_shorten:n { V , c }
% dangos dyddiadau
\cs_new_protected_nopar:Npn \chronos_show_date:n #1
{
  \tl_map_inline:Nn \l_chronos_dateformat_tl
  {
    \str_case:nnF { ##1 }
    {
      { a } { \pgfcalendarweekdayshortname{\thechronos@weekday} }
      { A } { \pgfcalendarweekdayname{\thechronos@weekday} }
      { b } { \pgfcalendarmonthshortname{\csname chronos@#1month\endcsname} }
      { B } { \pgfcalendarmonthname{\csname chronos@#1month\endcsname} }
      { d } { \csname chronos@#1day\endcsname }
      { m } { \csname chronos@#1month\endcsname }
      { y } { \chronos_year_shorten:c { chronos@#1year } }
      { Y } { \csname chronos@#1year\endcsname }
      { @ } { ~ }
    }
    {
      ##1
    }
  }
}
% user interface
\NewDocumentCommand \chronossetdateformat { m }
{
  \tl_set:Nn \l_chronos_dateformat_tl { #1 }
  \tl_replace_all:Nnn \l_chronos_dateformat_tl { ~ } { @ }
}
% for pgf/tikz convenience
\NewDocumentCommand \chronos@showdate { m }
{
  \pgfcalendarjuliantoweekday{\csname thechronos@#1date\endcsname}{\c@chronos@weekday}%
  \chronos_show_date:n { #1 }
}
\ExplSyntaxOff
\newcounter{chronos@date}
\newcounter{chronos@startdate}
\newcounter{chronos@enddate}
\newcounter{chronos@startyear}
\newcounter{chronos@endyear}
\newcounter{chronos@yeardate}
\newcounter{chronos@thingdate}
\newcounter{chronos@otherthingdate}
\newcounter{chronos@weekday}
\newif\ifchronos@marks
\chronos@marksfalse
\newif\ifchronos@timeline@showyears
\chronos@timeline@showyearstrue
\newif\ifchronos@eventyearsonline
\chronos@eventyearsonlinefalse
\pgfkeys{/pgf/number format,
  int detect,
  set thousands separator={},
}
\tikzset{%
  /handlers/.chronos too/.code={%
    \edef\chronos@tempc{\pgfkeyscurrentpath}%
    \edef\chronos@tempd{#1}%
    \tikzset{%
      \pgfkeyscurrentpath @too/.code={%
        \tikzset{%
          /chronos/\chronos@tempd/.append style={##1},
        }%
      },
      \chronos@tempc/.forward to=\chronos@tempc @too,
    }%
  },
  chronos/.code={% https://tex.stackexchange.com/a/159856/ - Claudio Fiandrino
    \tikzset{%
      align=center,
      anchor=mid,
      fixed point arithmetic,
      /chronos/.cd,
      #1,
    }%
    \pgfmathsetmacro\chronos@unit{(\chronos@width-20pt)/(\thechronos@enddate-\thechronos@startdate)}%
    \draw [/chronos/timeline@line, line width=\chronos@height] (-10pt,0) coordinate (chronos pre) -- +(\chronos@width,0) coordinate (chronos post);
    \coordinate (chronos base) at (0,-.5*\chronos@height);
    \coordinate (chronos top) at (0,.5*\chronos@height);
    \coordinate (chronos foot) at (0,{-.5*\chronos@height-\chronos@borderheight});
    \coordinate (chronos head) at (0,{.5*\chronos@height+\chronos@borderheight});
    \coordinate (chronos start) at (0,0);
    \coordinate (chronos end) at ([xshift=-10pt]chronos post);
    \ifdim\chronos@borderheight>0pt
      \fill [bottom color=chronos@borderinner, top color=chronos@borderouter] (chronos pre |- chronos head) rectangle (chronos post |- chronos top);
      \fill [top color=chronos@borderinner, bottom color=chronos@borderouter] (chronos pre |- chronos base) rectangle (chronos post |- chronos foot);
    \fi
    \ifchronos@timeline@showyears
      \pgfmathsetcounter{chronos@startyear}{\chronos@startyear}%
      \pgfmathsetcounter{chronos@endyear}{\chronos@endyear}%
      \def\tempa{none}%
      \ifx\chronos@stepfrom\tempa
        \def\tempa{01}%
        \ifx\chronos@startmonth\tempa
          \ifx\chronos@startday\tempa
            \else\stepcounter{chronos@startyear}%
          \fi
          \else\stepcounter{chronos@startyear}%
        \fi
      \else
        \pgfmathsetcounter{chronos@startyear}{\chronos@stepfrom}%
      \fi
      \def\tempa{12}%
      \def\tempb{31}%
      \ifx\chronos@endmonth\tempa
        \ifx\chronos@endday\tempb
          \stepcounter{chronos@endyear}%
        \fi
      \fi
      \pgfmathsetmacro\chronos@nextstep{int(\thechronos@startyear+\chronos@stepyears)}%
      \foreach \i in {\thechronos@startyear,\chronos@nextstep,...,\thechronos@endyear} {%
        \pgfcalendardatetojulian{{\i}-01-01}{\c@chronos@yeardate}%
        \pgfmathsetmacro\chronos@tempa{(\thechronos@yeardate-\thechronos@startdate)*\chronos@unit}%
        \def\tempa{on line}%
        \ifx\tempa\chronos@timelineyears
          \node (chronos@year@\i) [/chronos/.cd, timeline@years, timeline year on line] at (\chronos@tempa pt,0) {\i};
          \ifchronos@marks
             \path [/chronos/timeline mark on line] (chronos@year@\i.south) -- (chronos@year@\i |- chronos base);
             \path [/chronos/timeline mark on line] (chronos@year@\i.north) --  (chronos@year@\i |- chronos top);
          \fi
        \else
          \node (chronos@year@\i) [/chronos/.cd, timeline@years, timeline year off line] at (\chronos@tempa pt,0) {\i};
          \ifchronos@marks
            \path [shorten <=.5*\chronos@height, /chronos/timeline mark off line] (\chronos@tempa pt, 0) -- (chronos@year@\i);
          \fi
        \fi
      }%
    \fi
    \ifchronos@eventyearsonline
    \tikzset{%
      /chronos/timeline years=on line,
    }%
    \fi
  },
  chronos set date/.code args={#1:#2:#3:#4}{%
    \pgfcalendardatetojulian{{#1}-#2-#3}{\c@chronos@date}%
    \setcounter{chronos@#4date}{\thechronos@date}%
    \expandafter\def\csname chronos@#4year\endcsname{#1}%
    \expandafter\def\csname chronos@#4month\endcsname{#2}%
    \expandafter\def\csname chronos@#4day\endcsname{#3}%
  },
  chronos date/.style args={#1-#2-#3}{%
    /tikz/chronos set date/.expanded={#1:#2:#3:thing}%
  },
  chronos period date/.style args={#1-#2-#3}{%
    /tikz/chronos set date/.expanded={#1:#2:#3:otherthing}%
  },
  /chronos/.search also={/tikz},
  /chronos/.cd,
  step years/.store in=\chronos@stepyears,
  step from year/.store in=\chronos@stepfrom,
  start date/.style args={#1-#2-#3}{%
    /tikz/chronos set date/.expanded={#1:#2:#3:start},
  },
  end date/.style args={#1-#2-#3}{%
    /tikz/chronos set date/.expanded={#1:#2:#3:end},
  },
  timeline width/.store in=\chronos@width,
  timeline height/.store in=\chronos@height,
  width/.forward to=/chronos/timeline width,
  height/.forward to=/chronos/timeline height,
  timeline border height/.store in=\chronos@borderheight,
  timeline border inner colour/.code={\colorlet{chronos@borderinner}{#1}},
  timeline border outer colour/.code={\colorlet{chronos@borderouter}{#1}},
  timeline years set/.store in=\chronos@timelineyears,
  timeline years/.is choice,
  timeline years/.forward to=/chronos/timeline years set,
  timeline years/above/.code={%
    \tikzset{%
      /chronos/timeline@years/.style={above, anchor=south, yshift=.5*\chronos@height},
    }%
  },
  timeline years/below/.code={%
    \tikzset{%
      /chronos/timeline@years/.style={below, anchor=north, yshift=-.5*\chronos@height},
    }%
  },
  timeline years/on line/.code={%
    \tikzset{%
      /chronos/timeline@years/.style={anchor=center},
    }%
  },
  only years/.code={%
    \chronossetdateformat{Y}%
    \tikzset{%
      /tikz/chronos date/.style={%
        /tikz/chronos set date/.expanded={##1:01:01:thing}%
      },
      /tikz/chronos period date/.style={%
        /tikz/chronos set date/.expanded={##1:01:01:otherthing}%
      },
    }%
  },
  only text/.code={%
    \tikzset{/chronos/only years}%
    \chronossetdateformat{}%
  },
  background/.code={%
    \colorlet{chronos@background}{#1}%
  },
  timeline marks/.is if=chronos@marks,
  timeline show years/.is if=chronos@timeline@showyears,
  timeline no years/.code={%
    \tikzset{%
      /chronos/timeline show years=false,
    }%
  },
  lines/.style={draw, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-{Triangle[width=0pt 3,reversed,length=0pt 1.5]}, shorten <={.5*\chronos@height}},
  events/.style={fill=chronos@background, fill opacity=.75, text opacity=1, draw opacity=1, rounded corners, align=center, font=\footnotesize},
  period/.style={draw},
  period event line/.style={/chronos/lines},
  period event/.style={/chronos/events},
  event line/.style={/chronos/lines},
  event/.style={/chronos/events},
  event years on line/.is if=chronos@eventyearsonline,
  event year on line/.style={/chronos/timeline@years, /chronos/timeline year on line},
  special date/.store in=\chronos@specialdate,
  timeline@line/.style={draw},
  timeline line/.chronos too=timeline@line,
  timeline year off line/.style={fill=chronos@background, text opacity=1, fill opacity=.75},
  timeline mark off line/.style={draw, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, thin, shorten >=-2pt},
  timeline year on line/.style={text=chronos@background, inner sep=1pt},
  timeline mark on line/.style={draw=chronos@background, shorten >=1.5pt},
  timeline mark too/.code={%
    \tikzset{%
      /chronos/.cd,
      timeline mark on line/.append style={#1},
      timeline mark off line/.append style={#1},
    }%
  },
  timeline year too/.code={%
    \tikzset{%
      /chronos/.cd,
      timeline year on line/.append style={#1},
      timeline year off line/.append style={#1},
    }%
  },
  timeline mark/.forward to=/chronos/timeline mark too,
  timeline year/.forward to=/chronos/timeline year too,
  start date=1001-10-01,
  end date=1003-06-14,
  timeline width=100mm,
  timeline height=1pt,
  timeline border height=0pt,
  chronos date=1850-01-01,
  chronos period date=1851-01-01,
  step years=1,
  timeline years=above,
  background=white,
  timeline border inner colour=black,
  timeline border outer colour=chronos@background,
  step from year=none,
  special date=none,
}
\NewDocumentCommand \chronosevent { O {} m O {} +m D () { -10pt } }
{%
  \tikzset{%
    chronos date/.expanded={#2},
  }5
  \pgfmathsetmacro\chronos@offset{(#5 < 0pt) ? (#5-.5*\chronos@height-.5*\chronos@borderheight) : (#5+.5*\chronos@height+.5*\chronos@borderheight)}%
  \pgfmathsetmacro\chronos@anchor{(#5 < 0pt) ? "north" : "south"}%
  \scoped[on background layer]{\path [postaction={/chronos/event line, #1}] ({(\thechronos@thingdate-\thechronos@startdate)*\chronos@unit pt},0) -- +(0,\chronos@offset pt) node [anchor=\chronos@anchor, /chronos/event, #3] {\chronos@showdate{thing}\\#4};}
  \ifchronos@eventyearsonline
    \edef\tempa{none}%
    \edef\tempb{\chronos@specialdate}%
    \ifx\tempa\tempb\else\let\chronos@thingyear\chronos@specialdate\tikzset{/chronos/special date=none}\fi
    \node [/chronos/.cd, event year on line] at ({(\thechronos@thingdate-\thechronos@startdate)*\chronos@unit pt},0) {\chronos@thingyear};
  \fi
}
\NewDocumentCommand \chronosspecialdate { m }
{%
  \tikzset{%
    /chronos/special date=#1,
  }%
}
\NewDocumentCommand \chronosperiod { O {} m O {} m O {} +m D () { -10pt } }
{%
  \tikzset{%
    chronos date/.expanded={#2}, chronos period date/.expanded={#4}
  }%
  \pgfmathsetmacro\chronos@offset{(#7 < 0pt) ? (#7-.5*\chronos@height-.5*\chronos@borderheight) : (#7+.5*\chronos@height+.5*\chronos@borderheight)}%
  \pgfmathsetmacro\chronos@anchor{(#7 < 0pt) ? "north" : "south"}%
  \path [postaction={line width=\chronos@height, /chronos/period, #1}] ({(\thechronos@thingdate-\thechronos@startdate)*\chronos@unit pt},0) -- ({(\thechronos@otherthingdate-\thechronos@startdate)*\chronos@unit pt},0);
  \scoped[on background layer]{\path [postaction={/chronos/period event line, #3}] ({(.5*\thechronos@otherthingdate+.5*\thechronos@thingdate-\thechronos@startdate)*\chronos@unit pt},0) -- +(0,\chronos@offset pt) node [anchor=\chronos@anchor, /chronos/period event, #5] {\chronos@showdate{thing}--\chronos@showdate{otherthing}\\#6};}
}
\makeatother
\begin{document}
\begin{tikzpicture}
  [
    chronos={%
      timeline width=120mm,
      timeline height=3pt,
      start date={-3000}-01-01,
      end date={-2000}-01-01,
      events/.append style={font=\scriptsize},
      timeline year={font=\tiny},
      timeline line={blue!40, shorten >=-20mm, -{Triangle Cap[length=20mm]}},
      only years,
      step years=100,
      timeline years=below,
      timeline marks,
    }
  ]
  \chronosevent {-2080}{IM15 (C)}(60pt)
  \chronosevent {-2115}{IM13 (C)}(-80pt)
  \chronosevent {-2115}{IM26 (B)}(20pt)
  \chronosevent {-2170}{IM20 (B)}(100pt)
  \chronosevent {-2190}{IIIM76 (E)}(-120pt)
  \chronosevent {-2200}{IIIM353 (C)}(70pt)
  \chronosevent {-2245}{IIM69 (C)}(30pt)
  \chronosevent {-2250}{IIM281 (C)}(-70pt)
  \chronosevent {-2145}{IM10 (B)}(-50pt)
  \chronosevent {-2240}{IIM163 (C)}(-30pt)
  \chronosevent {-2475}{IM90 (C)}(-70pt)
  \chronosevent {-2480}{IM90 (B)}(20pt)
  \chronosevent {-2500}{IIM63 (C)}(-20pt)
  \chronosevent {-2550}{IM21 (A)}(70pt)
  \chronosevent {-2570}{IM163 (B)}(-50pt)
  \chronosevent {-2620}{IIM13 (C)}(30pt)
  \chronosevent {-2690}{IM5 (B)}(-40pt)
  \chronosevent {-2760}{IM130 (B)}(40pt)
  \chronosevent {-2770}{IM65 (C)}(-15pt)
  \chronosevent {-2935}{IM157 (R)}
\end{tikzpicture}
\end{document}
  • Much more usable and readable timeline. Great work! – A Feldman Aug 12 '16 at 11:20
  • Thanks ;). I should do something about the date format when I can. (I'm not currently sure how best to go about it, though.) – cfr Aug 12 '16 at 11:34
  • @AFeldman I've edited the code and my (non-)answer to your question about customising dates in chronosys. You can now use \chronossetdateformat{} for this, which is a bit nicer, I hope. – cfr Aug 14 '16 at 0:59
  • Maybe it is time to write a tag-wiki. – Matsmath Aug 14 '16 at 1:21
  • @Matsmath What do you mean? I don't even know what a tag-wiki is. – cfr Aug 14 '16 at 1:23

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.