[Tex/LaTex] Questions about Moderntimeline in moderncv

moderncvmoderntimeline

Corresponding to this thread and this I tried to create a timeline in my cv. My code is:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 
\usepackage{xparse}
\usepackage[firstyear=1996,lastyear=2013]{moderntimeline}


% for timeline

\makeatletter
\pgfmathsetmacro\tl@textstartabove{\tl@width-2pt}
\NewDocumentCommand\tldatelabelcventryn{O{center}O{color1}mmmmmmm}{%
\pgfmathsetmacro\tl@endyear{\tl@lastyear}%
\pgfmathsetmacro\tl@startfraction{(#3-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
 \cventry{\tikz[baseline]{%
     \useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
     \fill [\tl@runningcolor] (0,0)
        rectangle (\hintscolumnwidth,\tl@runningwidth);
     \fill [#2] (0,0)
        ++(\tl@startfraction*\hintscolumnwidth,0pt)
        node [tl@startyear,yshift=5pt,anchor=#1] {#4}
        node {$\bullet$};
   }
}
{#5}{#6}{#7}{#8}{#9}
}
\makeatother
%
\tltextstart[north]{\scriptsize}
\tltextend[south]{\scriptsize}

%
\firstname{C}
\familyname{N}
\title{Curriculum vit\ae{}}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born on .... in xxxxx

\section{school education}
\tlcventry[cyan!60!black]{2000}{2008}{test1}{test}{}{}{grade: 22}
\tlcventry[cyan!60!black]{1996}{2000}{test2}{}{}{}{test}
\section{studies}
\tllabelcventry[cyan!60!black]{2011}{2013}{Oct 01, 2011}{test3}{}{}{}{test}

\tldatelabelcventry[cyan!60!black]{2011}{Apr 06, 2011}{Test4}{}{test}
{test}{}


\tllabelcventry[cyan!60!black]{2009}{2011}{Dec 01,2009--Jan 01,2011}{Test5}{}{}{}{test}


\end{document}

This gives

t1

  1. test1 and test2 are ok
  2. I want to have test3 until today. So that the Oct 01, 2011 is below the line and it goes until today, so it should be Oct01,2011--today, but this is not working, also the descirption should be "today"
  3. As you can see Test4 is (vertically) not centered? The bold Test4 is too much under the grey line, it is not the same as in the previous cases, how can I have this the way as before? Also I want to have the "Apr 06, 2011" above the grey line.
  4. Test 5 does not work. How can I have the Jan 01, 2011 above the grey line.

And one general question: Currently I am only specifying the year, so e.g. 2009, although sometimes I add the specific day in the label. Is it possible to also specify the month, so that the cyan bar is drawn excatly at this month and this year, so to distinguish on this very detailed level?

EDIT:

\tllabelcventryn[cyan!60!black]{2000}{2008.583}{2000}{Jul 11, 2008}{Test}{Test}{}{}{grade: 1.8}

gives

t1

but I want to have the "Jul 11, 2008" shifted/pushed to the right, so like this (I did it with paint):

t2

EDIT 2: Further on, I would like to have the Apr 06, 2011 in the same style, so that the label is not centered about the timeline itself but around the dot, so that it looks like:

te

So it should have the same alignment as the others, in total they should end at the same border, so that it looks like the following:

test1

Best Answer

One possible solution (notice the additional "n" at the end of the newly defined commands):

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 
\usepackage{xparse}
\usepackage[firstyear=1996,lastyear=2013]{moderntimeline}


% for timeline

\makeatletter
\pgfmathsetmacro\tl@textstartabove{\tl@width-2pt}
\NewDocumentCommand\tldatelabelcventryn{O{center}O{color1}mmmmmmm}{%
\pgfmathsetmacro\tl@endyear{\tl@lastyear}%
\pgfmathsetmacro\tl@startfraction{(#3-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
 \cventry{\tikz[baseline]{%
     \useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
     \fill [\tl@runningcolor] (0,0)
        rectangle (\hintscolumnwidth,\tl@runningwidth);
     \fill [#2] (0,0)
        ++(\tl@startfraction*\hintscolumnwidth,0pt)
        node [tl@startyear,yshift=5pt,anchor=#1] {#4}
        node {$\bullet$};
   }
}
{#5}{#6}{#7}{#8}{#9}
}
\newcommand\tllabelcventryn[9][color1]{%
  \gdef\Argi{#1}%
  \gdef\Argii{#2}%
  \gdef\Argiii{#3}%
  \gdef\Argiv{#4}%
  \gdef\Argv{#5}%
  \gdef\Argvi{#6}%
  \gdef\Argvii{#7}%
  \gdef\Argviii{#8}%
  \gdef\Argix{#9}%
  \auxtllabelcventryn
}
\def\auxtllabelcventryn#1{%
  \gdef\Argx{#1}%
\pgfmathsetmacro\tl@endyear{ifthenelse(\Argiii==0,\tl@lastyear,\Argiii)}
\pgfmathsetmacro\tl@startfraction{(\Argii-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
 \cventry{\tikz[baseline=0pt]{
     \fill [\tl@runningcolor] (0,0)
        rectangle (\hintscolumnwidth,\tl@runningwidth);
     \useasboundingbox (0,-1.5ex)
        rectangle (\hintscolumnwidth,1ex);
     \fill [\Argi] (0,0)
        ++(\tl@startfraction*\hintscolumnwidth,0pt)
        node [tl@startyear,anchor=north east] {\Argiv} node [tl@startyear,above] {\Argv}
        rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt);
     \pgfmathsetlength{\pgf@xa}{\Argiii} \ifdim\pgf@xa=0pt
        \shade [left color=\Argi] (\tl@startfraction*\hintscolumnwidth,0)
            rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
     \else
        \fill [\Argi] (\tl@startfraction*\hintscolumnwidth,0)
            rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
     \fi
     }
}
{\Argvi}{\Argvii}{\Argviii}{\Argix}{\Argx}%
}
\makeatother
%
\tltextstart[north]{\scriptsize}
\tltextend[south]{\scriptsize}

%
\firstname{C}
\familyname{N}
\title{Curriculum vit\ae{}}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born on .... in xxxxx

\section{school education}
\tlcventry[cyan!60!black]{2000}{2008}{test1}{test}{}{}{grade: 22}
\tlcventry[cyan!60!black]{1996}{2000}{test2}{}{}{}{test}
\section{studies}
\tllabelcventryn[cyan!60!black]{2011}{2013}{Oct 01, 2011}{today}{test3a}{}{}{}{test}

\tllabelcventry[cyan!60!black]{2011}{2013}{Oct 01, 2011--today}{test3b}{}{}{}{test}

\tldatelabelcventryn[east][cyan!60!black]{2011}{Apr 06, 2011}{Test4}{}{test}
{test}{}

\tllabelcventryn[cyan!60!black]{2009}{2011}{Dec 01,2009}{Jan 01,2011}{Test5}{}{}{}{test}


\end{document}

enter image description here

Related Question