1
%%
2
%% This is file `chronology.sty',
3
%% generated with the docstrip utility.
4
%%
5
%% The original source files were:
6
%%
7
%% chronology.dtx  (with options: `package')
8
%% 
9
%% This is a generated file.
10
%% 
11
%% Copyright (C) 2010 by Levi Wiseman
12
%% 
13
%% This work may be distributed and/or modified under the
14
%% conditions of the LaTeX Project Public License, either version 1.3
15
%% of this license or (at your option) any later version.
16
%% The latest version of this license is in
17
%%   http://www.latex-project.org/lppl.txt
18
%% and version 1.3 or later is part of all distributions of LaTeX
19
%% version 2005/12/01 or later.
20
%% 
21
%% This work has the LPPL maintenance status `maintained'.
22
%% 
23
%% The Current Maintainer of this work is Levi Wiseman.
24
%% 
25
%% This work consists of the file chronology.dtx and the derived files
26
%% chronology.ins, chronology.pdf, and chronology.sty.
27
%% 
28
\NeedsTeXFormat{LaTeX2e}
29
\ProvidesPackage{chronology}[2010/6/12 v1.0 Horizontal timeline]
30
\RequirePackage{calc}
31
\RequirePackage{tikz}
32
\RequirePackage{ifthen}
33
\newenvironment{chronology}[5][5]{%
34
  \newcounter{step}\newcounter{stepstart}\newcounter{stepstop}%
35
  \newcounter{yearstart}\newcounter{yearstop}\newcounter{deltayears}%
36
  \newlength{\xstart}\newlength{\xstop}%
37
  \newlength{\unit}\newlength{\timelinewidth}%
38
  \setcounter{step}{#1}%
39
  \setcounter{yearstart}{#2}\setcounter{yearstop}{#3}%
40
  \setcounter{deltayears}{\theyearstop-\theyearstart}%
41
  \setlength{\unit}{#4}%
42
  \setlength{\timelinewidth}{#5}%
43
  \pgfmathsetcounter{stepstart}%
44
    {\theyearstart+\thestep-mod(\theyearstart,\thestep)}%
45
  \pgfmathsetcounter{stepstop}{\theyearstop-mod(\theyearstop,\thestep)}%
46
  \addtocounter{step}{\thestepstart}%
47
  \newsavebox{\timelinebox}%
48
  \begin{lrbox}{\timelinebox}%
49
    \begin{tikzpicture}[baseline={(current bounding box.north)}]%
50
      \draw [|->] (0,0) -- (\thedeltayears*\unit+\unit, 0);%
51
      \foreach \x in {1,...,\thedeltayears}%
52
        \draw[xshift=\x*\unit] (0,-.1\unit) -- (0,.1\unit);%
53
      \addtocounter{deltayears}{1}%
54
      \foreach \x in {\thestepstart,\thestep,...,\thestepstop}{%
55
        \pgfmathsetlength\xstop{(\x-\theyearstart)*\unit}%
56
        \draw[xshift=\xstop] (0,-.3\unit) -- (0,.3\unit);%
57
        \node at (\xstop,0) [below=.2\unit] {\x};}}{%
58
    \end{tikzpicture}%
59
  \end{lrbox}%
60
  \raisebox{2ex}{\resizebox{\timelinewidth}{!}{\usebox{\timelinebox}}}}%
61
\newcommand{\event}[3][e]{%
62
  \pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}%
63
  \ifx #1e%
64
    \draw[fill=black,draw=none,opacity=0.5]%
65
      (\xstop, 0) circle (.2\unit)%
66
      node[opacity=1,rotate=45,right=.5\unit] {#3};%
67
  \else%
68
    \pgfmathsetlength\xstart{(#1-\theyearstart)*\unit}%
69
    \draw[fill=black,draw=none,opacity=0.5,rounded corners=.2\unit]%
70
      (\xstart,-.2\unit) rectangle%
71
      node[opacity=1,rotate=45,right=.5\unit] {#3} (\xstop,.2\unit);%
72
  \fi}%
73
\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3}
74
\endinput
75
%%
76
%% End of file `chronology.sty'.