107

So far I have this, which half gets the job done, but I really wanted a slightly better looking and more descriptive timeline. Really I wanted to be able to write more than one line for each new addition to the timeline.

\documentclass[a4paper, twoside, 11pt]{report}

\usepackage[pdftex]{graphicx}

\newcommand{\foo}{\hspace{-2.3pt}$\bullet$ \hspace{5pt}}

\begin{document}

\scalebox{1}{
\begin{tabular}{r |@{\foo} l}

1947 & AT and T Bell Labs develop the idea of cellular phones\\
1968 & Xerox Palo Alto Research Centre envisage the 'Dynabook\\
1971 & Busicom 'Handy-LE' Calculator\\
1973 & First mobile handset invented by Martin Cooper\\
1978 & Parker Bros. Merlin Computer Toy\\
1981 & Osborne 1 Portable Computer\\
1982 & Grid Compass 1100 Clamshell Laptop\\
1983 & TRS-80 Model 100 Portable PC\\
1984 & Psion Organiser Handheld Computer\\
1991 & Psion Series 3 Minicomputer\\

\end{tabular}
}

\end{document}

This code produces:

enter image description here

I really need something that works in the same way the horizontal timeline does when using the chronology package.

Any help would be appreciated!

6
  • 1
    Perhaps this is is what you want?
    – user30471
    Aug 18, 2014 at 0:06
  • 1
    See ctan.org/pkg/harnon-cv. This is for a CV but you could use the code for just the timeline part.
    – cfr
    Aug 18, 2014 at 2:16
  • Was just thinking to create such a timeline from scratch. Nice idea. I'd like to explore the idea of having two colums, and the vertical timeline as a separator with entries alternating between the left and right column. Jul 9, 2015 at 16:46
  • 1
    Off-topic: Please write AT\&T, not AT and T.
    – Mico
    Oct 27, 2016 at 5:53
  • I am also looking for a timeline but I find that yours, OP, is the best actually!
    – user71207
    Jul 28, 2021 at 0:29

7 Answers 7

84

With a vertical time-line and multilined cells — and a caption on the left side of the table:

\documentclass[a4paper, twoside, 11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier, heuristica}
\usepackage{array, booktabs}
\usepackage{graphicx}
\usepackage[x11names,table]{xcolor}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}

\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}

\begin{document}

\begin{table}
\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
\captionsetup{singlelinecheck=false, font=blue, labelfont=sc, labelsep=quad}
\caption{Timeline}\vskip -1.5ex
\begin{tabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{5cm}}
\toprule
\addlinespace[1.5ex]
1947 & AT and T Bell Labs develop the idea of cellular phones\\
1968 & Xerox Palo Alto Research Centre envisage the 'Dynabook\\
1971 & Busicom 'Handy-LE' Calculator\\
1973 & First mobile handset invented by Martin Cooper\\
1978 & Parker Bros. Merlin Computer Toy\\
1981 & Osborne 1 Portable Computer\\
1982 & Grid Compass 1100 Clamshell Laptop\\
1983 & TRS-80 Model 100 Portable PC\\
1984 & Psion Organiser Handheld Computer\\
1991 & Psion Series 3 Minicomputer\\
\end{tabular}
\end{table}

\end{document} 

enter image description here

Added (3/12/18)

Here is a code to satisfy the request of smaller bullets, an initial bullet and an arrow on the time-line:

\documentclass[a4paper, twoside, 11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier,erewhon}
\usepackage{amssymb, amsbsy}
\usepackage{array, booktabs, longtable}
\usepackage{graphicx}
\usepackage[x11names, table]{xcolor}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}

\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\tiny\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}
\newcommand{\bfoo}{\raisebox{2.1ex}[0pt]{\makebox[\dimexpr2\tabcolsep]%
{\color{LightSteelBlue3}\tiny\textbullet}}}%
\newcommand{\tfoo}{\makebox[\dimexpr2\tabcolsep]%
{\color{LightSteelBlue3}$\boldsymbol \uparrow $}}%

\begin{document}

