7

In this example, the

2012

seems to be further away from the blue bar than the

2010

is. Can the

2012

be moved toward the bar, so that the

2012

and the

2010

are equidistant to the blue bar?

enter image description here

Here is my MWE:

% compile with LuaLaTeX

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic} 
\moderncvcolor{blue}

\usepackage[firstyear=2004,lastyear=2014]{moderntimeline}
\usepackage{etoolbox}           
\usepackage[ngerman]{babel}                         

\firstname{John}
\familyname{Doe}

\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}

\begin{document}

\tlcventry{2010}{2012}{test}{}{test}{}{test}  

\end{document}
3
  • If you mean vertically, you can replace \pgfmathsetmacro\tl@textstartabove{\tl@width-2pt} with \pgfmathsetmacro\tl@textstartabove{\tl@width-3pt}. Note that the rest of the code between \makeatletter and \makeatother is not needed for \tlcventry. Oct 13 '13 at 14:58
  • @karlkoeller this only moves down the 2010 and the 2012 stays where it is. I want to move the 2012 downwards.. and the other command \pgfmathsetmacro\tl@textENDabove{\tl@width-2pt} wont change anything.
    – Fry
    Oct 13 '13 at 16:01
  • i only want to move the 2012 a little downwards while the rest stays the same.
    – Fry
    Oct 13 '13 at 16:07
5

If you want to move "2012" a little downwards you can redefine \tltextend to be (added 1pt to below):

\renewcommand{\tltextend}[2][north east]{%
   \tikzset{
       tl@endyear/.style={
           font=#2,
           name=tl@endyear,
           below=1pt, % it was originally null
           inner xsep=0pt,
           anchor=#1,
       }
   }
}

Complete MWE:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}

\usepackage[firstyear=2004,lastyear=2014]{moderntimeline}
\usepackage{etoolbox}
\usepackage[ngerman]{babel}

\firstname{John}
\familyname{Doe}

\makeatletter
\pgfmathsetmacro\tl@textstartabove{\tl@width-2pt}
\renewcommand{\tltextend}[2][north east]{%
   \tikzset{
       tl@endyear/.style={
           font=#2,
           name=tl@endyear,
           below=1pt, % it was null
           inner xsep=0pt,
           anchor=#1,
       }
   }
}
\makeatother%

\tltextstart[north]{\scriptsize}
\tltextend[south]{\scriptsize}

\begin{document}

\tlcventry{2010}{2012}{test}{}{test}{}{test}

\end{document} 

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.