关于 moderncv \tldatelabelcventryn 中的 Moderntimeline 的问题

关于 moderncv \tldatelabelcventryn 中的 Moderntimeline 的问题

xxx的单位是什么?

\tldatelabelcventryn[east][cyan!60!black]{2016.xxx}{xxx}{Test}{Test}{}{}{}

2016 年 1 月 1 日是 2016.0,2016 年 6 月 31 日是 2016.5,对吗?2016.5 与 2016.500 相同吗?

\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=2016,lastyear=2017]{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{}{}  

\begin{document}

\makecvtitle
born on .... in xxxxx

\tldatelabelcventryn[east][cyan!60!black]{2016.0}{0}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.5}{5}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.50}{50}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.549}{549}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.550}{550}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.599}{599}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.999}{999}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2017.0}{0}{Test}{Test}{}{}{}


\end{document}

也可以看看: http://latex.org/forum/viewtopic.php?f=5&t=30249

答案1

嗯,它只是一个十进制数。但你可以这样解释:

\tldatelabelcventryn[east][cyan!60!black]{2017.0}{0}{Test}{Test}{}{}{}

2017或者2017.0是 2017 年 1 月 1 日 2016或者2016.0是 2016 年 1 月 1 日

如果要显示 2016 年 2 月 1 日,请添加1/12=0,08333333332016

\tldatelabelcventryn[east][cyan!60!black]{2016.08333}{Feb}{+1/12}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.41666}{Mai}{+4/12}{Test}{}{}{} 
\tldatelabelcventryn[east][cyan!60!black]{2016.91666}{Dez}{+11/12}{Test}{}{}{}

如果您想解决一个特殊的日子,例如 2016 年 1 月 11 日,您可以进行计算2016 + 10/365 = 2016 + 0,02739等等。

以下 MWE 向您展示了一些计算:

\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=2016,lastyear=2017]{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{}{}  

\begin{document}

\makecvtitle
born on .... in xxxxx

\tldatelabelcventryn[east][cyan!60!black]{2016.0}{0}{Test}{Test}{test}{test}{test}
\tldatelabelcventryn[east][cyan!60!black]{2016.5}{5}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.50}{50}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.549}{549}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.550}{550}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.599}{599}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.999}{999}{Test}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2017.0}{0}{Test}{Test}{}{}{}
% <=====================================================================
\tldatelabelcventryn[east][cyan!60!black]{2016.08333}{Feb}{+1/12}{Test}{}{}{} 
\tldatelabelcventryn[east][cyan!60!black]{2016.16666}{Mar}{+2/12}{Test}{}{}{} 
\tldatelabelcventryn[east][cyan!60!black]{2016.41666}{Mai}{+4/12}{Test}{}{}{} 
\tldatelabelcventryn[east][cyan!60!black]{2016.5}{Juli}{+6/12}{Test}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2016.91666}{Dez}{+11/12}{Test}{}{}{}

\end{document}

得出以下结果:

生成的 pdf

答案2

实际上没有单位。你可以说明年份,然后时间轴会像进度条一样显示该年份的位置。

看看这个例子,会更清楚:

\usepackage[firstyear=2007,lastyear=2017]{moderntimeline}
...
\makecvtitle
The time lines start at 2007 and end at 2017.
\bigskip

\tldatelabelcventryn[east][cyan!60!black]{2007}{Jan 2007}{First job}{Trainee}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2010}{2010}{Employment}{Yay}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2012}{2012}{Promotion}{Yippie}{}{}{}
\tldatelabelcventryn[east][cyan!60!black]{2017}{Dec 2017}{Freelancer}{More money}{}{}{}

简历

这是我在LaTeX 论坛回到你的交叉发布,感谢你问题中的链接。

相关内容