I am trying to create a simple timeline with years underneath the line and some explaining text above each year. I understand that chronology is useful for this.

My problem is that when trying out examples from related questions (e.g. here or here), I always get the error "! Missing number, treated as zero."

A MWE (from the first related question linked to above):


Which results in:

! Missing number, treated as zero. 
to be read again> 
l.4 ...chronology}[3]{2011}{2016}{3ex}{\textwidth}

I have tried changing some of the values or removing them altogether, but this doesn't seem to help.

Has anyone encountered this problem or does anyone know of a solution? Chronology seems to be exactly what I need.

  • @LaRiFaRi That produced a tiny timeline without the years. – P. de Rijke Mar 18 '15 at 12:33

Removing the 3ex produces the following output without error:

Sample output

  • That does it! I had tried leaving the curly braces around "3ex" empty, but hadn't tried you solution. – P. de Rijke Mar 18 '15 at 12:35
  • It is still strange that the code in my MWE does compile for others... – P. de Rijke Mar 18 '15 at 12:37
  • My only guess is that the package has been updated without changing the version info. It is very short on documentation... – Andrew Swann Mar 18 '15 at 13:40

The package has been changed after Oct 14 '11 (edit: or even Apr 18 '13) as the counters and lengths have been moved outside the environment definition. I do not know, why the CTAN is telling differently. Maybe it was happening both (Werner's post and Levi's fix) at more or less the same time.

However, the actual code does not provide the fixed definition of the chronology environment, which can be found here, too.

Using Werner's and Gonzalo's code, you get the image of the other post you have linked to.

% arara: pdflatex


    \begin{tikzpicture}[baseline={(current bounding box.north)}]%
    \draw [|->] (0,0) -- (\thedeltayears*\unit+\unit, 0);%
    \foreach \x in {1,...,\thedeltayears}%
    \draw[xshift=\x*\unit] (0,-.1\unit) -- (0,.1\unit);%
    \foreach \x in {\thestepstart,\thestep,...,\thestepstop}{%
        \draw[xshift=\xstop] (0,-.3\unit) -- (0,.3\unit);%
        \node at (\xstop,0) [below=.2\unit] {\x};}%


enter image description here

  • Thank you. That worked in the example, but curiously not when I started adding /events. I still got it to work with the answer I accepted above, but with different problems. I've asked a follow-up question. – P. de Rijke Mar 18 '15 at 14:53
  • What should do if I want something like: 100 --- 150 --- 200 ---- 250 --- 300 -----350 --- ... – alper Feb 22 at 13:22

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.