How to create a timeline using LaTeX?

In history books, you often have a timeline where events and periods are marked on the line at the correct relative distance to each other. How can you create something like this in LaTeX?

+65
latex tex timeline
Oct 20 '08 at 9:08
source share
8 answers

The tikz package seems to have what you want.

\documentclass{article} \usepackage{tikz} \usetikzlibrary{snakes} \begin{document} \begin{tikzpicture}[snake=zigzag, line before snake = 5mm, line after snake = 5mm] % draw horizontal line \draw (0,0) -- (2,0); \draw[snake] (2,0) -- (4,0); \draw (4,0) -- (5,0); \draw[snake] (5,0) -- (7,0); % draw vertical lines \foreach \x in {0,1,2,4,5,7} \draw (\x cm,3pt) -- (\x cm,-3pt); % draw nodes \draw (0,0) node[below=3pt] {$ 0 $} node[above=3pt] {$ $}; \draw (1,0) node[below=3pt] {$ 1 $} node[above=3pt] {$ 10 $}; \draw (2,0) node[below=3pt] {$ 2 $} node[above=3pt] {$ 20 $}; \draw (3,0) node[below=3pt] {$ $} node[above=3pt] {$ $}; \draw (4,0) node[below=3pt] {$ 5 $} node[above=3pt] {$ 50 $}; \draw (5,0) node[below=3pt] {$ 6 $} node[above=3pt] {$ 60 $}; \draw (6,0) node[below=3pt] {$ $} node[above=3pt] {$ $}; \draw (7,0) node[below=3pt] {$ n $} node[above=3pt] {$ 10n $}; \end{tikzpicture} \end{document} 

I don't know much about tikz, but it gives a nice timeline that looks like this:

enter image description here

+38
Oct. 20 '08 at 17:40
source share

There is a new chronology.sty Levi Wiseman . the documentation (pdf) reads:

Most timeline packages and solutions for LATEX are used to transfer large amounts of information and are therefore designed vertically. If you're just trying to label dates, a more appropriate timeline might be more appropriate. This is what chronology is for.

Here is a sample code:

 \documentclass{article} \usepackage{chronology} \begin{document} \begin{chronology}[5]{1983}{2010}{3ex}[\textwidth] \event{1984}{one} \event[1985]{1986}{two} \event{\decimaldate{25}{12}{2001}}{three} \end{chronology} \end{document} 

What produces this conclusion:

example output from chronology.sty

+63
Dec 10 '10 at 1:41
source share

The chronosys package also provides a pleasant solution. Here is an example from the user guide:

enter image description here

+14
Jul 25 '13 at 12:06 on
source share

Just an update.

The present TiKZ package issues: tikz Package Warning: Snakes have been replaced with decorations. Use decoration libraries instead of the snake library on the input line.,.

Accordingly, part of the code should be changed to:

 \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations} \begin{document} \begin{tikzpicture} %draw horizontal line \draw (0,0) -- (2,0); \draw[decorate,decoration={snake,pre length=5mm, post length=5mm}] (2,0) -- (4,0); \draw (4,0) -- (5,0); \draw[decorate,decoration={snake,pre length=5mm, post length=5mm}] (5,0) -- (7,0); %draw vertical lines \foreach \x in {0,1,2,4,5,7} \draw (\x cm,3pt) -- (\x cm,-3pt); %draw nodes \draw (0,0) node[below=3pt] {$ 0 $} node[above=3pt] {$ $}; \draw (1,0) node[below=3pt] {$ 1 $} node[above=3pt] {$ 10 $}; \draw (2,0) node[below=3pt] {$ 2 $} node[above=3pt] {$ 20 $}; \draw (3,0) node[below=3pt] {$ $} node[above=3pt] {$ $}; \draw (4,0) node[below=3pt] {$ 5 $} node[above=3pt] {$ 50 $}; \draw (5,0) node[below=3pt] {$ 6 $} node[above=3pt] {$ 60 $}; \draw (6,0) node[below=3pt] {$ $} node[above=3pt] {$ $}; \draw (7,0) node[below=3pt] {$ n $} node[above=3pt] {$ 10n $}; \end{tikzpicture} \end{document} 

NTN

+13
Nov 13 '10 at 4:31
source share

