moderncv:使用 tldatelabelcventry 时不需要空格

moderncv:使用 tldatelabelcventry 时不需要空格

当我在简历中使用tldatelabelcventryfrommoderntimeline而不使用第二行时,我得到了不必要的间距(这里是课程 C 和课程 D 之间): 在此处输入图片描述

有没有比使用更好的方法\vspace*{-\baselineskip}?(这并不完美,因为它似乎删除的不只是一行:执行两次并不能达到完美的叠加,而且间距与我用 进行的输入得到的间距并不完全相同\tlcventry

梅威瑟:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[top=1.1cm, bottom=1.1cm, left=2cm, right=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{moderntimeline}
\tlmaxdates{2010}{2021}
\tlrunningcolor{gray}
\firstname{My}
\lastname{Name}
\title{My CV}


\begin{document}
\maketitle

\section{TEACHING EXPERIENCE}
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course A}{University}{Grade}{Teaching assistant}{%
  If you have some text, the spacing is fine\dots
}
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course B}{University}{Grade}{Teaching assistant}{%
  \dots as you can see. But if an entry does not have text on the second line like that:
}
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course C}{University}{Grade}{Teaching assistant}{}
% \vspace*{-\baselineskip} %%% Remove manually the space
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course D}{University}{Grade}{Teaching assistant}{%
  Then there is large spacing, a bit like if an empty line were inserted. For now I add a negative vspace, but it looks quite dirty.
}
\end{document}

答案1

\tldatelabelcventryND添加了没有描述的条目的命令。

在此处输入图片描述

% !TeX TS-program = pdflatex

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[top=1.1cm, bottom=1.1cm, left=2cm, right=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{moderntimeline}
\tlmaxdates{2010}{2021}
\tlrunningcolor{gray}
\firstname{My}
\lastname{Name}
\title{My CV}


\makeatletter
%% Inspired in https://tex.stackexchange.com/questions/456000/moderntimeline-tllabelcventry-without-description-line/456177#456177
\newcommand{\tldatelabelcventryND}[8][color1]{%
    \issincefalse
    \tl@formatstartyear{#2}
    \cventry[-\baselineskip]{\tikz[baseline=0pt]{ % <<<<<<<<< changed from here
        \fill [\tl@runningcolor] (0,0)
        rectangle (\hintscolumnwidth,\tl@runningwidth);
        \useasboundingbox (0,-1.5ex)
        rectangle (\hintscolumnwidth,1ex);   % <<<<<<<<  to here
            \tl@tlcvbar
            \fill [#1] (0,0)
            ++(\tl@startfraction*\hintscolumnwidth,0pt)
            node [tl@startyear] {#3}
            node {$\bullet$};
        }
    }
    {#4}{#5}{#6}{#7}{#8}
}
\makeatother


\begin{document}
\maketitle

\section{TEACHING EXPERIENCE}
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course A}{University}{Grade}{Teaching assistant}{%
If you have some text, the spacing is fine\dots
}
\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course B}{University}{Grade}{Teaching assistant}{%
\dots as you can see. But if an entry does not have text on the second line like that:
}

% entry without description
\tldatelabelcventryND{2021}{\makebox[0pt][r]{Spring 202}1}{Course C}{University}{Grade}{Teaching assistant}{}

\tldatelabelcventry{2021}{\makebox[0pt][r]{Spring 202}1}{Course D}{University}{Grade}{Teaching assistant}{%
Then there is large spacing, a bit like if an empty line were inserted. For now I add a negative vspace, but it looks quite dirty.
}


\end{document}

灵感来自moderntimeline — \tllabelcventry 无描述行

相关内容