I customized the \section
command in moderncv
to get a color fade in the section headings. But now this messes up my moderntimeline
and moves the lables of it around. I figured already out that this is due to the \usetikzlibrary{positioning}
. Can some one figure out how to use my customized \section
without affecting the moderntimeline
?
\documentclass{moderncv}
\usepackage[firstyear=2007,lastyear=2015]{moderntimeline}
\usepackage{tikz}
\usetikzlibrary{fadings,patterns,positioning,fit,calc}
\tikzset{
zero sep/.style = {inner sep=0pt, outer sep=0pt},
}
\moderncvstyle{classic}
\makeatletter
\renewcommand\section[1]{%
\par\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#1}%
\pgfmathsetmacro\randref{rand}
\begin{tikzfadingfrompicture}[name=tikzsection \randref]
\node[fill=white,anchor=south east,zero sep,minimum width=5cm,minimum height=2.5mm] (box node){};
\node [text=white,anchor=base west,text depth=5pt,text height=12pt,zero sep,
font=\normalfont\Large\bfseries,right=10pt of box node,
text width=12cm,align=left] (text node) {\strut#1\strut};
\node [fit={(box node)(text node)
},zero sep] (myfit) {};
\path let \p1=(myfit.south west), \p2=(myfit.north east), \n1={\x2-\x1}, \n2={\y2-\y1} in
\pgfextra{\xdef\lenx{\n1} \xdef\leny{\n2}};
\end{tikzfadingfrompicture}
\begin{tikzpicture}[baseline=.5*5pt-.5*12pt]
\path[path fading=tikzsection \randref, fit fading=false,left color=blue, right color=black]
(-.5*\lenx,-.5*\leny) rectangle ++(\lenx,\leny);
\end{tikzpicture}%
\par\nobreak\addvspace{1ex}\@afterheading%
}
\makeatother
\begin{document}
\section{First section}
\tlcventry{2008}{2009}{Student in aerospace engineering}{University of Atlantis}{Atlantis}{}{Majors: Aqua Systems, Fluid Mechanics}
\section{Second muuuuch longer section}
Some text
\section{Short}
Some text
\end{document}