在具有表格环境的环境中对行进行分隔

在具有表格环境的环境中对行进行分隔

我正在尝试使用 awesome-cv (https://github.com/posquit0/Awesome-CV)这是我从 awesome-cv 复制的代码。

\documentclass[12pt]{article}

\usepackage{tabularx}
\usepackage{calc}

\newcommand{\acvSectionContentTopSkip}{5.5mm}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newenvironment{cvinterests}{%
    \vspace{\acvSectionContentTopSkip}
    \vspace{-2mm}
    \begin{center}
        \setlength\tabcolsep{0pt}
        \setlength{\extrarowheight}{0pt}
        \begin{tabular*}{\textwidth}{ C{1cm} L{\textwidth - 1cm} @{\extracolsep{\fill}} }
}{%
        \end{tabular*}
    \end{center}
}
\newcommand*{\cvhighlight}[1]{%
    $\bullet$ & #1\\
}

\begin{document}

Hello.

\begin{cvinterests}

\cvhighlight
    {Avoid the bland phrase responsibilities included. This can sound like a dull job description. Instead, use bullets to describe your activities, accomplishments, and successes.} 

\cvhighlight
    {Avoid the bland phrase responsibilities included. This can sound like a dull job description. Instead, use bullets to describe your activities, accomplishments, and successes.} 

\end{cvinterests}   

\end{document}

通过编译,我发现项目之间的分隔与行分隔相同,这使其很难阅读。

在此处输入图片描述

设置 extrarowheight\setlength{\extrarowheight}{20pt}可以使项目之间分开,但我需要控制行之间的空间。

在此处输入图片描述

\setlength{\baselineskip}{1.5\baselineskip}cvinterests环境中尝试过,但没有变化。如何在具有表格环境的环境中给出行间分隔?

答案1

要调整行间距,可以使用 -command \linespread{factor}。在大多数情况下,这应该在整个文档中保持不变,因此它主要用于序言中。要在其他任何地方使用它,请\selectfont在它之后使用。在下面的示例中,更改仅在您的环境中本地设置。

在您的示例中,可以设置更改项目(或此处的行)之间的间距 \setlength{\extrarowheight}{10pt},也可以在 -macrodefiniton\\[5ex]中使用\cvhighlight,而不仅仅是\\。我认为后者会是一个更好的解决方案,不会影响其他任何东西。

输出

在此处输入图片描述

代码

% tables - Making a separation between items in an environment with a tabular environmen - TeX - LaTeX Stack Exchange
% Url: http://tex.stackexchange.com/questions/326477/making-a-separation-between-items-in-an-environment-with-a-tabular-environmen
% Date: torsdag 25. august 2016 16.12.12


\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage{tabularx}

\newcommand{\acvSectionContentTopSkip}{5.5mm}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newenvironment{cvinterests}{%
    \vspace{\acvSectionContentTopSkip}
    \vspace{-2mm}
    \begin{center}
        \setlength\tabcolsep{0pt}
        \setlength{\extrarowheight}{10pt}
        \linespread{1.2}\selectfont
        \begin{tabular*}{\textwidth}{ C{1cm} L{\textwidth} @{\extracolsep{\fill}} }
}{%
        \end{tabular*}
    \end{center}
}
\newcommand*{\cvhighlight}[1]{%
    $\bullet$ & #1\\% or use \\[5ex]
}

\begin{document}

\section{Text with normal spacing}
\lipsum[1]

\begin{cvinterests}

\cvhighlight{Avoid the bland phrase responsibilities included. This can sound like a dull job description. Instead, use bullets to describe your activities, accomplishments, and successes.}
\cvhighlight{Avoid the bland phrase responsibilities included. This can sound like a dull job description. Instead, use bullets to describe your activities, accomplishments, and successes.}
\cvhighlight{Avoid the bland phrase responsibilities included. This can sound like a dull job description. Instead, use bullets to describe your activities, accomplishments, and successes.}

\end{cvinterests}

\section{Spacing is still normal}
\lipsum[2]


\end{document}

答案2

我不确定为什么要使用tabular*(顺便说一下,列太宽了)。

\documentclass[12pt]{article}
\usepackage{enumitem}

\usepackage{showframe}% just for the example

\newcommand{\acvSectionContentTopSkip}{5.5mm}

\newenvironment{cvinterests}
 {%
  \begin{itemize}[
    leftmargin=*,
    topsep=\acvSectionContentTopSkip,
    itemsep=10pt,
  ]%
 }
 {%
  \end{itemize}
 }
\newcommand*{\cvhighlight}[1]{\item #1}

\begin{document}

\noindent Hello.

\begin{cvinterests}

\cvhighlight{Avoid the bland phrase responsibilities included. This can 
  sound like a dull job description. Instead, use bullets to describe
  your activities, accomplishments, and successes.} 

\cvhighlight{Avoid the bland phrase responsibilities included. This can 
  sound like a dull job description. Instead, use bullets to describe
  your activities, accomplishments, and successes.} 

\end{cvinterests}

\noindent Hello.

\end{document}

在此处输入图片描述

相关内容