1. Introduction

Timeline diagrams are frequently used to display the chronological sequence of events over a period of time. The timelines serve as a valuable tool for simplifying complex information and making it easy to understand.

In this tutorial, we’ll learn to draw timelines in LaTeX.

2. Getting Started

There are a few packages that can be used to draw timelines in LaTeX, but probably the most commonly used package is the TikZ. Thus, we’ll use the TikZ package throughout this tutorial. The following steps describe the procedure to draw timelines in LaTeX:

  1. Load the package required to draw timelines
  2. Draw a horizontal line
  3. Draw vertical markers on the horizontal line
  4. Add the events with time at each vertical marker on the horizontal line

We’ll use these steps to draw timelines in LaTeX with a detailed step-by-step protocol.

3. TikZ Package for Timelines

3.1. Detailed Steps

First, we need to load the TikZ package:

\usepackage{tikz}

Now, we can proceed with drawing a timeline with the tikzpicture environment:

\begin{tikzpicture}
...
\end{tikzpicture}

All the drawing commands go in between these two lines. After this, we can draw the horizontal line required for the timeline:

\draw (0,0) -- (12,0);

This command draws a straight line segment from coordinates (0,0) to (12,0). Let’s add the vertical markers on this line segment:

\foreach \x in {1,3,5,7,9,11}
\draw (\x cm,3pt) -- (\x cm,-3pt);

The above code block initiates a loop, iterating over the values specified in the braces, and draws small vertical lines at each position specified by \x. Now, we can add events and time at the first marker:

\draw (1,0) node[below=3pt] {Day2} node[above=3pt] {Writing};

The above command adds a label below and above the first vertical marker at coordinates (1,0). Similarly, we can add more events to each marker.

3.2. Basic Example

Let’s create a simple timeline following the above steps:

\begin{tikzpicture}
% draw a horizontal line
\draw (0,0) -- (12,0);

% draw vertical lines
\foreach \x in {1,3,5,7,9,11}
\draw (\x cm,3pt) -- (\x cm,-3pt);

% draw nodes to add events
\draw (1,0) node[below=3pt] {Day2} node[above=3pt] {Writing};
\draw (3,0) node[below=3pt] {Day4} node[above=3pt] {First draft};
\draw (5,0) node[below=3pt] {Day6} node[above=3pt] {Revise};
\draw (7,0) node[below=3pt] {Day8} node[above=3pt] {Second draft};
\draw (9,0) node[below=3pt] {Day10} node[above=3pt] {Recheck};
\draw (11,0) node[below=3pt] {Day11} node[above=3pt] {Submit};
\end{tikzpicture}

This will generate the following result:

Timeline Example Latex

As we can see, the above code generates a nice timeline. While the resulting timeline is well-suited for regular time intervals, it may not be a favorable choice for irregular time intervals.

3.3. Timeline With Irregular Time Intervals

Irregular time intervals can be represented by a zigzag pattern within the timeline. We can draw the zigzag patterns in LaTeX using the snakes library from the TikZ package. Thus, we will proceed with specifying the usage of the snakes library after importing the TikZ package:

\usetikzlibrary{snakes}

Now, we can draw a horizontal line with the zigzag pattern within the tikzpicture environment:

\draw (0,0) -- (9,0);
\draw[snake] (9,0) -- (11,0);
\draw (11,0) -- (12,0);

This code will result in a horizontal line with a zigzag pattern from the coordinates (9,0) to (11,0). Subsequently, we can add events horizontal markers and events on this horizontal line in the same manner.

Timeline With Zigzag PatternAs a result, the timeline has a zigzag pattern between Day10 and Day11. Similarly, we can create multiple zigzag patterns by specifying the target coordinates.

4. Conclusion

In this tutorial, we learned about drawing the timeline in LaTeX. Firstly, we used the TikZ package to draw a basic timeline. In addition, we also learned about drawing the timeline with irregular time intervals using the snakes library from TikZ.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.