0

In my paper, I wish to create a timeline figure, to show what happens between "period t" and "period t+1", instead of "real time numbers" like 1978. It is not allowed in the package chronosys.

4
  • Please specify what you want to do. You don't want to print the actual dates as numbers? Do you want a numberline? Maybe you can include your code.
    – Ben
    Oct 12 '15 at 14:06
  • I don't want to print dates as numbers. I want to show readers what events happened between $t$ and $t+1$ with a line. Oct 12 '15 at 14:35
  • So a line with start and end dates and text underneath?
    – Ben
    Oct 12 '15 at 14:37
  • Yes, a line with an arrow from left to right. A wide sub-interval of the line is from $t$ to $t+1$. And I need to put several events into that sub-interval. Oct 13 '15 at 11:14
4

Okay, I've gotten around to do a quick and dirty version of what you might have in mind. It doesn't use the chronosys package, because I don't know it. Instead I used tikz. I hope it still helps.

enter image description here

\documentclass[a4paper]{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc}

\def \Tstart {1800}
\def \Tend {1900}
\pgfmathsetmacro\Tduration {(\Tend - \Tstart)}
\def \ImageWidth {13}
\pgfmathsetmacro\scaling {(\ImageWidth/\Tduration)}

\newcommand\timelineDateBelow[2]{% (date, text)
  \pgfmathsetmacro \xdate {(#1 - \Tstart)*\scaling}
  \draw (\xdate,0.1) -- (\xdate,-0.1) node[below, align=center, text width = 2cm]{#2};
}
\newcommand\timelineDateAbove[2]{% (date, text)
  \pgfmathsetmacro \xdate {(#1 - \Tstart)*\scaling}
  \draw (\xdate,0.1) node[above, align=center, text width = 2cm]{#2} -- (\xdate,-0.1);
}

\begin{document}

\begin{tikzpicture}
  \draw[ultra thick, ->] (0,0) -- (\ImageWidth,0);
% start and finish dates and ticks
%  \draw[ultra thick] (0,0.1) node[above]{\Tstart} -- (0,-0.1);
%  \draw (\ImageWidth,0.1) node[above]{\Tend};

  \timelineDateBelow{1810}{date a here}
  \timelineDateBelow{1840}{manual\\linebreak}
  \timelineDateAbove{1860}{date b above}
  \timelineDateBelow{1870}{date c here}
  \timelineDateAbove{1880}{date d above to avoid overlap}

\end{tikzpicture}

\end{document}

Let me tell you the weaknesses. The text can overlap, if you set the dates too close together. You can avoid it by lowering the text width for the nodes, which is set manually to text width=2cm or by manually breaking the line.

You also have to manually adjust the horizontal scaling. It is set to an arbitrary number in \ImageWidth. I'm sure there is a way to get it to automatically fill the linewidth, but that messed up my calculations. Maybe someone knows how to do calculations with \linewidth in the comment.

Hope this is a start to get you going. Let me know, if that's what you were looking for or if you have any questions.

7
  • Thanks, Ben! It looks good. Two minor modifications I wish: 1. "1800" and "1900" disappear; 2. no node at the left end. Are they feasible? Oct 14 '15 at 15:23
  • @DavidXiaoyuXu If you want, you can upvote or mark the answer as correct, so that future users will know it worked for you.
    – Ben
    Oct 14 '15 at 15:24
  • I added some words in my previous comment. Thanks. Oct 14 '15 at 15:29
  • @DavidXiaoyuXu That's really easy. I'll make some changes to the answer.
    – Ben
    Oct 14 '15 at 15:31
  • btw, is it possible to get some text above the line, and keep the rest below it? Oct 14 '15 at 16:17

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.