I search for a command that do something like this: I can enter two time intervals: the first is the total length of the time-line, and the second is the period to be highlighted. For example the following command:


produce something like this:


Another example:



Optionally I can print the years (for example with the * symbol):



If I want to print all the years, I can enter both the following commands:



Another example:



If I want I can enter an inexact year (for example with the ~ symbol), that produce a colour gradient in the direction of that year. Example:







(Perhaps, if I enter an inexact year and I print it, it is better to differentiate it in some way respect to the exact years.)

I can also set the time interval:


in this way I have only to specify the range to highlight:


The time interval remains the same until the next \settimeinterval declaration (but I can overwrite it with the default command \timeline{a-b}{c}{d}).


The command is structured as follows

\Timeline[ <option> ]{ <start>-<end> }{ <startint> }{ <endint> }

Adding * to the option will print all the years, otherwise, none will be printed. The first argument <start>-<end> will set the beginning and the end year respectively. The last two arguments set the interval. Adding ~ before the year will activate the gradient effect.

With the help of David Carlisle the tilde has been fixed. Now it will appear when you add a year that's supposed to be inexact.

Output (various)

enter image description here

enter image description here

enter image description here




    % Some options
    % Setting Start-End bar
    % Setting Start-End Interval
    % Some calculations
    % Fill interval
    \fill (\fromyear,0) rectangle (\toyear,.2);
    % Fill with gradient if ~ is added
        \fill[right color=black, left color=white] (\fromyear,0) rectangle (\midy,.2);
        \node[anchor=north] at (\fromyear,0) {\string~\phantom{#3}};
        \fill[right color=white, left color=black] (\midy,0) rectangle (\toyear,.2);
        \node[anchor=north] at (\toyear,0) {\string~\phantom{#4}};
    \draw[white] (\fromyear,0) rectangle (\toyear,.2);
    % Print years
    \node[anchor=north] at (0,0) {\startyear};
    \node[anchor=north] at (\endy,0) {\endyear};
    \node[anchor=north] at (\fromyear,0) {#3};
    \node[anchor=north] at (\toyear,0) {#4};
    % Print rectangle
    \draw (0,0) rectangle (\endy,.2);


|improve this answer|||||
  • The chronosys package does this, in color, with its "chronoperiod" function. Although I do not think it will do a gradient. – A Feldman Feb 26 '16 at 12:44

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.