From 33ab70843f0e1fe17d712d1dc65fb37fd87e7dac Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 4 Oct 2011 23:08:22 +0000 Subject: moderntimeline 4oct11 git-svn-id: svn://tug.org/texlive/trunk@24193 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/moderntimeline/moderntimeline.sty | 82 ++++++++++++---------- 1 file changed, 45 insertions(+), 37 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty b/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty index 6a68a773a8a..767f1df331d 100644 --- a/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty +++ b/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty @@ -20,9 +20,17 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{moderntimeline} - [2011/09/29 0.3 Add timelines to moderncv entries] + [2011/10/02 0.4 Add timelines to moderncv entries] \ProvidesPackage{moderntimeline} \RequirePackage{tikz} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=moderntimeline, + prefix=tl@, +} +\DeclareStringOption{firstyear} +\DeclareStringOption{lastyear} +\ProcessKeyvalOptions* \newcommand{\tlwidth}[1]{% \def\tl@width{#1} \pgfmathsetmacro\tl@textstartabove{\tl@width+1pt} @@ -49,9 +57,9 @@ } \newcommand{\tltextend}[2][north east]{% \tikzset{ - tlendyear/.style={ + tl@endyear/.style={ font=#2, - name=tlendyear, + name=tl@endyear, below, inner xsep=0pt, anchor=#1, @@ -68,19 +76,19 @@ \tlrunningcolor{gray} \tlsince{} \newcommand{\tlmaxdates}[2]{% - \def\tlfirstyear{#1} - \def\tllastyear{#2} - \pgfmathsetmacro\tlyearrange{\tllastyear-\tlfirstyear} + \def\tl@firstyear{#1} + \def\tl@lastyear{#2} + \pgfmathsetmacro\tl@yearrange{\tl@lastyear-\tl@firstyear} } \newcommand{\tldatelabelcventry}[8][sectionrectanglecolor]{% -\pgfmathsetmacro\tlendyear{\tllastyear} -\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% -\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +\pgfmathsetmacro\tl@endyear{\tl@lastyear} +\pgfmathsetmacro\tl@startfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% +\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% \cventry{\tikz{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); \fill [#1] (0,0) - ++(\tlstartfraction*\hintscolumnwidth,0pt) + ++(\tl@startfraction*\hintscolumnwidth,0pt) node [tlstartyear] {#3} node {$\bullet$}; } @@ -88,14 +96,14 @@ {#4}{#5}{#6}{#7}{#8} } \newcommand{\tldatecventry}[7][sectionrectanglecolor]{% -\pgfmathsetmacro\tlendyear{\tllastyear} -\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% -\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +\pgfmathsetmacro\tl@endyear{\tl@lastyear} +\pgfmathsetmacro\tl@startfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% +\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% \cventry{\tikz{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); \fill [#1] (0,0) - ++(\tlstartfraction*\hintscolumnwidth,0pt) + ++(\tl@startfraction*\hintscolumnwidth,0pt) node [tlstartyear] {#2} node {$\bullet$}; } @@ -103,47 +111,47 @@ {#3}{#4}{#5}{#6}{#7} } \newcommand{\tlcventry}[8][sectionrectanglecolor]{% -\pgfmathsetmacro\tlendyear{ifthenelse(#3==0,\tllastyear,#3)} -\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% -\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% -\ifnum #3=0 \def\tlstartlabel{\tl@since #2} \else \def\tlstartlabel{#2} \fi - \cventry{\tikz[baseline=(tlendyear.north)]{ +\pgfmathsetmacro\tl@endyear{ifthenelse(#3==0,\tl@lastyear,#3)} +\pgfmathsetmacro\tl@startfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% +\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% +\ifnum #3=0 \def\tl@startlabel{\tl@since #2} \else \def\tl@startlabel{#2} \fi + \cventry{\tikz[baseline=(tl@endyear.north)]{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); \fill [#1] (0,0) - ++(\tlstartfraction*\hintscolumnwidth,0pt) - node [tlstartyear] {\tlstartlabel} - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width-1pt) - node [tlendyear] {\pgfmathparse{ifthenelse(#3==0,,#3)}\pgfmathresult} + ++(\tl@startfraction*\hintscolumnwidth,0pt) + node [tlstartyear] {\tl@startlabel} + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt) + node [tl@endyear] {\pgfmathparse{ifthenelse(#3==0,,#3)}\pgfmathresult} (\hintscolumnwidth,0pt) ; \ifnum #3=0 - \shade [left color=#1] (\tlstartfraction*\hintscolumnwidth,0) - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \shade [left color=#1] (\tl@startfraction*\hintscolumnwidth,0) + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width); \else - \fill [#1] (\tlstartfraction*\hintscolumnwidth,0) - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \fill [#1] (\tl@startfraction*\hintscolumnwidth,0) + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width); \fi } } {#4}{#5}{#6}{#7}{#8} } \newcommand{\tllabelcventry}[9][sectionrectanglecolor]{% -\pgfmathsetmacro\tlendyear{ifthenelse(#3==0,\tllastyear,#3)} -\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% -\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% - \cventry{\tikz[baseline=(tlendyear.north)]{ +\pgfmathsetmacro\tl@endyear{ifthenelse(#3==0,\tl@lastyear,#3)} +\pgfmathsetmacro\tl@startfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% +\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% + \cventry{\tikz[baseline=(tl@endyear.north)]{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); \fill [#1] (0,0) - ++(\tlstartfraction*\hintscolumnwidth,0pt) + ++(\tl@startfraction*\hintscolumnwidth,0pt) node [tlstartyear] {#4} - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width-1pt); + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt); \ifnum #3=0 - \shade [left color=#1] (\tlstartfraction*\hintscolumnwidth,0) - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \shade [left color=#1] (\tl@startfraction*\hintscolumnwidth,0) + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width); \else - \fill [#1] (\tlstartfraction*\hintscolumnwidth,0) - rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \fill [#1] (\tl@startfraction*\hintscolumnwidth,0) + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width); \fi } } -- cgit v1.2.3