diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-04 23:08:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-04 23:08:22 +0000 |
commit | 33ab70843f0e1fe17d712d1dc65fb37fd87e7dac (patch) | |
tree | d6f9a6b841a9d560a8ff9ba48ce3fc14f79ae993 | |
parent | 517d814fc2151f1a207e0fff3705de6384552f86 (diff) |
moderntimeline 4oct11
git-svn-id: svn://tug.org/texlive/trunk@24193 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/moderntimeline/moderntimeline.pdf | bin | 169784 -> 171151 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx | 94 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty | 82 |
3 files changed, 100 insertions, 76 deletions
diff --git a/Master/texmf-dist/doc/latex/moderntimeline/moderntimeline.pdf b/Master/texmf-dist/doc/latex/moderntimeline/moderntimeline.pdf Binary files differindex d53088d60ab..87a1c1e6181 100644 --- a/Master/texmf-dist/doc/latex/moderntimeline/moderntimeline.pdf +++ b/Master/texmf-dist/doc/latex/moderntimeline/moderntimeline.pdf diff --git a/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx index d19b321bb15..672b0885d25 100644 --- a/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx +++ b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx @@ -26,7 +26,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{moderntimeline} %<*package> - [2011/09/29 0.3 Add timelines to moderncv entries] + [2011/10/02 0.4 Add timelines to moderncv entries] %</package> % %<*driver> @@ -43,7 +43,7 @@ %</driver> % \fi % -% \CheckSum{198} +% \CheckSum{203} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -62,6 +62,7 @@ % Right brace \} Tilde \~} % % +% \changes{0.4}{2011/10/02}{Add firstyear and lastyear options} % \changes{0.3}{2011/09/29}{Bugfix: initialize tlsince} % \changes{0.2}{2011/09/29}{Add tlsince and options for tltext*} % \changes{0.1}{2011/09/28}{Initial release} @@ -95,9 +96,13 @@ % and can be loaded with: % % \begin{verbatim} -% \usepackage{moderntimeline} +% \usepackage[firstyear=1999,lastyear=2012]{moderntimeline} % \end{verbatim} % +% The \texttt{firstyear} and \texttt{lastyear} options indicate the maximum dates used +% to calibrate the time line. They are not mandatory and can be set later +% by means of the |\ltmaxdates| macro. +% % \subsection{Settings} % % Before you typeset entries, you need to adjust @@ -169,6 +174,9 @@ % to prevent the date label from overflowing into % the entry text. % +% Since version 0.4, you can set these dates by passing the +% \texttt{firstyear} and \texttt{lastyear} options to the package. +% % % \DescribeMacro{\tlsince} % When using a date range without an end year, @@ -260,6 +268,14 @@ % \begin{macrocode} \ProvidesPackage{moderntimeline} \RequirePackage{tikz} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=moderntimeline, + prefix=tl@, +} +\DeclareStringOption{firstyear} +\DeclareStringOption{lastyear} +\ProcessKeyvalOptions* % \end{macrocode} % % \begin{macro}{\tlwidth} @@ -316,9 +332,9 @@ % \begin{macrocode} \newcommand{\tltextend}[2][north east]{% \tikzset{ - tlendyear/.style={ + tl@endyear/.style={ font=#2, - name=tlendyear, + name=tl@endyear, below, inner xsep=0pt, anchor=#1, @@ -353,9 +369,9 @@ % \begin{macro}{\tlmaxdates} % \begin{macrocode} \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} } % \end{macrocode} % \end{macro} @@ -366,16 +382,16 @@ \newcommand{\tldatelabelcventry}[8][sectionrectanglecolor]{% % \end{macrocode} % \begin{macrocode} -\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)}% % \end{macrocode} % \begin{macrocode} \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$}; } @@ -390,16 +406,16 @@ \newcommand{\tldatecventry}[7][sectionrectanglecolor]{% % \end{macrocode} % \begin{macrocode} -\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)}% % \end{macrocode} % \begin{macrocode} \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$}; } @@ -414,25 +430,25 @@ \newcommand{\tlcventry}[8][sectionrectanglecolor]{% % \end{macrocode} % \begin{macrocode} -\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 } } @@ -446,22 +462,22 @@ \newcommand{\tllabelcventry}[9][sectionrectanglecolor]{% % \end{macrocode} % \begin{macrocode} -\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 } } 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 } } |