moderntimeline 上的定制

moderntimeline 上的定制

参照带有现代时间轴的文章,我尝试实现相同的功能。我希望有表格形式的条目: 在此处输入图片描述
像这样(类似结构): 在此处输入图片描述
但是,使用moderntimeline,包。这是我到目前为止所做的。我需要帮助来改进它。

\documentclass{article}
\usepackage[english]{babel}
\usepackage{titlesec}
\usepackage{ifthen}
\usepackage{moderntimeline}

\makeatletter
\colorlet{color0}{blue}
\colorlet{color1}{olive}

\newcommand*{\hintfont}{}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
\newcommand*{\listitemsymbol}{\labelitemi~}
\newcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
\newcommand*{\cvitem}[3][.25em]{%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
      \raggedleft\hintstyle{#2} &{#3}%
  \end{tabular}%
  \par\addvspace{#1}}
\tlmaxdates{2001}{2012}
\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth}
\newlength{\doubleitemmaincolumnwidth}
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}

\setlength{\maincolumnwidth}{\dimexpr\textwidth-\separatorcolumnwidth-\hintscolumnwidth\relax}
\makeatother

\titleformat{\section}
[block]
{\normalfont\bfseries}
{\rule[0ex]{2cm}{4pt}}
{1em}
{}



\begin{document}
\section{EDUCATIONAL QUALIFICATION}
\tllabelcventry[blue]{2011}{2015}{2011}
{B.Tech.}{Computer Science and Engineering}
{Pondicherry Engineering College}{}{Aggregate CGPA 8.5}
\tldatelabelcventry[blue!70!black]{2011}{2011}{Higher Secondary}{}{Petit Seminar Higher Sec. School}
{92\%}{}{}
\end{document} 

在此处输入图片描述

答案1

以下是一些建议:

  1. 为了保持一致性,请在所有地方使用相同的长度;即,不要在自定义命令中使用固定的、硬编码的规则和间距长度\section,而是使用\hintscolumnwidth\separatorcolumnwidth,如下所示

    \titleformat{\section}
    [block]
    {\normalfont\bfseries}
    {\rule[0ex]{\hintscolumnwidth}{4pt}}
    {\separatorcolumnwidth}
    {}
    
  2. 由于这是 CV,因此全局抑制缩进似乎是合理的(通过设置\parindent0pt);如果不需要这样做,则\par\noindent在不应缩进的元素的定义中使用(\cventry例如)。使用哪个选项将取决于您的实际意图,但我的代码包含两种可能性,因此您可以决定。

  3. 对于时间线,使用声明范围内的年份;我的意思是,在你的代码中你有

    \tlmaxdates{2001}{2012}
    

    因此预期的最大年份是 2012 年,但您在其中一项中使用了 2015 年。在下面的代码中,我将其更改为

    \tlmaxdates{2001}{2015}
    

代码:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{titlesec}
\usepackage{ifthen}
\usepackage{moderntimeline}

%\setlength\parindent{0pt} % to suppress indentation globally

\makeatletter
\colorlet{color0}{blue}
\colorlet{color1}{olive}

\newcommand*{\hintfont}{}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
\newcommand*{\listitemsymbol}{\labelitemi~}
\newcommand*{\cventry}[7][.25em]{%
  \par\noindent% not required if indentation has been suppressed globally
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
\newcommand*{\cvitem}[3][.25em]{%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
      \raggedleft\hintstyle{#2} &{#3}%
  \end{tabular}%
  \par\addvspace{#1}}

\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth}
\newlength{\doubleitemmaincolumnwidth}
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}

\setlength{\maincolumnwidth}{\dimexpr\textwidth-\separatorcolumnwidth-\hintscolumnwidth\relax}
\makeatother

\titleformat{\section}
[block]
{\normalfont\bfseries}
{\rule[0ex]{\hintscolumnwidth}{4pt}}
{\separatorcolumnwidth}
{}

\tlmaxdates{2001}{2015}

\begin{document}

\section{EDUCATIONAL QUALIFICATION}
\tllabelcventry[blue]{2011}{2015}{2011}
{B.Tech.}{Computer Science and Engineering}
{Pondicherry Engineering College}{}{Aggregate CGPA 8.5}
\tldatelabelcventry[blue!70!black]{2011}{2011}{Higher Secondary}{}{Petit Seminar Higher Sec. School}
{92\%}{}{}

\end{document} 

结果:

在此处输入图片描述

更新

在评论中,有人要求使用彩色条的阴影而不是纯色,并将条稍微向左移动;可以使用left colorright colormiddle color键在可选参数中实现标准 TikZ 水平阴影来实现阴影;可以在第一个强制参数中使用较小的值(例如,2010.5或任何其他合适的值)而不是来将条向左移动2011

\documentclass{article}
\usepackage[english]{babel}
\usepackage{titlesec}
\usepackage{ifthen}
\usepackage{moderntimeline}

%\setlength\parindent{0pt} % to suppress indentation globally

\makeatletter
\colorlet{color0}{blue}
\colorlet{color1}{olive}

\newcommand*{\hintfont}{}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
\newcommand*{\listitemsymbol}{\labelitemi~}
\newcommand*{\cventry}[7][.25em]{%
  \par\noindent% not required if indentation has been suppressed globally
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
\newcommand*{\cvitem}[3][.25em]{%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
      \raggedleft\hintstyle{#2} &{#3}%
  \end{tabular}%
  \par\addvspace{#1}}

\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth}
\newlength{\doubleitemmaincolumnwidth}
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}

\setlength{\maincolumnwidth}{\dimexpr\textwidth-\separatorcolumnwidth-\hintscolumnwidth\relax}
\makeatother

\titleformat{\section}
[block]
{\normalfont\bfseries}
{\rule[0ex]{\hintscolumnwidth}{4pt}}
{\separatorcolumnwidth}
{}

\tlmaxdates{2001}{2015}

\begin{document}

\section{EDUCATIONAL QUALIFICATION}
\tllabelcventry[left color=blue,right color=white]{2010.5}{2015}{2011}
{B.Tech.}{Computer Science and Engineering}
{Pondicherry Engineering College}{}{Aggregate CGPA 8.5}
\tldatelabelcventry[blue!70!black]{2011}{2011}{Higher Secondary}{}{Petit Seminar Higher Sec. School}
{92\%}{}{}

\end{document}

在此处输入图片描述

相关内容