\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}
似乎和enumitem
和enumerate
互相paralist
矛盾......
我该怎么做才能获得字母编号compactenum
......
答案1
您只能使用enumitem
使用以下命令将您的自定义列表定义为paralist
的变体:compactenum
nolistsep
\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
现已弃用(请参阅文档)。