\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
\captionsetup{font=blue, labelfont=sc, labelsep=quad}
\begin{longtable}{@{\,}r <{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{5cm}}
 \caption{Timeline} \\[-1.5ex]
\toprule
\addlinespace[1.5ex] 
 \multicolumn{1}{c!{\tfoo}}{}& \\[-2.3ex]
1947 & AT and T Bell Labs develop the idea of cellular phones\\
1968 & Xerox Palo Alto Research Centre envisage the 'Dynabook\\
1971 & Busicom 'Handy-LE' Calculator\\
1973 & First mobile handset invented by Martin Cooper\\
1978 & Parker Bros. Merlin Computer Toy\\
1981 & Osborne 1 Portable Computer\\
1982 & Grid Compass 1100 Clamshell Laptop\\
1983 & TRS-80 Model 100 Portable PC\\
1984 & Psion Organiser Handheld Computer\\
1991 & Psion Series 3 Minicomputer\\
 \multicolumn{1}{c!{\bfoo}}{}&
\end{longtable}

\end{document} 

enter image description here

15
  • 4
    That's very nice! :o)
    – dawu
    Aug 18, 2014 at 2:38
  • 2
    I just want to point out the rather obvious point that shoud someone wish to use a similar code within the standalone class, to produce a self-contained timeline (with a view to inserting it into multiple documents, for instance, with includegraphics), one needs to remove the floating {table} environment. I hope this saves the google some work.
    – PatrickT
    Oct 6, 2015 at 12:03
  • 1
    @vrbatim: It works like a breeze with longtable.
    – Bernard
    Apr 6, 2016 at 19:58
  • 1
    @Bernard: Can you please share a MWE for longtable?
    – cosmicraga
    Oct 27, 2016 at 5:18
  • 1
    @cosmicraga: It needs not be changed except for the environment (longtable rather than tabular). This requires the longtable package. Nov 3, 2016 at 14:29
47

An attempt without any package (except for add some color, obviously):

MWE

\documentclass{article}
\usepackage{xcolor}
\newcommand\ytl[2]{
\parbox[b]{8em}{\hfill{\color{cyan}\bfseries\sffamily #1}~$\cdots\cdots$~}\makebox[0pt][c]{$\bullet$}\vrule\quad \parbox[c]{4.5cm}{\vspace{7pt}\color{red!40!black!80}\raggedright\sffamily #2.\\[7pt]}\\[-3pt]}
\begin{document}
\begin{table}
\caption{Timeline of something.}
\centering
\begin{minipage}[t]{.7\linewidth}
\color{gray}
\rule{\linewidth}{1pt}
\ytl{1947}{AT and T Bell Labs develop the idea of cellular phones}
\ytl{1968}{Xerox Palo Alto Research Centre envisage the `Dynabook'}
\ytl{1971}{Busicom 'Handy-LE' Calculator}
\ytl{1973}{First mobile handset invented by Martin Cooper}
\ytl{1978}{Parker Bros. Merlin Computer Toy}
\ytl{1981}{Osborne 1 Portable Computer}
\ytl{1982}{Grid Compass 1100 Clamshell Laptop}
\ytl{1983}{TRS-80 Model 100 Portable PC}
\ytl{1984}{Psion Organiser Handheld Computer}
\ytl{1991}{Psion Series 3 Minicomputer}
\bigskip
\rule{\linewidth}{1pt}%
\end{minipage}%
\end{table}
\end{document}
7
  • when attempt compile "\documentclass[border=5pt]{standalone}" give error... Help :(
    – LuisPac
    Oct 16, 2016 at 18:27
  • 1
    @LuisRivera ... A standalone class with a table float? Very bad idea. Remove \begin{table}and \end{table}. But anyway, why a standalone? This is not a tikz image that take time to compile ...
    – Fran
    Oct 17, 2016 at 11:03
  • or use float=false. See tex.stackexchange.com/a/171983/11604
    – Fran
    Oct 17, 2016 at 11:14
  • I couldn't understand, what is the difference between this and most other answers that the rows here are centred vertically but not in them?
    – Martund
    Aug 11, 2021 at 14:42
  • @Martund Personal preferences? The question did not establish any requirement in this regard and the answers are very different approaches, so why would they have to give the same result?
    – Fran
    Aug 11, 2021 at 20:57
36

I have posted posted an answer before which realizes a vertical timeline for another question, but I think this may fit your needs. You can make multi line entries for each timeline entry and multiple entries for each year. Note that it may need some tweaking here and there to fit your needs.

Also note that I'm posting this answer as a community wiki entry because I have posted this same answer before. If you want to give credit for it, please do it at the original question: High level macros and environments based on Tikz.

\documentclass[10pt]{article}

\usepackage[paperwidth=210mm,%
    paperheight=297mm,%
    tmargin=7.5mm,%
    rmargin=7.5mm,%
    bmargin=7.5mm,%
    lmargin=7.5mm,
    vscale=1,%
    hscale=1]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}

\usetikzlibrary{arrows, calc, decorations.markings, positioning}

\pagestyle{empty}

\makeatletter
\newenvironment{timeline}[6]{%
    % #1 is startyear
    % #2 is tlendyear
    % #3 is yearcolumnwidth
    % #4 is rulecolumnwidth
    % #5 is entrycolumnwidth
    % #6 is timelineheight

    \newcommand{\startyear}{#1}
    \newcommand{\tlendyear}{#2}

    \newcommand{\yearcolumnwidth}{#3}
    \newcommand{\rulecolumnwidth}{#4}
    \newcommand{\entrycolumnwidth}{#5}
    \newcommand{\timelineheight}{#6}

    \newcommand{\templength}{}

    \newcommand{\entrycounter}{0}

    % https://tex.stackexchange.com/questions/85528/checking-whether-or-not-a-node-has-been-previously-defined
    % https://tex.stackexchange.com/questions/37709/how-can-i-know-if-a-node-is-already-defined
    \long\def\ifnodedefined##1##2##3{%
        \@ifundefined{pgf@sh@ns@##1}{##3}{##2}%
    }

    \newcommand{\ifnodeundefined}[2]{%
        \ifnodedefined{##1}{}{##2}
    }

    \newcommand{\drawtimeline}{%
        \draw[timelinerule] (\yearcolumnwidth+5pt, 0pt) -- (\yearcolumnwidth+5pt, -\timelineheight);
        \draw (\yearcolumnwidth+0pt, -10pt) -- (\yearcolumnwidth+10pt, -10pt);
        \draw (\yearcolumnwidth+0pt, -\timelineheight+15pt) -- (\yearcolumnwidth+10pt, -\timelineheight+15pt);

        \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(\startyear, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
        \node[year] (year-\startyear) at (\yearcolumnwidth, \templength) {\startyear};

        \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(\tlendyear, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
        \node[year] (year-\tlendyear) at (\yearcolumnwidth, \templength) {\tlendyear};
    }

    \newcommand{\entry}[2]{%
        % #1 is the year
        % #2 is the entry text

        \pgfmathtruncatemacro{\lastentrycount}{\entrycounter}
        \pgfmathtruncatemacro{\entrycounter}{\entrycounter + 1}

        \ifdim \lastentrycount pt > 0 pt%
            \node[entry] (entry-\entrycounter) [below of=entry-\lastentrycount] {##2};
        \else%
            \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(\startyear, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
            \node[entry] (entry-\entrycounter) at (\yearcolumnwidth+\rulecolumnwidth+10pt, \templength) {##2};
        \fi

        \ifnodeundefined{year-##1}{%
            \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(##1, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
            \draw (\yearcolumnwidth+2.5pt, \templength) -- (\yearcolumnwidth+7.5pt, \templength);
            \node[year] (year-##1) at (\yearcolumnwidth, \templength) {##1};
        }

        \draw ($(year-##1.east)+(2.5pt, 0pt)$) -- ($(year-##1.east)+(7.5pt, 0pt)$) -- ($(entry-\entrycounter.west)-(5pt,0)$) -- (entry-\entrycounter.west);
    }

    \newcommand{\plainentry}[2]{% plainentry won't print date in the timeline
        % #1 is the year
        % #2 is the entry text

        \pgfmathtruncatemacro{\lastentrycount}{\entrycounter}
        \pgfmathtruncatemacro{\entrycounter}{\entrycounter + 1}

        \ifdim \lastentrycount pt > 0 pt%
            \node[entry] (entry-\entrycounter) [below of=entry-\lastentrycount] {##2};
        \else%
            \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(\startyear, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
            \node[entry] (entry-\entrycounter) at (\yearcolumnwidth+\rulecolumnwidth+10pt, \templength) {##2};
        \fi

        \ifnodeundefined{invisible-year-##1}{%
            \pgfmathsetlengthmacro{\templength}{neg(add(multiply(subtract(##1, \startyear), divide(subtract(\timelineheight, 25), subtract(\tlendyear, \startyear))), 10))}
            \draw (\yearcolumnwidth+2.5pt, \templength) -- (\yearcolumnwidth+7.5pt, \templength);
            \node[year] (invisible-year-##1) at (\yearcolumnwidth, \templength) {};
        }

        \draw ($(invisible-year-##1.east)+(2.5pt, 0pt)$) -- ($(invisible-year-##1.east)+(7.5pt, 0pt)$) -- ($(entry-\entrycounter.west)-(5pt,0)$) -- (entry-\entrycounter.west);
    }

    \begin{tikzpicture}
        \tikzstyle{entry} = [%
            align=left,%
            text width=\entrycolumnwidth,%
            node distance=10mm,%
            anchor=west]
        \tikzstyle{year} = [anchor=east]
        \tikzstyle{timelinerule} = [%
            draw,%
            decoration={markings, mark=at position 1 with {\arrow[scale=1.5]{latex'}}},%
            postaction={decorate},%
            shorten >=0.4pt]

        \drawtimeline
}
{
    \end{tikzpicture}
    \let\startyear\@undefined
    \let\tlendyear\@undefined
    \let\yearcolumnwidth\@undefined
    \let\rulecolumnwidth\@undefined
    \let\entrycolumnwidth\@undefined
    \let\timelineheight\@undefined
    \let\entrycounter\@undefined
    \let\ifnodedefined\@undefined
    \let\ifnodeundefined\@undefined
    \let\drawtimeline\@undefined
    \let\entry\@undefined
}
\makeatother


\begin{document}

\begin{timeline}{1900}{1990}{2cm}{2.5cm}{5cm}{12cm}
\entry{1903}{Wilbur and Orville Wright fly the first powered airplane}
\entry{1914}{Assassination of Franz Ferdinand}
\plainentry{1917}{The October Revolution}
\entry{1928}{Discovery of Penicillin}
\plainentry{1929}{Stock Market Crash of 1929}
\entry{1941}{Attack on Pearl Harbor}
\plainentry{1944}{D-Day}
\entry{1945}{The Bombing of Hiroshima}
\plainentry{1947}{Creation of Israel as a Jewish State}
\entry{1963}{US president John F. Kennedy assassinated in Dallas}
\entry{1969}{The Moon Landing}
\plainentry{1989}{Fall of the Berlin Wall}
\end{timeline}

\bigskip

Text from: A Brief History of LaTeX http://www.xent.com/FoRK-archive/feb98/0307.html

\smallskip

\begin{timeline}{1974}{1985}{2cm}{7cm}{10cm}{0.45\textheight}
\entry{1974}{Donald Knuth stops submitting papers to the AMS because ``the finished
product was just too painful for me to look at''.}
\entry{1977}{Knuth begins his research on typography.}
\entry{1978}{Knuth delivers an AMS Gibbs Lecture entitled Mathematical Typography to the AMS membership at its annual meeting.}
\entry{1979}{Digital Equipment Corporation and the AMS jointly publish Knuth's TeX and METAFONT: New Directions in Typesetting.}
\entry{1980}{The first draft of Spivak's Joy of TeX is announced in TUGboat, vol. 1, no. 1.}
\entry{1982}{Spivak announces AMS-TeX at the joint math meetings.}
\entry{1982}{Version 0 of Spivak's Joy of TeX is released.}
\entry{1982}{Knuth releases dvitype, a model DVI driver.}
\entry{1983}{Lamport writes a LaTeX manual, the earliest known LaTeX manual in existence.}
\entry{1984}{Addison-Wesley publishes Knuth's The TeXbook, destined to become the definitive TeX reference.}
\entry{1984}{Lamport releases version 2.06a of the LaTeX macros.}
\entry{1985}{The Computer Modern (CM) fonts replace the American Modern (AM) fonts in TeX.}
\entry{1985}{Patashnik releases BibTeX version 0.98 for LaTeX 2.08. [``BibTeX 1.0'', TUGboat, vol. 15, no. 3, pp. 269--274, Sept. 1994.}
\end{timeline}

\end{document}
3
  • 1
    this is a great bit of code and very useful. However there is an error in it. Try doing the same timeline twice in a row (use your first example) and you will see that the second time around the year labels (except the first and last) disappear. I think the node names must somehow be retained between runs. Feb 5, 2015 at 15:12
  • 2
    Can this be extended to add months, as well as years? Jan 31, 2017 at 5:21
  • @AndrewWatson I guess you would have to add a third argument to the \entryenvironment and then modify the nodes... did you ever implement this? Oct 24, 2019 at 7:55
32

Here is another example with TikZ matrices.

The code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{charter}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}

%% Code by Claudio:
%% https://tex.stackexchange.com/a/197447/221452
%% Uses code by Andrew:
%% http://tex.stackexchange.com/a/28452/13304
\makeatletter
    \let\matamp=&
    \catcode`\&=13
    \def&{%
        \iftikz@is@matrix%
            \pgfmatrixnextcell%
        \else%
            \matamp%
        \fi%
    }
\makeatother

\newcounter{lines}
\def\endlr{\stepcounter{lines}\\}

\newcounter{vtml}
\setcounter{vtml}{0}

\newif\ifvtimelinetitle
\newif\ifvtimebottomline

\tikzset{
    description/.style={column 2/.append style={#1}},
    timeline color/.store in=\vtmlcolor,
    timeline color=red!80!black,
    timeline color st/.style={fill=\vtmlcolor,draw=\vtmlcolor},
    use timeline header/.is if=vtimelinetitle,
    use timeline header=false,
    add bottom line/.is if=vtimebottomline,
    add bottom line=false,
    timeline title/.store in=\vtimelinetitle,
    timeline title={},
    line offset/.store in=\lineoffset,
    line offset=4pt,
}

\NewEnviron{vtimeline}[1][]{%
    \setcounter{lines}{1}%
    \stepcounter{vtml}%
    \begin{tikzpicture}[column 1/.style={anchor=east},
        column 2/.style={anchor=west},
        text depth=0pt,text height=1ex,
        row sep=1ex,
        column sep=1em,
        #1
    ]
        \matrix(vtimeline\thevtml)[matrix of nodes]{\BODY};
        \pgfmathtruncatemacro\endmtx{\thelines-1}

        \path[timeline color st]
            ($(vtimeline\thevtml-1-1.north east)!0.5!(vtimeline\thevtml-1-2.north west)$)--
            ($(vtimeline\thevtml-\endmtx-1.south east)!0.5!(vtimeline\thevtml-\endmtx-2.south west)$);

        \foreach \x in {1,...,\endmtx}{
            \node[circle,timeline color st, inner sep=0.15pt, draw=white, thick]
            (vtimeline\thevtml-c-\x) at
            ($(vtimeline\thevtml-\x-1.east)!0.5!(vtimeline\thevtml-\x-2.west)$){};
                \draw[timeline color st](vtimeline\thevtml-c-\x.west)--++(-3pt,0);
        }

        \ifvtimelinetitle%
            \draw[timeline color st]([yshift=\lineoffset]vtimeline\thevtml.north west)--
                ([yshift=\lineoffset]vtimeline\thevtml.north east);

            \node[anchor=west,yshift=16pt,font=\large]
                at (vtimeline\thevtml-1-1.north west)
                {\textsc{Timeline \thevtml}: \textit{\vtimelinetitle}};
        \else%
            \relax%
        \fi%

        \ifvtimebottomline%
            \draw[timeline color st]([yshift=-\lineoffset]vtimeline\thevtml.south west)--
            ([yshift=-\lineoffset]vtimeline\thevtml.south east);
        \else%
            \relax%
        \fi%
    \end{tikzpicture}
}

\begin{document}

    \begin{vtimeline}[description={text width=7cm},
        row sep=4ex,
        use timeline header,
        timeline title={The title}]
        1947 & AT and T Bell Labs develop the idea of cellular phones\endlr
        1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\endlr
        1971 & Busicom 'Handy-LE' Calculator\endlr
        1973 & First mobile handset invented by Martin Cooper\endlr
        1978 & Parker Bros. Merlin Computer Toy\endlr
        1981 & Osborne 1 Portable Computer\endlr
        1982 & Grid Compass 1100 Clamshell Laptop\endlr
        1983 & TRS-80 Model 100 Portable PC\endlr
        1984 & Psion Organiser Handheld Computer\endlr
        1991 & Psion Series 3 Minicomputer\endlr
    \end{vtimeline}

    \begin{vtimeline}[timeline color=cyan!80!blue, add bottom line, line offset=2pt]
        1947 & AT and T Bell Labs develop the idea of cellular phones\endlr
        1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\endlr
        1971 & Busicom 'Handy-LE' Calculator\endlr
        1973 & First mobile handset invented by Martin Cooper\endlr
        1978 & Parker Bros. Merlin Computer Toy\endlr
        1981 & Osborne 1 Portable Computer\endlr
        1982 & Grid Compass 1100 Clamshell Laptop\endlr
        1983 & TRS-80 Model 100 Portable PC\endlr
        1984 & Psion Organiser Handheld Computer\endlr
        1991 & Psion Series 3 Minicomputer\endlr
    \end{vtimeline}

\end{document}

In the first environment the header is activated. The result is:

enter image description here

In the second environment the header is not set up, but a line is added at the bottom of the timeline with a custom offset (default 4pt). In addition, the color is different and no constraints have been put on the description width:

enter image description here

7
  • This looks and works great. How would one go about adding a horizontal line below the timeline as well as above?
    – Casimir
    Jan 9, 2015 at 16:16
  • @PacificOrion: Thanks! Actually it is not complicated: I'll try to give you a feedback on this in the next days. Jan 9, 2015 at 16:32
  • @PacificOrion: I just revised the answer to include a line below the timeline. Jan 13, 2015 at 12:11
  • @ClaudioFiandrino Sir how to save this tex file separately and then call it with an input or include command
    – js bibra
    Nov 28, 2019 at 13:49
  • 1
    @3isenHeim: sure, you can try the usual width options within column 2/.style Sep 7, 2020 at 10:03
19

Here is another variation using tikz to produce:

enter image description here

As you said that you wanted to be able to have multiple lines for each entry in the timeline I have given them a text width of 60mm and positioned the different entries below each other (and the years to the left of them). Here's the code:

\documentclass[a4paper, twoside, 11pt]{report}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}

\newcommand{\foo}{\hspace{-2.3pt}$\bullet$ \hspace{5pt}}

\begin{document}

\newcounter{year}
\begin{tikzpicture}[yscale=0.5,%
           year/.style={draw=red,text=blue,fill=yellow!20,shape=ellipse,inner sep=2pt},
           description/.style={rectangle,align=center,text width=60mm,anchor=west},
           timeline/.style={->,thick,red!50}]

    \foreach \year/\desc [count=\y] in {%
       1947/AT and T Bell Labs develop the idea of cellular phones,%
       1968/Xerox Palo Alto Research Centre envisage the 'Dynabook,%
       1971/Busicom 'Handy-LE' Calculator,%
       1973/First mobile handset invented by Martin Cooper,%
       1978/Parker Bros. Merlin Computer Toy,%
       1981/Osborne 1 Portable Computer,%
       1982/Grid Compass 1100 Clamshell Laptop,%
       1983/TRS-80 Model 100 Portable PC,%
       1984/Psion Organiser Handheld Computer,%
       1991/Psion Series 3 Minicomputer%
       } { \ifnum\y=1 \node[description](\y){\desc};
           \else\node[description,below=1ex of \z](\y){\desc};
           \fi
           \node[year](y-\y) [left=of \y] {\year};
           \ifnum\y>1\draw[timeline] (y-\z)-- (y-\y);\fi
           \global\let\z=\y% for drawing from last node
       }

\end{tikzpicture}
\end{document}

I have used the counters \y and \z to dynamically draw the edges between the years...I feel like there should be a more efficient tikz-y way of doing this...

1
  • 2
    Nothing quite like a friendly unexplained down-vote....
    – user30471
    Nov 14, 2017 at 8:11
13

Here is a modified version of chronology.sty, chronology-vert.sty. Note that this is not at all well-tested and is liable to break. In particular, the timeline is not boxed or resized, so the user must ensure that things fit appropriately.

Caveat emptor...

%% Modifications copyright 2015 Clea F. Rees
%% Code from origfile copyright 2011 Levi Wiseman (see below)
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Clea F. Rees.
%%
%% This work consists of the file chronology-vert.sty.
%%
%% chronology-vert.sty is a derived work under the terms of the LPPL.
%% The original file, chronology.sty, is supplied with chronology. A
%% copy of chronology including an unmodified copy of chronology.sty
%% is available from
%% http://ctan.org/tex-archive/macros/latex/contrib/chronology.
%%
%% The main modifications made to this file are as follows:
%% - This notice is added.
%% - The file is renamed.
%% - The timeline is created as a vertical, rather than horizontal
%% progression.
%% - The timeline is not boxed or resized. Hence, it is up to the user
%% to ensure that things fit appropriately.

% based on chronology 2010/6/12 v1.0 Horizontal timeline
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{chronology-vert}[2015/05/02 v1.0 Horizontal timeline]
\RequirePackage{calc}
\RequirePackage{tikz}
\RequirePackage{ifthen}
\newcounter{step}\newcounter{stepstart}\newcounter{stepstop}
\newcounter{yearstart}\newcounter{yearstop}\newcounter{deltayears}
\newlength{\ystart}\newlength{\ystop}
\newlength{\unit}\newlength{\timelineheight}
\makeatletter
\newif\ifchronology@star
\newenvironment{chronology}{%
    \@ifstar{\chronology@startrue\chronology@i*}{\chronology@starfalse\chronology@i*}%
}{%
    \end{tikzpicture}%
}%
\def\chronology@i*{%
    \@ifnextchar[{\chronology@ii*}{\chronology@ii*[{5}]}%
}%
\def\chronology@ii*[#1]#2#3#4{%
    \@ifnextchar[{\chronology@iii*[{#1}]{#2}{#3}{#4}}{\chronology@iii*[{#1}]{#2}{#3}{#4}[{#4}]}%
}%
\def\chronology@iii*[#1]#2#3#4[#5]{%
    \newif\ifflipped%
    \ifchronology@star%
        \flippedtrue%
    \else%
        \flippedfalse%
    \fi%
    \setcounter{step}{#1}%
    \setcounter{yearstart}{#2}\setcounter{yearstop}{#3}%
    \setcounter{deltayears}{\theyearstop-\theyearstart}%
    \setlength{\unit}{#5/\thedeltayears}%
    \setlength{\timelineheight}{#4}%
    \pgfmathsetcounter{stepstart}{\theyearstart+\thestep-mod(\theyearstart,\thestep)}%
    \pgfmathsetcounter{stepstop}{\theyearstop-mod(\theyearstop,\thestep)}%
    \addtocounter{step}{\thestepstart}%
      \begin{tikzpicture}[baseline={(current bounding box.north)}]%
          \draw [|->] (0,0) -- (0,-\thedeltayears*\unit-\unit);%
          \foreach \y in {1,...,\thedeltayears}%
              \draw[yshift=-\y*\unit] (-.1\unit,0) -- (.1\unit,0);%
          \addtocounter{deltayears}{1}%
          \foreach \y in {\thestepstart,\thestep,...,\thestepstop}{%
              \pgfmathsetlength\ystop{(-\y+\theyearstart)*\unit}%
              \draw[yshift=\ystop] (-.3\unit,0) -- (.3\unit,0);%
              \ifflipped%
                  \node at (0,\ystop) [left=.2\unit] {\y};%
              \else%
                  \node at (0,\ystop) [right=.2\unit] {\y};%
              \fi%
          }%
}%
\makeatother
\newcommand{\event}[3][e]{%
    \pgfmathsetlength\ystop{(#2-\theyearstart)*\unit}%
    \ifx #1e%
        \ifflipped%
            \draw[fill=black,draw=none,opacity=0.5]%
                (0,-\ystop) circle (.2\unit)%
                node[opacity=1,rotate=30,right=.5\unit] {#3};%
        \else%
            \draw[fill=black,draw=none,opacity=0.5]%
                (0,-\ystop) circle (.2\unit)%
                node[opacity=1,rotate=30,left=.5\unit] {#3};%
        \fi%
    \else%
        \pgfmathsetlength\ystart{(#1-\theyearstart)*\unit}%
        \ifflipped%
            \draw[fill=black,draw=none,opacity=0.5,rounded corners=.2\unit]%
                (-.2\unit,-\ystart) rectangle%
                node[opacity=1,rotate=30,right=.5\unit] {#3} (.2\unit,-\ystop);%
        \else%
            \draw[fill=black,draw=none,opacity=0.5,rounded corners=.2\unit]%
                (-.2\unit,-\ystart) rectangle%
                node[opacity=1,rotate=30,left=.5\unit] {#3} (.2\unit,-\ystop);%
        \fi%
    \fi}
\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3}
\endinput

The example file provided with the chronology package produces the following if chronology-vert is used instead (and the vertical spacing removed):

vertical timelines

Applying this to the original example:

\documentclass[tikz,border=5pt]{standalone}
\usepackage{chronology-vert}
\begin{document}
  \begin{chronology}*[5]{1940}{1995}{20cm}
    \event{1947}{AT and T Bell Labs develop the idea of cellular phones}
    \event{1968}{Xerox Palo Alto Research Centre envisage the 'Dynabook}
    \event{1971}{Busicom 'Handy-LE' Calculator}
    \event{1973}{First mobile handset invented by Martin Cooper}
    \event{1978}{Parker Bros. Merlin Computer Toy}
    \event{1981}{Osborne 1 Portable Computer}
    \event{1982}{Grid Compass 1100 Clamshell Laptop}
    \event{1983}{TRS-80 Model 100 Portable PC}
    \event{1984}{Psion Organiser Handheld Computer}
    \event{1991}{Psion Series 3 Minicomputer}
  \end{chronology}
\end{document}

produces:

vertical timeline

13

I haven't looked at the chronology package but can a simple table as the following do?

\documentclass{report}

\usepackage[tableposition = top]{caption}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]
\centering
\caption{Timeline.}
\label{tbl:1}
\begin{tabular}{r l}
  \toprule
  1947 & AT\&T Bell Labs develop the idea of cellular phones\\
  1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\\
  1971 & Busicom `Handy-LE' Calculator\\
  1973 & First mobile handset invented by Martin Cooper\\
  1978 & Parker Bros. Merlin Computer Toy\\
  1981 & Osborne~$1$ Portable Computer\\
  1982 & Grid Compass 1100 Clamshell Laptop\\
  1983 & TRS-$80$ Model~$100$ Portable PC\\
  1984 & Psion Organiser Handheld Computer\\
  1991 & Psion Series~~$3$ Minicomputer\\
  \bottomrule
\end{tabular}
\end{table}
Here we have table~\ref{tbl:1}.

\end{document}

output

1
  • 4
    Compare your table with the OP's...
    – user30471
    Aug 18, 2014 at 6:47

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.