Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm updating my CV using the moderncv class with moderntimeline, and most of it is looking really nice by now.

However, one of my previous positions I held twice, with a year-long break in the middle. Currently I just have one item spanning from 2003 to 2007 and the one above it from 2005 to 2006. It would be real nice if I could typeset this as a "gap" in the timeline entry for this item, matching the rectangle representing what I did during the break.

(If it's unclear what I mean, please let me know and I'll try to generate some images...)

MWE:

Here's an example of what it looks like right now:

MWE

What I'd like, is a "gap" in the longer bar, matching the shorter bar above it, so that the timeline shows that I did one thing, then another, and then "jumped back" to the first one, rather than doing two things simultaneously for a while.

Code for the MWE:

\documentclass[a4paper]{moderncv}

\moderncvtheme{classic}
\usepackage{moderntimeline}
\usepackage{lipsum}

\firstname{John}
\familyname{Doe}

\tlmaxdates{2005}{2015}
\begin{document}
\thispagestyle{empty}

\tlcventry{2010}{2011}{Position 2}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\tlcventry{2007}{2013}{Position 1}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}

\end{document}
share|improve this question
    
Could you include a minimal example document that can serve as a framework to work on a solution, ideally together with a mock-up picture of what you want the output to look like? –  Jake Mar 15 '13 at 16:50
    
@Jake: Clearer? I don't know how to generate a mockup that shows what I want in a good way, so I hope my explanations are sufficient. –  Tomas Lycken Mar 15 '13 at 17:16
add comment

1 Answer 1

If I understood you correctly, the code below does what you want: the newly defined \gaptlcventry command acts in a similar fashion to \tlcventry but gives you a gap in the timeline; the new command has nine mandatory arguments (if you want to keep the first optional argument, as in \tlcventry, some more work will have to be done):

\gaptlcventry{1999}{2003}{2010}{2022}{WYSIWYG User}{Unnamed Company}
  {Somewhere}{}{Tried hard to typeset documents}

The above example will give a gap between 2003 and 2010. A complete example:

\documentclass[a4paper]{moderncv}

\moderncvtheme{classic}
\usepackage{moderntimeline}
\usepackage{lipsum}

\firstname{John}
\familyname{Doe}

\tlmaxdates{2005}{2015}

\makeatletter
\newcommand{\gaptlcventry}[9]{%
\pgfmathsetmacro\tl@endyear{ifthenelse(#4==0,\tl@lastyear,#4)}%
\pgfmathsetmacro\tl@startfraction{(#1-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
%
\pgfmathsetmacro\tl@startsfraction{(#3-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%new
\pgfmathsetmacro\tl@endsfraction{(#4-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%new
%
\pgfmathsetlength{\pgf@xa}{#4}%
\ifdim\pgf@xa=0pt 
  \def\tl@startlabel{\tl@since #1} 
  \def\tl@startslabel{\tl@since #3}%new 
\else 
  \def\tl@startlabel{#1} 
  \def\tl@startslabel{#3}%new 
\fi
 \cventry{\tikz[baseline=0pt]{
    \useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
    \fill [\tl@runningcolor] (0,0)
       rectangle (\hintscolumnwidth,\tl@runningwidth);
    \fill [color1] (0,0)
       ++(\tl@startfraction*\hintscolumnwidth,0pt)
       node [tl@startyear] {\tl@startlabel}
       rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt)
       node [tl@endyear] {\pgfmathparse{ifthenelse(#2==0,,#2)}\pgfmathresult}
       (\hintscolumnwidth,0pt) ;
%%new
    \fill [color1] (0,0)
       ++(\tl@startsfraction*\hintscolumnwidth,0pt)
       node [tl@startyear] {\tl@startslabel}
       rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width-1pt)
       node [tl@endyear] {\pgfmathparse{ifthenelse(#4==0,,#4)}\pgfmathresult}
       (\hintscolumnwidth,0pt) ;
%%endnew
    \pgfmathsetlength{\pgf@xa}{#4} 
    \ifdim\pgf@xa=0pt
       \shade [left color=color1] (\tl@startfraction*\hintscolumnwidth,0)
           rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
%%new
       \shade [left color=color1] (\tl@startsfraction*\hintscolumnwidth,0)
           rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width);
%%endnew
    \else
       \fill [color1] (\tl@startfraction*\hintscolumnwidth,0)
           rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
%%new
       \fill [color1] (\tl@startsfraction*\hintscolumnwidth,0)
           rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width);
%%endnew
    \fi
    }%
}%
{#5}{#6}{#7}{#8}{#9}%
}
\makeatother

\begin{document}
\thispagestyle{empty}

\tlcventry{2010}{2011}{Position 2}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2007}{2010}{2011}{2013}{Position 1}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}

\tlcventry{2008}{2013}{Position 3}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2006}{2008}{2013}{2014}{Position 4}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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