如何删除“itemize”或“enumerate”前后的空格?

如何删除“itemize”或“enumerate”前后的空格?

我的代码如下所示。

\textbf{I. Introduction}\\
\hspace*{1em} \textbf {A. Background:}
\begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}
\item[1.] The differences between clear vowels and conversational vowels are widely studies.
\begin{itemize}
\item[a.]Vowel Duration: Clear vowels are generally longer than conversational vowels
\item[b.] Dynamic Formant Movement: Clear vowels exhibit greater movement than naturally produced vowels.
\end{itemize}
\end{itemize}
abcccccccccccccdfdfadsdfasdfsfssfdsdfsfa

结果如下。我只想删除项目前后的空格。我已经将长度设置为0pt,但它不起作用。我的代码有问题吗?非常感谢!! 在此处输入图片描述

答案1

正如@Bernard 在评论中建议的那样,您可能需要加载枚举项包,从环境切换itemize到环境,并使用选项enumerate启动两个环境。enumeratenosep

以下屏幕截图显示了您的原始代码和实现上述建议的代码的输出。

在此处输入图片描述

\documentclass{article}
\usepackage{enumitem}
\setlength\parindent{0pt}
\begin{document}
% Before:
\hrule
\textbf{I. Introduction}

\hspace*{1em}\textbf {A. Background:}
\begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}
\item[1.] The differences between clear vowels and conversational 
          vowels are widely studies.
\begin{itemize}
\item[a.]Vowel Duration: Clear vowels are generally longer than 
         conversational vowels
\item[b.] Dynamic Formant Movement: Clear vowels exhibit greater 
         movement than naturally produced vowels.
\end{itemize}
\end{itemize}
\hrule
% After:
\textbf{I. Introduction}

\hspace*{1em}\textbf{A. Background:}
\begin{enumerate}[nosep,label=\arabic*.]
\item The differences between clear vowels and conversational 
      vowels are widely studies.
   \begin{enumerate}[nosep,label=\alph*.]
   \item Vowel Duration: Clear vowels are generally longer than 
         conversational vowels
   \item Dynamic Formant Movement: Clear vowels exhibit greater 
         movement than naturally produced vowels.
   \end{enumerate}
\end{enumerate}
\hrule
\end{document}

相关内容