diff options
author | Karl Berry <karl@freefriends.org> | 2015-08-31 22:41:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-08-31 22:41:33 +0000 |
commit | f7f914be994de8129564cb45fec1010c2321f882 (patch) | |
tree | 3cd6f76e8a8ff8ea83c871cd9aa819faabec1531 /Master/texmf-dist/tex/latex | |
parent | aa33a712112ba616d83b95ead228b640dc6df765 (diff) |
moderntimeline (31aug15)
git-svn-id: svn://tug.org/texlive/trunk@38254 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty | 123 |
1 files changed, 98 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty b/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty index f4fe260d0fc..a366c1cda8c 100644 --- a/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty +++ b/Master/texmf-dist/tex/latex/moderntimeline/moderntimeline.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2011-2012 by Raphaël Pinson <raphink@gmail.com> +%% Copyright (C) 2011-2015 by Raphaël Pinson <raphink@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -20,7 +20,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{moderntimeline} - [2015/02/25 0.8 Add timelines to moderncv entries] + [2015/08/31 0.9 Add timelines to moderncv entries] \ProvidesPackage{moderntimeline} \RequirePackage{tikz} \RequirePackage{kvoptions} @@ -31,6 +31,8 @@ \DeclareStringOption{firstyear} \DeclareStringOption{lastyear} \ProcessKeyvalOptions* +\newif\ifstartyear +\newif\ifissince \newcommand{\tlwidth}[1]{% \def\tl@width{#1} \pgfmathsetmacro\tl@textstartabove{\tl@width+1pt} @@ -44,10 +46,6 @@ \newcommand{\tlsince}[1]{% \def\tl@since{#1} } -\newcommand{\tlsetnotshadedfraction}[1]{% - \def\tl@nsfrac{#1} -} -\tlsetnotshadedfraction{0} \newcommand{\tltextstart}[2][base west]{% \tikzset{ tl@startyear/.style={ @@ -85,21 +83,101 @@ \tltextend{#1}% \tltextsingle{#1}% } +\newcommand{\tlsetnotshadedfraction}[1]{% + \def\tl@nsfrac{#1} +} +\newcommand{\tlenablemonths}{% + \def\tl@nomonthvalue{6} +} +\newcommand{\tldisablemonths}{% + \def\tl@nomonthvalue{0} +} \tltext{\scriptsize} \tlwidth{0.8ex} \tlrunningwidth{0.05ex} \tlrunningcolor{gray} \tlsince{} +\tlsetnotshadedfraction{0} +\tldisablemonths \newcommand{\tlmaxdates}[2]{% \def\tl@firstyear{#1} \def\tl@lastyear{#2} \pgfmathsetmacro\tl@yearrange{\tl@lastyear-\tl@firstyear} } +\newcommand{\tl@yearfraction}[1]{% Month 1 - 12 -> 0 - 11 + \gdef\tl@tmpyear{-1}% Resetting + \gdef\tl@tmpmonth{-1}% + \begingroup% + \edef\@tempa{#1/}% + \expandafter\endgroup\expandafter\tl@yearfraction@auxi\@tempa\@nnil% + \ifstartyear + \pgfmathsetmacro\tl@startyear{\tl@tmpyear+(\tl@tmpmonth-1)/12}% + \else + \ifnum\tl@tmpyear=0 + \pgfmathsetmacro\tl@endyear{\tl@lastyear}% + \issincetrue% + \else + \pgfmathsetmacro\tl@endyear{\tl@tmpyear+\tl@tmpmonth/12}% + \issincefalse% + \fi + \fi +} +\newcommand{\tl@yearfraction@auxi}[2]{} +\def\tl@yearfraction@auxi#1/#2\@nnil{% + \ifnum\tl@tmpyear<0 % First call + \pgfmathsetmacro\tl@tmpyear{+#1}% + \ifx\@nnil#2\@nnil + \pgfmathsetmacro\tl@tmpmonth{+\tl@nomonthvalue}% + \else + \expandafter\tl@yearfraction@auxi#2\@nnil% + \fi + \else + \pgfmathsetmacro\tl@tmpmonth{#1}% + \fi +} +\newcommand{\tl@splitlabels}[1]{ + \gdef\tl@startlabel{}% Resetting + \begingroup% + \edef\@tempa{#1///}% + \expandafter\endgroup\expandafter\tl@splitlabels@auxi\@tempa\@nnil% +} +\newcommand{\tl@splitlabels@auxi}[2]{} +\def\tl@splitlabels@auxi#1///#2\@nnil{% + \ifx\tl@startlabel\empty\relax% First call + \gdef\tl@startlabel{#1} + \ifx\@nnil#2\@nnil + \gdef\tl@startlabel{} + \else + \expandafter\tl@splitlabels@auxi#2\@nnil% + \fi + \else + \gdef\tl@endlabel{#1} + \fi +} +\newcommand{\tl@formatstartyear}[1]{ + \startyeartrue + \tl@yearfraction{#1} + \pgfmathsetmacro\tl@startfraction{(\tl@startyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% + \ifissince + \xdef\tl@startlabel{\tl@since \tl@tmpyear} + \else + \xdef\tl@startlabel{\tl@tmpyear} + \fi +} +\newcommand{\tl@formatendyear}[1]{ + \startyearfalse% + \tl@yearfraction{#1} + \pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}% + \ifissince% + \xdef\tl@endlabel{} + \else + \xdef\tl@endlabel{\tl@tmpyear} + \fi +} \newcommand{\tldatelabelcventry}[8][color1]{% -\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{ +\issincefalse +\tl@formatstartyear{#2} +\cventry{\tikz{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); \fill [#1] (0,0) @@ -111,9 +189,8 @@ {#4}{#5}{#6}{#7}{#8} } \newcommand{\tldatecventry}[7][color1]{% -\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)}% +\issincefalse +\tl@formatstartyear{#2} \cventry{\tikz[baseline=0pt]{ \useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex); \fill [\tl@runningcolor] (0,0) @@ -127,11 +204,8 @@ {#3}{#4}{#5}{#6}{#7}% } \newcommand{\tlcventry}[8][color1]{% -\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)}% -\pgfmathsetlength{\pgf@xa}{#3} \ifdim\pgf@xa=0pt -\def\tl@startlabel{\tl@since #2} \else \def\tl@startlabel{#2} \fi +\tl@formatendyear{#3} +\tl@formatstartyear{#2} \cventry{\tikz[baseline=0pt]{ \useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex); \fill [\tl@runningcolor] (0,0) @@ -140,9 +214,9 @@ ++(\tl@startfraction*\hintscolumnwidth,0pt) node [tl@startyear] {\tl@startlabel} rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt) - node [tl@endyear] {\pgfmathparse{ifthenelse(#3==0,,#3)}\pgfmathresult} + node [tl@endyear] {\tl@endlabel} (\hintscolumnwidth,0pt) ; - \pgfmathsetlength{\pgf@xa}{#3} \ifdim\pgf@xa=0pt + \ifissince \newdimen\fullcolorwidth \pgfmathsetlength\fullcolorwidth{\tl@startfraction*(1+(1-\tl@startfraction)*\tl@nsfrac)*\hintscolumnwidth} \shade [left color=#1,right color=#1] @@ -159,9 +233,8 @@ {#4}{#5}{#6}{#7}{#8}% } \newcommand{\tllabelcventry}[9][color1]{% -\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)}% +\tl@formatendyear{#3} +\tl@formatstartyear{#2} \cventry{\tikz[baseline=0pt]{ \fill [\tl@runningcolor] (0,0) rectangle (\hintscolumnwidth,\tl@runningwidth); @@ -170,8 +243,8 @@ \fill [#1] (0,0) ++(\tl@startfraction*\hintscolumnwidth,0pt) node [tl@startyear] {#4} - rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt); - \pgfmathsetlength{\pgf@xa}{#3} \ifdim\pgf@xa=0pt + rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt) ; + \ifissince \newdimen\fullcolorwidth \pgfmathsetlength\fullcolorwidth{\tl@startfraction*(1+(1-\tl@startfraction)*\tl@nsfrac)*\hintscolumnwidth} \shade [left color=#1,right color=#1] |