LaTeX Awesome CV - 条目后留有空格

LaTeX Awesome CV - 条目后留有空格

在此处输入图片描述 在此处输入图片描述

对于某些部分,我不想添加项目符号/描述,但是无论填写了项目符号或描述,都会自动生成一个空格。我想仅在使用项目符号时才生成这个空格。上面的照片显示了我指的额外间距。以前从未使用过 LaTeX,所以这对我来说很陌生。

我认为应该更改的部分的代码来自 awesome-cv.cls 文件,如下所示:

% Define an entry of cv information
% Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>}
\newcommand*{\cventry}[5]{%
\vspace{-2.0mm}
\setlength\tabcolsep{0pt}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
\ifempty{#2#3}
  {\entrypositionstyle{#1} & \entrydatestyle{#4} \\}
  {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
  \entrypositionstyle{#1} & \entrydatestyle{#4} \\}
\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}}
\end{tabular*}%
}

完整代码如下:

% A4 paper size by default, use 'letterpaper' for US letter
\documentclass[11pt, a4paper]{awesome-cv}

% Configure page margins with geometry
\geometry{left=1.4cm, top=.8cm, right=1.4cm, bottom=1.8cm, footskip=.5cm}

% Specify the location of the included fonts
\fontdir[fonts/]

% Color for highlights
% Awesome Colors: awesome-emerald, awesome-skyblue, awesome-red, awesome-pink, awesome-orange
%                 awesome-nephritis, awesome-concrete, awesome-darknight
\colorlet{awesome}{awesome-darknight}
% Uncomment if you would like to specify your own color
% \definecolor{awesome}{HTML}{CA63A8}

% Colors for text
% Uncomment if you would like to specify your own color
% \definecolor{darktext}{HTML}{414141}
% \definecolor{text}{HTML}{333333}
% \definecolor{graytext}{HTML}{5D5D5D}
% \definecolor{lighttext}{HTML}{999999}

% Set false if you don't want to highlight section with awesome color
\setbool{acvSectionColorHighlight}{false}

% If you would like to change the social information separator from a pipe (|) to something else
\renewcommand{\acvHeaderSocialSep}{\quad\textbar\quad}

\makeatletter
\patchcmd{\@sectioncolor}{\color}{\mdseries\color}{}{}
\makeatother

%-------------------------------------------------------------------------------
%   PERSONAL INFORMATION
%   Comment any of the lines below if they are not required
%-------------------------------------------------------------------------------
% Available options: circle|rectangle,edge/noedge,left/right
% \photo[rectangle,edge,right]{profile}
\name{}{}
% \position{{\enskip\cdotp\enskip}}
\address{}

\mobile{}
\email{}
\homepage{}
% \github{posquit0}
% \linkedin{posquit0}
% \gitlab{gitlab-id}
% \stackoverflow{SO-id}{SO-name}
% \twitter{@twit}
% \skype{skype-id}
% \reddit{reddit-id}
% \extrainfo{extra informations}

% \quote{``Be the change that you want to see in the world."}


%-------------------------------------------------------------------------------
\begin{document}

% Print the header with above personal informations
% Give optional argument to change alignment(C: center, L: left, R: right)
\makecvheader[C]

% Print the footer with 3 arguments(<left>, <center>, <right>)
% Leave any of these blank if they are not needed
%\makecvfooter
% {\today}
% {Claud D. Park~~~·~~~Résumé}
% {\thepage}


%-------------------------------------------------------------------------------
%   CV/RESUME CONTENT
%   Each section is imported separately, open each file in turn to modify content
%-------------------------------------------------------------------------------
%\input{resume/summary.tex}
\input{resume/education.tex}
\input{resume/experience.tex}
\input{resume/projects.tex}
\input{resume/skills.tex}
\input{resume/presentation.tex}



%-------------------------------------------------------------------------------
\end{document}

模板位于此处:https://www.overleaf.com/latex/templates/awesome-cv/dfnvtnhzhhbm

教育部分代码:

\cvsection{Education}


%-------------------------------------------------------------------------------
%   CONTENT
%-------------------------------------------------------------------------------
\begin{cventries}

%---------------------------------------------------------
\cventry
{B.S. in Management Information Systems} % Degree
{Iowa State University} % Institution
{Ames, Iowa} % Location
{August 2014 - May 2018} % Date(s)
{}
%---------------------------------------------------------
\end{cventries}

答案1

您对\cventry定义的搜索是正确的。您遇到的问题基本上是,如果命令的最后一个参数\cventry为空,那么您不希望\multicolumn{...}{...}{...}出现。因此,您需要在其周围包装一个 if-else 语句。

尝试改变原来的:

% Define an entry of cv information
% Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>}
\newcommand*{\cventry}[5]{%
  \vspace{-2.0mm}
  \setlength\tabcolsep{0pt}
  \setlength{\extrarowheight}{0pt}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
    \ifempty{#2#3}
      {\entrypositionstyle{#1} & \entrydatestyle{#4} \\}
      {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
      \entrypositionstyle{#1} & \entrydatestyle{#4} \\}
      \multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}}%
  \end{tabular*}%
}

到:

% Define an entry of cv information
% Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>}
\newcommand*{\cventry}[5]{%
  \vspace{-2.0mm}
  \setlength\tabcolsep{0pt}
  \setlength{\extrarowheight}{0pt}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
    \ifempty{#2#3}
      {\entrypositionstyle{#1} & \entrydatestyle{#4} \\}
      {\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
      \entrypositionstyle{#1} & \entrydatestyle{#4} \\}
    \if\relax\detokenize{#5}\relax\else % THIS LINE ADDED TO CHECK IF LAST ARGUMENT IS EMPTY
        \multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}}% ONLY DO THIS IF #5 IS NOT EMPTY
    \fi % END OF THE IF STATEMENT
  \end{tabular*}%
}

为了便于说明,下面是默认的 Awesome CV,其中 Education 条目重复了两次(第二次包含一个空列表): 默认 Awesome CV 显示 \cventry 为空列表

此图像与上面显示的 if-else 语句完全相同的文档: 添加了 if 语句以删除 Awesome CV 中的空白区域,显示 \cventry 为空列表

编辑:如果一个部分中有多个\cventrys,而中间\cventry没有最后一个参数(即% Description(s) of experience/contributions/knowledge内容),则在此处添加一个空格 或~。类似这样的内容:\cventry{..1st arg..}{..2n arg..}{..3rd arg..}{..4th arg..}{}变成\cventry{..1st arg..}{..2n arg..}{..3rd arg..}{..4th arg..}{ }。这将在两个\cventrys 之间保留足够的空间。

注意:似乎\cventry每个部分的第一个条目 ( ) 后面都有某种类型的悬挂缩进。我没有仔细查看这是从哪里来的。我在这里提到它是因为您可能注意到该部分下的两个条目的左对齐方式不同。这是一个不相关的问题。

相关内容