![moderntimeline - 同一条目,两个时间跨度](https://linux22.com/image/264665/moderntimeline%20-%20%E5%90%8C%E4%B8%80%E6%9D%A1%E7%9B%AE%EF%BC%8C%E4%B8%A4%E4%B8%AA%E6%97%B6%E9%97%B4%E8%B7%A8%E5%BA%A6.png)
我正在使用现代简历与...类现代时间线,现在大部分都看上去非常漂亮。
但是,我之前的一个职位我担任过两次,中间有一年的休息时间。目前我只有一项工作从 2003 年到 2007 年,而上面的一项工作从 2005 年到 2006 年。如果我可以将此排版为此项工作时间线条目中的“间隙”,与代表我在休息期间所做工作的矩形相匹配,那就太好了。
(如果我的意思不清楚,请告诉我,我会尝试生成一些图像......)
梅威瑟:
以下是当前的示例:
我想要的是在较长的条形图中有一个“间隙”,与其上方的较短的条形图相匹配,这样时间线就会显示我做了一件事,然后做了另一件事,然后“跳回”第一件事情,而不是在一段时间内同时做两件事。
MWE 的代码:
\documentclass[a4paper]{moderncv}
\moderncvtheme{classic}
\usepackage{moderntimeline}
\usepackage{lipsum}
\firstname{John}
\familyname{Doe}
\tlmaxdates{2005}{2015}
\begin{document}
\thispagestyle{empty}
\tlcventry{2010}{2011}{Position 2}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\tlcventry{2007}{2013}{Position 1}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\end{document}
答案1
如果我理解正确的话,下面的代码可以实现你想要的效果:新定义的\gaptlcventry
命令以类似的方式运行,\tlcventry
但在时间轴上留下了空白;新命令有九个强制参数(如果您想保留第一个可选参数,如\tlcventry
,则还需要做更多的工作):
\gaptlcventry{1999}{2003}{2010}{2022}{WYSIWYG User}{Unnamed Company}
{Somewhere}{}{Tried hard to typeset documents}
上面的例子将给出 2003 年和 2010 年之间的差距。完整的例子:
\documentclass[a4paper]{moderncv}
\moderncvtheme{classic}
\usepackage{moderntimeline}
\usepackage{lipsum}
\firstname{John}
\familyname{Doe}
\tlmaxdates{2005}{2015}
\makeatletter
\newcommand{\gaptlcventry}[9]{%
\pgfmathsetmacro\tl@endyear{ifthenelse(#4==0,\tl@lastyear,#4)}%
\pgfmathsetmacro\tl@startfraction{(#1-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
\pgfmathsetmacro\tl@endfraction{(#2-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%
%
\pgfmathsetmacro\tl@startsfraction{(#3-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%new
\pgfmathsetmacro\tl@endsfraction{(#4-\tl@firstyear)/(\tl@lastyear-\tl@firstyear)}%new
%
\pgfmathsetlength{\pgf@xa}{#4}%
\ifdim\pgf@xa=0pt
\def\tl@startlabel{\tl@since #1}
\def\tl@startslabel{\tl@since #3}%new
\else
\def\tl@startlabel{#1}
\def\tl@startslabel{#3}%new
\fi
\cventry{\tikz[baseline=0pt]{
\useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidth,\tl@runningwidth);
\fill [color1] (0,0)
++(\tl@startfraction*\hintscolumnwidth,0pt)
node [tl@startyear] {\tl@startlabel}
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width-1pt)
node [tl@endyear] {\pgfmathparse{ifthenelse(#2==0,,#2)}\pgfmathresult}
(\hintscolumnwidth,0pt) ;
%%new
\fill [color1] (0,0)
++(\tl@startsfraction*\hintscolumnwidth,0pt)
node [tl@startyear] {\tl@startslabel}
rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width-1pt)
node [tl@endyear] {\pgfmathparse{ifthenelse(#4==0,,#4)}\pgfmathresult}
(\hintscolumnwidth,0pt) ;
%%endnew
\pgfmathsetlength{\pgf@xa}{#4}
\ifdim\pgf@xa=0pt
\shade [left color=color1] (\tl@startfraction*\hintscolumnwidth,0)
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
%%new
\shade [left color=color1] (\tl@startsfraction*\hintscolumnwidth,0)
rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width);
%%endnew
\else
\fill [color1] (\tl@startfraction*\hintscolumnwidth,0)
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
%%new
\fill [color1] (\tl@startsfraction*\hintscolumnwidth,0)
rectangle (\tl@endsfraction*\hintscolumnwidth,\tl@width);
%%endnew
\fi
}%
}%
{#5}{#6}{#7}{#8}{#9}%
}
\makeatother
\begin{document}
\thispagestyle{empty}
\tlcventry{2010}{2011}{Position 2}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2007}{2010}{2011}{2013}{Position 1}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\tlcventry{2008}{2013}{Position 3}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2006}{2008}{2013}{2014}{Position 4}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\end{document}
答案2
@GonzaloMedina 的出色回答帮助我设计了自己的简历moderntimeline
。然而,虽然它仍然运行良好,但与此同时,该软件包也进行了一些更新,尤其是一个不错的机制,不仅可以考虑年份,还可以考虑月份来计算时间轴栏。由于这个功能在已经给出的答案中缺失,我将其调整为 a) 使用当前功能moderntimeline
来处理日期和 b) 接受任意数量的时间段(尽管由于空间太小,两个以上的时间段通常会互相干扰)。我认为如果其他人正在寻找这种“间隙”简历条目,这可能会很有用,这就是我写这个答案的原因。
我的版本的界面\gaptlcventry
与@GonzaloMedina 提供的界面略有不同:我的界面有 8 个参数,第一个是可选的颜色选择,在moderntimeline
的原始命令中也有。第二个和第三个参数分别采用时间段的开始和结束年份列表,例如,{2009, 2013}
对于第二个参数和{2010, 2015}
第三个参数,将给出两个时间段 2009-2010 和 2013-2015。
\documentclass[a4paper]{moderncv}
\moderncvtheme{classic}
\usepackage{moderntimeline}
\usepackage{lipsum}
\firstname{John}
\familyname{Doe}
\tlmaxdates{2005}{2015}
\makeatletter
\newcommand{\gaptlcventry}[8][color1]{%
\cventry{\tikz[baseline=0pt]{
\useasboundingbox (0,-1.5ex) rectangle (\hintscolumnwidth,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidth,\tl@runningwidth);
\foreach \start [count=\c] in {#2}
\foreach \end [count=\d] in {#3}
{\ifnum\c=\d
\tl@formatendyear{\end}
\tl@formatstartyear{\start}
\fill [fill=none, #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) ;
\ifissince
\newdimen\fullcolorwidth
\pgfmathsetlength\fullcolorwidth{\tl@startfraction*(1+(1-\tl@startfraction)*\tl@nsfrac)*\hintscolumnwidth}
\fill [color=#1] (\tl@startfraction*\hintscolumnwidth,0)
rectangle (\fullcolorwidth,\tl@width);
\shade [left color=#1] (\fullcolorwidth,0)
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
\else
\fill [color=#1] (\tl@startfraction*\hintscolumnwidth,0)
rectangle (\tl@endfraction*\hintscolumnwidth,\tl@width);
\fi
\fi
}
}%
}%
{#4}{#5}{#6}{#7}{#8}%
}
\makeatother
\begin{document}
\thispagestyle{empty}
\tlcventry{2010}{2011}{Position 2}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2006/1, 2011/5}{2009/4, 2013/1}{Position 1}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\tlcventry{2008}{2013}{Position 3}{Another company}{Somewhere else}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\gaptlcventry{2006, 2013}{2008, 2014}{Position 4}{A Company}{Somewhere}{}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vestibulum tristique porta. Sed quis diam urna. Mauris blandit quam non leo pulvinar quis dapibus diam consectetur. Sed interdum facilisis tellus.}
\end{document}