diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-05 23:11:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-05 23:11:03 +0000 |
commit | 9e1e59c4e1bc1ee121b460dde476a071bc978b2c (patch) | |
tree | 76d48b9c6e685bf828a9cc7593876f3a11db64c1 /Master/texmf-dist/tex/latex/chronology | |
parent | c26903056a67bff6777edf6ab6062ab268d67980 (diff) |
chronology (5apr13)
git-svn-id: svn://tug.org/texlive/trunk@29682 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chronology')
-rw-r--r-- | Master/texmf-dist/tex/latex/chronology/chronology.sty | 158 |
1 files changed, 83 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/latex/chronology/chronology.sty b/Master/texmf-dist/tex/latex/chronology/chronology.sty index b97a7dca3ac..911f3a8519b 100644 --- a/Master/texmf-dist/tex/latex/chronology/chronology.sty +++ b/Master/texmf-dist/tex/latex/chronology/chronology.sty @@ -1,76 +1,84 @@ -%% -%% This is file `chronology.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% chronology.dtx (with options: `package') -%% -%% This is a generated file. -%% -%% Copyright (C) 2010 by Levi Wiseman -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainer of this work is Levi Wiseman. -%% -%% This work consists of the file chronology.dtx and the derived files -%% chronology.ins, chronology.pdf, and chronology.sty. -%% -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{chronology}[2010/6/12 v1.0 Horizontal timeline] -\RequirePackage{calc} -\RequirePackage{tikz} -\RequirePackage{ifthen} -\newenvironment{chronology}[5][5]{% - \newcounter{step}\newcounter{stepstart}\newcounter{stepstop}% - \newcounter{yearstart}\newcounter{yearstop}\newcounter{deltayears}% - \newlength{\xstart}\newlength{\xstop}% - \newlength{\unit}\newlength{\timelinewidth}% - \setcounter{step}{#1}% - \setcounter{yearstart}{#2}\setcounter{yearstop}{#3}% - \setcounter{deltayears}{\theyearstop-\theyearstart}% - \setlength{\unit}{#4}% - \setlength{\timelinewidth}{#5}% - \pgfmathsetcounter{stepstart}% - {\theyearstart+\thestep-mod(\theyearstart,\thestep)}% - \pgfmathsetcounter{stepstop}{\theyearstop-mod(\theyearstop,\thestep)}% - \addtocounter{step}{\thestepstart}% - \newsavebox{\timelinebox}% - \begin{lrbox}{\timelinebox}% - \begin{tikzpicture}[baseline={(current bounding box.north)}]% - \draw [|->] (0,0) -- (\thedeltayears*\unit+\unit, 0);% - \foreach \x in {1,...,\thedeltayears}% - \draw[xshift=\x*\unit] (0,-.1\unit) -- (0,.1\unit);% - \addtocounter{deltayears}{1}% - \foreach \x in {\thestepstart,\thestep,...,\thestepstop}{% - \pgfmathsetlength\xstop{(\x-\theyearstart)*\unit}% - \draw[xshift=\xstop] (0,-.3\unit) -- (0,.3\unit);% - \node at (\xstop,0) [below=.2\unit] {\x};}}{% - \end{tikzpicture}% - \end{lrbox}% - \raisebox{2ex}{\resizebox{\timelinewidth}{!}{\usebox{\timelinebox}}}}% +\NeedsTeXFormat{LaTeX2e}% +\ProvidesPackage{chronology}[2010/6/12 v1.0 Horizontal timeline]% +\RequirePackage{calc}% +\RequirePackage{tikz}% +\RequirePackage{ifthen}% +\newcounter{step}\newcounter{stepstart}\newcounter{stepstop}% +\newcounter{yearstart}\newcounter{yearstop}\newcounter{deltayears}% +\newlength{\xstart}\newlength{\xstop}% +\newlength{\unit}\newlength{\timelinewidth}% +\newsavebox{\timelinebox}% +\makeatletter% +\newif\ifchronology@star% +\newenvironment{chronology}{% + \@ifstar{\chronology@startrue\chronology@i*}{\chronology@starfalse\chronology@i*}% +}{% + \end{tikzpicture}% + \end{lrbox}% + \raisebox{2ex}{\resizebox{\timelinewidth}{!}{\usebox{\timelinebox}}}% +}% +\def\chronology@i*{% + \@ifnextchar[{\chronology@ii*}{\chronology@ii*[{5}]}% +}% +\def\chronology@ii*[#1]#2#3#4{% + \@ifnextchar[{\chronology@iii*[{#1}]{#2}{#3}{#4}}{\chronology@iii*[{#1}]{#2}{#3}{#4}[{#4}]}% +}% +\def\chronology@iii*[#1]#2#3#4[#5]{% + \newif\ifflipped% + \ifchronology@star% + \flippedtrue% + \else% + \flippedfalse% + \fi% + \setcounter{step}{#1}% + \setcounter{yearstart}{#2}\setcounter{yearstop}{#3}% + \setcounter{deltayears}{\theyearstop-\theyearstart}% + \setlength{\unit}{#5/\thedeltayears}% + \setlength{\timelinewidth}{#4}% + \pgfmathsetcounter{stepstart}{\theyearstart+\thestep-mod(\theyearstart,\thestep)}% + \pgfmathsetcounter{stepstop}{\theyearstop-mod(\theyearstop,\thestep)}% + \addtocounter{step}{\thestepstart}% + \begin{lrbox}{\timelinebox}% + \begin{tikzpicture}[baseline={(current bounding box.north)}]% + \draw [|->] (0,0) -- (\thedeltayears*\unit+\unit, 0);% + \foreach \x in {1,...,\thedeltayears}% + \draw[xshift=\x*\unit] (0,-.1\unit) -- (0,.1\unit);% + \addtocounter{deltayears}{1}% + \foreach \x in {\thestepstart,\thestep,...,\thestepstop}{% + \pgfmathsetlength\xstop{(\x-\theyearstart)*\unit}% + \draw[xshift=\xstop] (0,-.3\unit) -- (0,.3\unit);% + \ifflipped% + \node at (\xstop,0) [above=.2\unit] {\x};% + \else% + \node at (\xstop,0) [below=.2\unit] {\x};% + \fi% + }% +}% +\makeatother% \newcommand{\event}[3][e]{% - \pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}% - \ifx #1e% - \draw[fill=black,draw=none,opacity=0.5]% - (\xstop, 0) circle (.2\unit)% - node[opacity=1,rotate=45,right=.5\unit] {#3};% - \else% - \pgfmathsetlength\xstart{(#1-\theyearstart)*\unit}% - \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);% - \fi}% -\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3} -\endinput -%% -%% End of file `chronology.sty'. + \pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}% + \ifx #1e% + \ifflipped% + \draw[fill=black,draw=none,opacity=0.5]% + (\xstop, 0) circle (.2\unit)% + node[opacity=1,rotate=-45,right=.5\unit] {#3};% + \else% + \draw[fill=black,draw=none,opacity=0.5]% + (\xstop, 0) circle (.2\unit)% + node[opacity=1,rotate=45,right=.5\unit] {#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);% + \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);% + \fi% + \fi}% +\newcommand{\decimaldate}[3]{(#1-1)/31/12+(#2-1)/12+#3}% +\endinput% + |