关于moderncv中Moderntimeline的问题

关于moderncv中Moderntimeline的问题

对应于此主题我尝试在简历中创建时间线。我的代码是:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 
\usepackage{xparse}
\usepackage[firstyear=1996,lastyear=2013]{moderntimeline}


% for timeline

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

%
\firstname{C}
\familyname{N}
\title{Curriculum vit\ae{}}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born on .... in xxxxx

\section{school education}
\tlcventry[cyan!60!black]{2000}{2008}{test1}{test}{}{}{grade: 22}
\tlcventry[cyan!60!black]{1996}{2000}{test2}{}{}{}{test}
\section{studies}
\tllabelcventry[cyan!60!black]{2011}{2013}{Oct 01, 2011}{test3}{}{}{}{test}

\tldatelabelcventry[cyan!60!black]{2011}{Apr 06, 2011}{Test4}{}{test}
{test}{}


\tllabelcventry[cyan!60!black]{2009}{2011}{Dec 01,2009--Jan 01,2011}{Test5}{}{}{}{test}


\end{document}

这给出

t1

  1. test1 和 test2 都正常
  2. 我想让 test3 一直持续到今天。这样 2011 年 10 月 1 日就位于这条线下方,一直持续到今天,所以应该是Oct01,2011--today,但这不起作用,而且描述应该是“今天”
  3. 如您所见,Test4(垂直)未居中?粗体 Test4 在灰线下方过多,与之前的情况不同,我怎样才能像以前一样使用它?我还想让“2011 年 4 月 6 日”位于灰线上方。
  4. 测试 5 不起作用。我怎样才能将 2011 年 1 月 1 日显示在灰线上方。

还有一个一般性问题:目前我只指定年份,例如 2009 年,尽管有时我会在标签中添加具体日期。是否可以同时指定月份,以便青色条精确地绘制在这个月和今年,从而在这个非常详细的层面上进行区分?

编辑:

\tllabelcventryn[cyan!60!black]{2000}{2008.583}{2000}{Jul 11, 2008}{Test}{Test}{}{}{grade: 1.8}

给出

t1

但我想将“2008 年 7 月 11 日”向右移动/推,所以像这样(我用油漆做到了):

t2

编辑 2:此外,我想让 2011 年 4 月 6 日采用相同的样式,以便标签不以时间线本身为中心,而是围绕点,使其看起来像:

特

所以它应该与其他的具有相同的对齐方式,总的来说它们应该在同一边界结束,以便它看起来如下所示:

测试1

答案1

一种可能的解决方案(请注意新定义的命令末尾的附加“n”):

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 
\usepackage{xparse}
\usepackage[firstyear=1996,lastyear=2013]{moderntimeline}


% for timeline

\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}
}
\newcommand\tllabelcventryn[9][color1]{%
  \gdef\Argi{#1}%
  \gdef\Argii{#2}%
  \gdef\Argiii{#3}%
  \gdef\Argiv{#4}%
  \gdef\Argv{#5}%
  \gdef\Argvi{#6}%
  \gdef\Argvii{#7}%
  \gdef\Argviii{#8}%
  \gdef\Argix{#9}%
  \auxtllabelcventryn
}
\def\auxtllabelcventryn#1{%
  \gdef\Argx{#1}%
\pgfmathsetmacro\tl@endyear{ifthenelse(\Argiii==0,\tl@lastyear,\Argiii)}
\pgfmathsetmacro\tl@startfraction{(\Argii-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(\tl@endyear-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
 \cventry{\tikz[baseline=0pt]{
     \fill [\tl@runningcolor] (0,0)
        rectangle (\hintscolumnwidth,\tl@runningwidth);
     \useasboundingbox (0,-1.5ex)
        rectangle (\hintscolumnwidth,1ex);
     \fill [\Argi] (0,0)
        ++(\tl@startfraction*\hintscolumnwidth,0pt)
        node [tl@startyear,anchor=north east] {\Argiv} node [tl@startyear,above] {\Argv}
        rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt);
     \pgfmathsetlength{\pgf@xa}{\Argiii} \ifdim\pgf@xa=0pt
        \shade [left color=\Argi] (\tl@startfraction*\hintscolumnwidth,0)
            rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
     \else
        \fill [\Argi] (\tl@startfraction*\hintscolumnwidth,0)
            rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
     \fi
     }
}
{\Argvi}{\Argvii}{\Argviii}{\Argix}{\Argx}%
}
\makeatother
%
\tltextstart[north]{\scriptsize}
\tltextend[south]{\scriptsize}

%
\firstname{C}
\familyname{N}
\title{Curriculum vit\ae{}}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born on .... in xxxxx

\section{school education}
\tlcventry[cyan!60!black]{2000}{2008}{test1}{test}{}{}{grade: 22}
\tlcventry[cyan!60!black]{1996}{2000}{test2}{}{}{}{test}
\section{studies}
\tllabelcventryn[cyan!60!black]{2011}{2013}{Oct 01, 2011}{today}{test3a}{}{}{}{test}

\tllabelcventry[cyan!60!black]{2011}{2013}{Oct 01, 2011--today}{test3b}{}{}{}{test}

\tldatelabelcventryn[east][cyan!60!black]{2011}{Apr 06, 2011}{Test4}{}{test}
{test}{}

\tllabelcventryn[cyan!60!black]{2009}{2011}{Dec 01,2009}{Jan 01,2011}{Test5}{}{}{}{test}


\end{document}

在此处输入图片描述

相关内容