diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-29 22:53:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-29 22:53:00 +0000 |
commit | 9862d695d4ddf483e63f97fa63f312716db84853 (patch) | |
tree | b148dbf4ed371b4ab97e2e1e7ba7624e5e48669b /Master/texmf-dist/source/latex/moderntimeline | |
parent | 307a409e5a3cc8c467bbe5d0e0fe9beacf620adf (diff) |
new latex package moderntimeline (29sep11)
git-svn-id: svn://tug.org/texlive/trunk@24138 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/moderntimeline')
-rw-r--r-- | Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx | 438 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/moderntimeline/moderntimeline.ins | 57 |
2 files changed, 495 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx new file mode 100644 index 00000000000..1237d75c1a4 --- /dev/null +++ b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.dtx @@ -0,0 +1,438 @@ +% \iffalse meta-comment +% +% Copyright (C) 2011 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 +% 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 Raphaël Pinson. +% +% This work consists of the files moderntimeline.dtx and moderntimeline.ins +% and the derived filebase moderntimeline.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{moderntimeline.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{moderntimeline} +%<*package> + [2011/09/28 0.1 Add timelines to moderncv entries] +%</package> +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{moderntimeline}[2011/09/28] +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{moderntimeline.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{184} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{0.1}{2011/09/28}{Initial release} +% +% \DoNotIndex{\newcommand,\newenvironment} +% +% \providecommand*{\url}{\texttt} +% \GetFileInfo{moderntimeline.dtx} +% \title{The \textsf{moderntimeline} package} +% \author{Raphaël Pinson \\ \url{raphink@gmail.com}} +% \date{\fileversion~from \filedate} +% +% \maketitle +% +% \section{Introduction} +% +% As I was reworking my CV (which uses \textsf{moderncv}), +% the thought came to me that instead of just putting +% dates in front of each entries, it would be nice to have +% timelines to make them more graphical and get a better +% grasp of the time span of each entry. +% +% After playing a bit, I asked a question on +% stackexchange.com\footnote{\url{http://tex.stackexchange.com/questions/29725/putting-a-timeline-for-dates-in-moderncv}} +% and adapted the answer provided by Jake\footnote{\url{http://tex.stackexchange.com/users/2552/jake}} +% and turned it into this package. +% +% \section{Usage} +% +% This package is to be used together with the \textsf{moderncv} class, +% and can be loaded with: +% +% \begin{verbatim} +% \usepackage{moderntimeline} +% \end{verbatim} +% +% \subsection{Settings} +% +% Before you typeset entries, you need to adjust +% the settings for this package. +% +% \DescribeMacro{\tlwidth} +% You can optionally set the width of the time line +% by calling |\tlwidth| with a dimension. +% +% \DescribeMacro{\tlrunningwidth} +% For each entry, a running line is traced behind the +% time line. You can set the width of this line by +% means of the |\tlrunningwidth| macro. +% +% \DescribeMacro{\tlrunningcolor} +% To set the color of the running line placed behind +% the time line, you can use the |\tlrunningcolor| macro. +% +% \DescribeMacro{\tltextstart} +% If you wish to set the size of the start date label, +% you can do so by using |\tltextstart|, passing it +% a text size macro. +% +% \DescribeMacro{\tltextend} +% If you wish to set the size of the end date label, +% you can do so by using |\tltextend|, passing it +% a text size macro. +% +% \DescribeMacro{\tltext} +% You can set the sizes of both the start and end dates +% by calling the |\tltext| macro with a text size macro. +% +% \DescribeMacro{\tlmaxdates} +% Before you can typeset any entry, you need to specify +% the maximal range of dates which will serve as a reference. +% This range will be mapped to the width of the left column, +% and dates will be positionned accordingly. +% To set the range, use the |\tlmaxdates| macro, passing it +% the first and last dates you will be using: +% +% \begin{verbatim} +% \tlmaxdates{1999}{2012} +% \end{verbatim} +% +% If you are going to use the last date of the range +% as a start date or a unique date for an entry, +% you should probably set the max date a bit higher +% to prevent the date label from overflowing into +% the entry text. +% +% \subsection{CV entries} +% +% This package provides new CV entry commands +% for the \textsf{moderncv} class. +% They are described in this section. +% +% +% \DescribeMacro{\tlcventry} +% The |\tlcventry| macro lets you typeset +% a date range. +% In addition to the standard CV entry, one option +% and two mandatory arguments are added: +% +% \begin{verbatim} +% \tlcventry{1999}{2002}{WYSIWYG User}{Unnamed Company} +% {Somewhere}{}{Tried hard to typeset documents} +% \tlcventry[blue]{2002}{0}{Happy TeXnician}{Any Company} +% {Anywhere}{}{Achieved nice typography and shared code with friends} +% \end{verbatim} +% +% The option sets the color of the time line. +% If unset, the color defaults to the theme color of the CV. +% +% The two arguments added in the beginning of the call +% are the start and end dates for the entry. +% If the position is still held, use \texttt{0} as the end date. +% This will add a gradient at the end of the time line. +% +% +% \DescribeMacro{\tllabelcventry} +% The |\tllabelcventry| macro is similar to |\tlcventry|, +% but it takes yet a third additional argument, which lets you +% set a label for the time line. +% When this is used, the dates are not typeset around the time line, +% only the label is placed where the start date would normally be. +% +% This is useful when your dates contain month names, or if the +% time span is too short to properly typeset the dates above +% and under the time line: +% +% \begin{verbatim} +% \tllabelcventry[magenta]{2002}{2003}{July--November 2002} +% {Scribus Student}{GNU School} +% {The Internet}{}{Tried Scribus for a short while} +% \end{verbatim} +% +% \DescribeMacro{\tldatecventry} +% Positions usually last long enough to draw time lines, +% but there are also punctual entries, such as diplomas. +% The |\tldatecventry| lets to typeset unique dates. +% It places a bullet on the date and typesets the date above it: +% +% \begin{verbatim} +% \tldatecventry[brown]{2011}{Trusted TeX.SX user}{}{tex.stackexchange.com} +% {The Internet}{}{Achived 20k reputation on TeX.SX} +% \end{verbatim} +% +% +% \DescribeMacro{\tldatelabelcventry} +% Similarly to |\tllabelcventry|, you might want to place +% a label on a unique date entry, such as an exact date +% or a month. The |\tldatelabelcventry| provides a parameter to achive this: +% +% \begin{verbatim} +% \tldatelabelcventry[brown]{2011}{Christmas 2011}{Happy TeXer}{}{Home} +% {Townville}{}{Received Don Knuth's \emph{3:16} as a gift.} +% \end{verbatim} +% +% +% \StopEventually{} +% +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +\ProvidesPackage{moderntimeline} +\RequirePackage{tikz} +% \end{macrocode} +% +% \begin{macro}{\tlwidth} +% \begin{macrocode} +\newcommand{\tlwidth}[1]{% + \def\tl@width{#1} + \pgfmathsetmacro\tl@textstartabove{\tl@width+1pt} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tlrunningwidth} +% \begin{macrocode} +\newcommand{\tlrunningwidth}[1]{% + \def\tl@runningwidth{#1} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tlrunningcolor} +% \begin{macrocode} +\newcommand{\tlrunningcolor}[1]{% + \def\tl@runningcolor{#1} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tltextstart} +% \begin{macrocode} +\newcommand{\tltextstart}[1]{% +% \end{macrocode} +% \begin{macrocode} + \tikzset{ + tlstartyear/.style={ + font=#1, + name=tlstartyear, + above=\tl@textstartabove, + inner xsep=0pt, + anchor=base west, + } + } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tltextend} +% \begin{macrocode} +\newcommand{\tltextend}[1]{% +% \end{macrocode} +% \begin{macrocode} + \tikzset{ + tlendyear/.style={ + font=#1, + name=tlendyear, + below, + inner xsep=0pt, + anchor=north east, + } + } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tltext} +% \begin{macrocode} +\newcommand{\tltext}[1]{% +% \end{macrocode} +% \begin{macrocode} + \tltextstart{#1}% + \tltextend{#1} +} +% \end{macrocode} +% \end{macro} +% +% Defaults +% \begin{macrocode} +\tltext{\scriptsize} +\tlwidth{0.8ex} +\tlrunningwidth{0.05ex} +\tlrunningcolor{gray} +% \end{macrocode} +% +% +% \begin{macro}{\tlmaxdates} +% \begin{macrocode} +\newcommand{\tlmaxdates}[2]{% + \def\tlfirstyear{#1} + \def\tllastyear{#2} + \pgfmathsetmacro\tlyearrange{\tllastyear-\tlfirstyear} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tldatelabelcventry} +% \begin{macrocode} +\newcommand{\tldatelabelcventry}[8][sectionrectanglecolor]{% +% \end{macrocode} +% \begin{macrocode} +\pgfmathsetmacro\tlendyear{\tllastyear} +\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +% \end{macrocode} +% \begin{macrocode} + \cventry{\tikz[baseline=(tlendyear.north)]{ + \fill [\tl@runningcolor] (0,0) + rectangle (\hintscolumnwidth,\tl@runningwidth); + \fill [#1] (0,0) + ++(\tlstartfraction*\hintscolumnwidth,0pt) + node [tlstartyear] {#3} + node {$\bullet$}; + } +} +{#4}{#5}{#6}{#7}{#8} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tldatecventry} +% \begin{macrocode} +\newcommand{\tldatecventry}[7][sectionrectanglecolor]{% +% \end{macrocode} +% \begin{macrocode} +\pgfmathsetmacro\tlendyear{\tllastyear} +\pgfmathsetmacro\tlstartfraction{(#2-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +\pgfmathsetmacro\tlendfraction{(\tlendyear-\tlfirstyear)/(\tllastyear-\tlfirstyear)}% +% \end{macrocode} +% \begin{macrocode} + \cventry{\tikz[baseline=(tlendyear.north)]{ + \fill [\tl@runningcolor] (0,0) + rectangle (\hintscolumnwidth,\tl@runningwidth); + \fill [#1] (0,0) + ++(\tlstartfraction*\hintscolumnwidth,0pt) + node [tlstartyear] {#2} + node {$\bullet$}; + } +} +{#3}{#4}{#5}{#6}{#7} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tlcventry} +% \begin{macrocode} +\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)}% + \cventry{\tikz[baseline=(tlendyear.north)]{ + \fill [\tl@runningcolor] (0,0) + rectangle (\hintscolumnwidth,\tl@runningwidth); + \fill [#1] (0,0) + ++(\tlstartfraction*\hintscolumnwidth,0pt) + node [tlstartyear] {#2} + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width-1pt) + node [tlendyear] {\pgfmathparse{ifthenelse(#3==0,,#3)}\pgfmathresult} + (\hintscolumnwidth,0pt) ; + \ifnum #3=0 + \shade [left color=#1] (\tlstartfraction*\hintscolumnwidth,0) + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \else + \fill [#1] (\tlstartfraction*\hintscolumnwidth,0) + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \fi + } +} +{#4}{#5}{#6}{#7}{#8} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tllabelcventry} +% \begin{macrocode} +\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)]{ + \fill [\tl@runningcolor] (0,0) + rectangle (\hintscolumnwidth,\tl@runningwidth); + \fill [#1] (0,0) + ++(\tlstartfraction*\hintscolumnwidth,0pt) + node [tlstartyear] {#4} + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width-1pt); + \ifnum #3=0 + \shade [left color=#1] (\tlstartfraction*\hintscolumnwidth,0) + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \else + \fill [#1] (\tlstartfraction*\hintscolumnwidth,0) + rectangle (\tlendfraction*\hintscolumnwidth,\tl@width); + \fi + } +} +{#5}{#6}{#7}{#8}{#9} +} +% \end{macrocode} +% \end{macro} +% +% \iffalse +%</package> +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.ins b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.ins new file mode 100644 index 00000000000..834b2efcfdd --- /dev/null +++ b/Master/texmf-dist/source/latex/moderntimeline/moderntimeline.ins @@ -0,0 +1,57 @@ +%% Copyright (C) 2011 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 +%% 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 Raphaël Pinson. +%% +%% This work consists of the files moderntimeline.dtx and moderntimeline.ins +%% and the derived filebase moderntimeline.sty. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/moderntimeline} + +\preamble + +This is a generated file. + +Copyright (C) 2011 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 +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. + +\endpreamble + +\generate{\file{moderntimeline.sty}{\from{moderntimeline.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* moderntimeline.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file moderntimeline.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile |