LaTeX 如何确定其默认行距/为什么这个新命令的行距因我使用它的地方而异?

LaTeX 如何确定其默认行距/为什么这个新命令的行距因我使用它的地方而异?

我知道如何在 LaTeX 中增加/减少/改变行距,但\vspace{-5pt}每次我想让两行更靠近时,手动设置感觉像是一种黑客行为,如果我首先理解了 LaTeX 为什么要这样做,我想我可以想出一个更好的解决方案。

例如,在构建我的简历时,我有以下新环境来定义章节标题、项目和要点:

% A section:itemized is a main section with a header and some items within it
\newenvironment{section:itemized}[1]{
  {\fontfamily{cmr}\selectfont\Large\scshape#1}
  \begin{itemize}
  }{
  \end{itemize}
}

% Displays info about a job and holds list items describing what  
% projects were completed there
\newenvironment{item:experience:itemized}[4]{
\item[]
  \textbf{\scshape#1},  \hfill \textbf{#2} \\ % Show company and dates
  \textit{\scshape#3}\hfill #4 % Show position and location
  \begin{itemize}
  }{
  \end{itemize}
} 

% This is a project heading and requires list items that can be bullet
% points describing the project
\newenvironment{item:project:itemized}[3]{
  \itemprojectandtech{#1}{#2} \\
  \textit{#3} 
  \begin{itemize}
  }{
  \end{itemize}
}

% An itembulleted is a simple list element
\newcommand{\itembulleted}[1]{
\item \begin{flushleft} #1 \end{flushleft}
}

在我的简历中,我使用section:itemized创建一个“经验”部分。其中有item:experience:itemized项目,它们都包含item:project:itemized有关itembulleted项目的详细信息。在我的简历的其他地方,我使用section:itemized创建一个“其他项目”部分,其中包含包含详细信息project:itemized的项目itembulleted

如果在“其他项目”部分中完成此操作,则每个项目符号之前和之间的行距比在“经验”部分中完成此操作时更宽。

以下是结果的截图: 在此处输入图片描述

以下是示例代码:

\begin{section:itemized}{Experience}
  \begin{item:experience:itemized}{Super Company}{September 2016 - present}{Head of Stuff}{Mytown, USA}

  \begin{item:project:itemized}{Cool Project}{Technology, other technology}{Thing that's going away}
    \itembulleted{Here are a bunch of words that describe this project.}
        \itembulleted{And even more words because it was a really cool project and there are things to say.}
  \end{item:project:itemized}  
  \end{item:experience:itemized}

\end{section:itemized}

%%%%%%%%%%%%%%%%%%%%%%%%
\begin{section:itemized}{Other Projects}

    \begin{item:project:itemized}{Cool Project}{Technology, other technology}{Thing that's going away}
    \itembulleted{Here are a bunch of words that describe this project.}
    \itembulleted{And even more words because it was a really cool project and there are things to say.}
  \end{item:project:itemized}  

答案1

OP 的示例展示了嵌套itemize环境,这意味着\item命令出现在不同的级别上。

环境itemize对于控制线的垂直距离的各个弹性长度具有不同的间距值\item,这些是

  • \topsep
  • \itemsep
  • \parsep
  • \partopsep

\topsep与 一起\partopsep控制\parskip环境顶部和第一个\item内容与环境底部之间的间距,即最后一个非环境内容的最后一行和\item下一个非环境内容的开始。

\itemsep+\parsep`` 负责分隔\item内容的最后一行和下一行\item


这份小文件显示了 的标准值article

\documentclass{article}


\newcommand{\niceintern}[1]{%
  \texttt{#1}: \the\csname #1\endcsname
}
\newcommand{\niceoutput}{%
 \niceintern{itemsep}

 \niceintern{parsep}

 \niceintern{partopsep}

 \niceintern{topsep}
}



\begin{document}

\begin{itemize}

   \item First level 

  \niceoutput
  \begin{itemize}
  \item Second level 

  \niceoutput
    \begin{itemize}
    \item Third level

     \niceoutput

      \begin{itemize}
      \item Fourth level

        \niceoutput

      \end{itemize}
     \end{itemize}
   \end{itemize}
 \end{itemize}

  \end{document}

在此处输入图片描述

相关内容