Tim Storer wrote a more flexible and enjoyable view of timeline.sty (link to the Wayback Machine online archive, since the original is missing). In addition, the line is horizontal, not vertical. For example:

 \begin{timeline}{2008}{2010}{50}{250} \MonthAndYearEvent{4}{2008}{First Podcast} \MonthAndYearEvent{7}{2008}{Private Beta} \MonthAndYearEvent{9}{2008}{Public Beta} \YearEvent{2009}{IPO?} \end{timeline} 

creates a timeline that looks like this:

 2008 2010 ยท ยท April, 2008 First Podcast ยท ยท July, 2008 Private Beta ยท September, 2008 Public Beta ยท 2009 IPO? 

Personally, I find this a more pleasant solution than the other answers. But I can also change the code to get something closer to what, in my opinion, should look like this. In my opinion, there is no final decision.

+12
Jun 05 '09 at 19:44
source share

Firstly, I prefer tikz oriented solution because it gives you more freedom. Secondly, I am not publishing anything new. Obviously, this is similar to Zoe Gagnon's answer, because he showed the way.

I needed the timeline of the year, and it took me some time (what a surprise!) To do this, so I share the results. I hope you will enjoy.

 \documentclass[tikz]{standalone} \usepackage{verbatim} \begin{document} \newlength\yearposx \begin{tikzpicture}[scale=0.57] % timeline 1990-2010-> % define coordinates (begin, used, end, arrow) \foreach \x in {1990,1992,2000,2002,2004,2005,2008,2009,2010,2011}{ \pgfmathsetlength\yearposx{(\x-1990)*1cm}; \coordinate (y\x) at (\yearposx,0); \coordinate (y\xt) at (\yearposx,+3pt); \coordinate (y\xb) at (\yearposx,-3pt); } % draw horizontal line with arrow \draw [->] (y1990) -- (y2011); % draw ticks \foreach \x in {1992,2000,2002,2004,2005,2008,2009} \draw (y\xt) -- (y\xb); % annotate \foreach \x in {1992,2002,2005,2009} \node at (y\x) [below=3pt] {\x}; \foreach \x in {2000,2004,2008} \node at (y\x) [above=3pt] {\x}; \begin{comment} % for use in beamer class \only<2> {\fill (y1992) circle (5pt);} \only<3-5> {\fill (y2000) circle (5pt);} \only<4-5> {\fill (y2002) circle (5pt);} \only<5> {\fill[red] (y2004) circle (5pt);} \only<6> {\fill (y2005) circle (5pt);} \only<7> {\fill[red] (y2005) circle (5pt);} \only<8-11> {\fill (y2008) circle (5pt);} \only<11> {\fill (y2009) circle (5pt);} \end{comment} \end{tikzpicture} \end{document} 

As you can see, it is adapted to the presentation of the rays (select the part and the zoom option), but if you really want to test it in the presentation, you should move \newlength\yearposx outside the frame definition, because otherwise youโ€™ll get error veritably stating that the \yearposx already defined (unless you remove the selection part and any other split commands from your frame).

enter image description here

+9
Mar 15 2018-10-15T00:
source share

There is timeline.sty floating around.

The syntax is simpler than using tikz:

 %%% In LaTeX: %%% \begin{timeline}{length}(start,stop) %%% . %%% . %%% . %%% \end{timeline} %%% %%% in plain TeX %%% \timeline{length}(start,stop) %%% . %%% . %%% . %%% \endtimeline %%% in between the two, we may have: %%% \item{date}{description} %%% \item[sortkey]{date}{description} %%% \optrule %%% %%% the options to timeline are: %%% length The amount of vertical space that the timeline should %%% use. %%% (start,stop) indicate the range of the timeline. All dates or %%% sortkeys should lie in the range [start,stop] %%% %%% \item without the sort key expects date to be a number (such as a %%% year). %%% \item with the sort key expects the sort key to be a number; date %%% can be anything. This can be used for log scale time lines %%% or dates that include months or days. %%% putting \optrule inside of the timeline environment will cause a %%% vertical rule to be drawn down the center of the timeline. 

I used python datetime.data.toordinal to convert dates to "sort keys" in the package context.

+2
Apr 08 '09 at 9:12
source share

If you are looking for UML sequence diagrams, you might be interested in pkf-umlsd , which is based on TiKZ. Good demos can be found here .

+2
Jun 26 '09 at 10:12
source share



All Articles