I am using moderncv and moderntimeline and I know I can add an open ended interval by setting the second argument of \tlcventry to 0, like so \tlcventry{2000}{0}{My current position}{etc}{foo}{bar}{baz}

What I want to do, is the reverse, for an interval that started very early, and then finished. That way, I could use narrower \tlmaxdates{}{}, which looks nicer.

So what I want to be able to do, is \tlcventry{0}{2000}{My early education}{etc}{foo}{bar}{baz}, which of course does not work out of the box.

I tried looking at the code of \tlcventry, and there appears \ifissince, however, I don't understand how to apply that to the first as well as the second variable.

A MWE demonstrating my problem is the following :

\documentclass{moderncv}
\usepackage{moderntimeline}
\tlmaxdates{1990}{2020}
\moderncvstyle{classic}
\moderncvcolor{blue}
\name{John}{Doe}
\title{CV}
\begin{document}
\makecvtitle
\section{Education}
\tlcventry{2000}{2010}{Some Job}{}{}{}{}
\tlcventry{2010}{0}{Current Job}{}{}{}{}
\tlcventry{0}{2000}{School}{}{}{}{}%Doesn't work
\end{document}


How does the \tlcventry command have to be modified such that the third line gives a result similar to the second line (With an increasing, instead of decreasing color gradient)

• To increase the answerability of this question you could add an MWE for a complete compilable document that shows the current behavior with the current output, and a sketch of what you want to achieve. May 17 '20 at 12:09

The following code provides a redefinition of \tlcventry that also fades to the left. The original definition is changed at two places.

First the code that draws the labels is extended with a check if the second argument #2 is zero (which is the first argument given in case no optional arguments are used, i.e., the argument that holds the start year). If this is the case then only the end label is drawn and not the fill that is there for some reason.

Second the same check is used further down when the solid or faded bars are drawn. If the start year is zero a left fade is used, else the normal solid fill is drawn.

Note that the existing fade is actually built out of two segments, a short solid bar and a faded bar next to it, while the new definition is only the faded bar. I actually like only the faded bar better because the combined bar can leave artifacts (some thin gray lines in my viewer), so you might even think of removing that from the original definition as well - or add it to the new definition if you do like it.

\documentclass{moderncv}
\usepackage{moderntimeline}
\tlmaxdates{1990}{2020}
\moderncvstyle{classic}
\moderncvcolor{blue}
\name{John}{Doe}
\title{CV}

\makeatletter
\renewcommand{\tlcventry}[8][color1]{%
\tl@formatendyear{#3}
\tl@formatstartyear{#2}
\cventry{\tikz[baseline=0pt]{
\useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidth,\tl@runningwidth);
\ifnum#2=0% FIRST MODIFICATION HERE
\node[#1, tl@endyear] at (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt) {\tl@endlabel};
\else
\fill [#1] (0,0)
++(\tl@startfraction*\hintscolumnwidth,0pt)
node [tl@startyear] {\tl@startlabel}
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt)
node [tl@endyear] {\tl@endlabel}
(\hintscolumnwidth,0pt) ;%
\fi
\ifissince
\newdimen\fullcolorwidth
\pgfmathsetlength\fullcolorwidth{\tl@startfraction*(1+(1-\tl@startfraction)*\tl@nsfrac)*\hintscolumnwidth}
(\tl@startfraction*\hintscolumnwidth,0)
rectangle (\fullcolorwidth,\tl@width);
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
\else%
\ifnum#2=0% SECOND MODIFICATION HERE
\shade [left color=white, right color=#1] (0,0) rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
\else
\fill [#1] (\tl@startfraction*\hintscolumnwidth,0)
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
\fi
\fi
}%
}%
{#4}{#5}{#6}{#7}{#8}%
}
\makeatother

\begin{document}
\makecvtitle
\section{Education}
\tlcventry{2000}{2010}{Some Job}{}{}{}{}
\tlcventry{2010}{0}{Current Job}{}{}{}{}
\tlcventry{0}{2000}{School}{}{}{}{}%Works now
\end{document}


Result:

• I'm sorry for not having included this in the MWE, but this fails with "Missing = inserted for \ifnum" if \tlenablemonths is added to the preamble. Years then can take the format "YYYY/M" with M = 1..12 (no leading zero) May 20 '20 at 7:54
• @Bernhard in that case you can use \ifx#20 (note: no space between #2 and 0). Not so clean but it does not require #2 to be a numerical expression like \ifnum. May 20 '20 at 8:15
• I'd welcome a pull request on moderntimeline to change this behavior! May 21 '20 at 20:44
• @ℝaphink I would be happy to do that, but I feel my code would need some rewriting to fit better in the design and style of the existing codebase, don't you agree? I just wrote it like this to get the minimum amount of changes to enable the required behavior in the question, so that the answer would be easy to understand, but it is maybe not 'production ready'. May 22 '20 at 7:12