现代时间轴上的年份位置

现代时间轴上的年份位置

在此示例中,

2012

似乎比

2010

是。

2012

移向酒吧,这样

2012

2010

与蓝色条等距吗?

在此处输入图片描述

这是我的 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}

答案1

如果您想将“2012”稍微向下移动,您可以重新定义\tltextend为(添加1ptbelow):

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

完成 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} 

结果:

在此处输入图片描述

相关内容