summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chronology
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-07-23 21:15:12 +0000
committerKarl Berry <karl@freefriends.org>2015-07-23 21:15:12 +0000
commitc239abdd54c72174b7697b03f3dac0b7cb333fc7 (patch)
tree55ad4aa514b9473048bbbc66f851ab22b6aa942f /Master/texmf-dist/tex/latex/chronology
parent360782a973f76799a1a4411d29c5f75df9f99892 (diff)
chronology (23jul15)
git-svn-id: svn://tug.org/texlive/trunk@37934 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chronology')
-rw-r--r--Master/texmf-dist/tex/latex/chronology/chronology.sty56
1 files changed, 36 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/chronology/chronology.sty b/Master/texmf-dist/tex/latex/chronology/chronology.sty
index 911f3a8519b..46c06c57467 100644
--- a/Master/texmf-dist/tex/latex/chronology/chronology.sty
+++ b/Master/texmf-dist/tex/latex/chronology/chronology.sty
@@ -1,13 +1,28 @@
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{chronology}[2010/6/12 v1.0 Horizontal timeline]%
+\ProvidesPackage{chronology}[2015/03/27 v1.1.1 Horizontal timeline]%
\RequirePackage{calc}%
\RequirePackage{tikz}%
-\RequirePackage{ifthen}%
+\RequirePackage{xparse}%
+% Defining counters and lengths
\newcounter{step}\newcounter{stepstart}\newcounter{stepstop}%
\newcounter{yearstart}\newcounter{yearstop}\newcounter{deltayears}%
\newlength{\xstart}\newlength{\xstop}%
\newlength{\unit}\newlength{\timelinewidth}%
\newsavebox{\timelinebox}%
+% Defining TikZ styles for labels and events
+\tikzset{%
+ ,chronevent/.style={fill=black,draw=none,opacity=0.5}
+ ,chronlabel/.style={opacity=1}
+ ,chrontickslabel/.style={chronlabel}
+ ,chroneventlabel/.style={chronlabel}
+ ,eventlabel/.style={chroneventlabel,anchor=south west,yshift=.2\unit,rotate=45}
+ ,flippedeventlabel/.style={chroneventlabel,anchor=north west,yshift=-.2\unit,rotate=-45}
+ }
+% For compatibity with babel. Handling of active characters in TikZ.
+\tikzset{
+ handle active characters in code,
+ handle active characters in nodes
+}
\makeatletter%
\newif\ifchronology@star%
\newenvironment{chronology}{%
@@ -48,37 +63,38 @@
\pgfmathsetlength\xstop{(\x-\theyearstart)*\unit}%
\draw[xshift=\xstop] (0,-.3\unit) -- (0,.3\unit);%
\ifflipped%
- \node at (\xstop,0) [above=.2\unit] {\x};%
+ \node[chrontickslabel] at (\xstop,0) [above=.2\unit] {\x};%
\else%
- \node at (\xstop,0) [below=.2\unit] {\x};%
+ \node[chrontickslabel] at (\xstop,0) [below=.2\unit] {\x};%
\fi%
}%
}%
\makeatother%
-\newcommand{\event}[3][e]{%
+\DeclareDocumentCommand \event {o m m}{%
\pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}%
- \ifx #1e%
+ \IfNoValueTF {#1} {%
\ifflipped%
- \draw[fill=black,draw=none,opacity=0.5]%
- (\xstop, 0) circle (.2\unit)%
- node[opacity=1,rotate=-45,right=.5\unit] {#3};%
+ \draw[chronevent]%
+ (\xstop, 0) circle (.2\unit)%
+ node[flippedeventlabel] {#3};%
\else%
- \draw[fill=black,draw=none,opacity=0.5]%
- (\xstop, 0) circle (.2\unit)%
- node[opacity=1,rotate=45,right=.5\unit] {#3};%
+ \draw[chronevent]%
+ (\xstop, 0) circle (.2\unit)%
+ node[eventlabel] {#3};%
\fi%
- \else%
+ }{%
\pgfmathsetlength\xstart{(#1-\theyearstart)*\unit}%
\ifflipped%
- \draw[fill=black,draw=none,opacity=0.5,rounded corners=.2\unit]%
- (\xstart,-.2\unit) rectangle%
- node[opacity=1,rotate=-45,right=.5\unit] {#3} (\xstop,.2\unit);%
+ \draw[chronevent,rounded corners=.2\unit]%
+ (\xstart,-.2\unit) rectangle%
+ node[flippedeventlabel] {#3} (\xstop,.2\unit);%
\else%
- \draw[fill=black,draw=none,opacity=0.5,rounded corners=.2\unit]%
- (\xstart,-.2\unit) rectangle%
- node[opacity=1,rotate=45,right=.5\unit] {#3} (\xstop,.2\unit);%
+ \draw[chronevent,rounded corners=.2\unit]%
+ (\xstart,-.2\unit) rectangle%
+ node[eventlabel] {#3} (\xstop,.2\unit);%
\fi%
- \fi}%
+ }%
+}
\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3}%
\endinput%