枚举和紧缩问题

枚举和紧缩问题
\documentclass{article}    
\usepackage[utf8]{inputenc}    
\usepackage{enumitem}    
\usepackage{enumerate}    
\usepackage{paralist} 

\begin{document}    
\begin{enumerate}[label=(\alph*)]    
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{enumerate}

\begin{compactenum}[label=(\alph*)]    
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{compactenum}    
\end{document}

似乎和enumitemenumerate互相paralist矛盾......

我该怎么做才能获得字母编号compactenum......

答案1

您只能使用enumitem使用以下命令将您的自定义列表定义为paralist的变体:compactenumnolistsep

\documentclass{article}    
\usepackage[utf8]{inputenc}    
\usepackage{enumitem}    

\newlist{compactenum}{enumerate}{4}
\setlist[compactenum,1]{nolistsep}

\begin{document}    
\begin{enumerate}[label=(\alph*)]    
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{enumerate}

\begin{compactenum}[label=(\alph*)]    
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{compactenum}    
\end{document}

在此处输入图片描述

该标签可以设为全局的:

\setlist[compactenum,1]{nolistsep,label=(\alph*)}

然后就

\begin{compactenum}
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{compactenum}    

答案2

仅使用enumitem,您现在就可以添加选项nosep,即

\begin{enumerate}[nosep, label=(\alph*)]    
\item an apple    
\item a banana    
\item a carrot    
\item a durian    
\end{enumerate}

Gonzalo Medina 答案中的选项nolistsep现已弃用(请参阅文档)。

相关内容