summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chronology/chronology.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/chronology/chronology.sty')
-rw-r--r--macros/latex/contrib/chronology/chronology.sty38
1 files changed, 35 insertions, 3 deletions
diff --git a/macros/latex/contrib/chronology/chronology.sty b/macros/latex/contrib/chronology/chronology.sty
index 46c06c5746..774a26644e 100644
--- a/macros/latex/contrib/chronology/chronology.sty
+++ b/macros/latex/contrib/chronology/chronology.sty
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{chronology}[2015/03/27 v1.1.1 Horizontal timeline]%
+\ProvidesPackage{chronology}[2023/08/20 v2.0 - Horizontal Timeline]%
\RequirePackage{calc}%
\RequirePackage{tikz}%
\RequirePackage{xparse}%
@@ -9,7 +9,9 @@
\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}
@@ -17,8 +19,11 @@
,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}
+ ,eventlabelbottom/.style={chroneventlabel,anchor=south west,yshift=-1cm,rotate=0} % Bottom label
}
+%
% For compatibity with babel. Handling of active characters in TikZ.
+%
\tikzset{
handle active characters in code,
handle active characters in nodes
@@ -69,8 +74,11 @@
\fi%
}%
}%
+%
+% Event (legacy code for compatibility)
+%
\makeatother%
-\DeclareDocumentCommand \event {o m m}{%
+\DeclareDocumentCommand \event {o m m}{% [Startdate] Enddate Label
\pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}%
\IfNoValueTF {#1} {%
\ifflipped%
@@ -95,6 +103,30 @@
\fi%
}%
}
+%
+% Eventspan
+%
+\DeclareDocumentCommand \eventspan {m m m O{black} O{0.3} O{0.2} o}{% Startdate Enddate Label Fill Opacity Height Bottom?
+ \pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}%
+ \pgfmathsetlength\xstart{(#1-\theyearstart)*\unit}%
+ \IfNoValueTF {#7} {%
+ \draw[style={fill=#4,draw=none,opacity=#5},rounded corners=.05\unit]%
+ (\xstart,-#6\unit) rectangle node[eventlabel] {#3} (\xstop,.2\unit);%
+ }{%
+ \draw[style={fill=#4,draw=none,opacity=#5},rounded corners=.05\unit]% Event, bottom label
+ (\xstart,-#6\unit) rectangle node[eventlabelbottom, anchor=center]{#3} (\xstop,.2\unit);%
+ }%
+}
+%
+% Eventpoint
+%
+\DeclareDocumentCommand \eventpoint {m m O{red} O{1} O{0.3}}{% Date Label Fill Opacity Height
+ \pgfmathsetlength\xstop{(#1-\theyearstart)*\unit}%
+ \draw[style={fill=#3,draw=none,opacity=#4},rounded corners=0\unit]%
+ (\xstop, .1\unit) coordinate(A) -- (\xstop-.2*#5\unit,#5\unit) coordinate(B) -- (\xstop+.2*#5\unit,#5\unit)coordinate(C)%
+ -- cycle node[eventlabel] {#2};%
+}
+%
\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3}%
+%
\endinput%
-