我正在嘗試組合 multicols 和枚舉環境(或者,multicols 和 enumitem 套件)。基本上,我想在枚舉 multicol 內部時去掉頂部邊距。如下所示的通常設定會失敗。謝謝!
這是我的最小範例:
\documentclass{article}
\usepackage{enumitem}
\usepackage{multicol}
\begin{document}
I can get rid of the margin here:
\begin{enumerate}[topsep=0pt]
\item a
\item b
\end{enumerate}
\vspace{10pt}
but not here
\begin{multicols}{2}
\begin{enumerate}[topsep=0pt]
\item a
\item b
\end{enumerate}
\end{multicols}
\vspace{10pt}
and
\begin{multicols}{2}
[not even like so]
\begin{enumerate}[noitemsep,nolistsep,partopsep=-20pt,topsep=-20pt]
\item a
\item b
\end{enumerate}
\end{multicols}
\end{document}
這是輸出:
答案1
您可以透過以下方式消除它\setlength\multicolsep{0pt}
:
代碼:
\documentclass{article}
\usepackage{enumitem}
\usepackage{multicol}
\begin{document}
I can get rid of the margin here:
\begin{enumerate}[topsep=0pt]
\item a
\item b
\end{enumerate}
\vspace{10pt}
and also here
{\setlength\multicolsep{0pt}%
\begin{multicols}{2}
\begin{enumerate}[topsep=0pt]
\item a
\item b
\end{enumerate}
\end{multicols}}
\vspace{10pt}
and
{\setlength\multicolsep{0pt}%
\begin{multicols}{2}
[also like so]
\begin{enumerate}[noitemsep,nolistsep,partopsep=-20pt,topsep=-20pt]
\item a
\item b
\end{enumerate}
\end{multicols}}
\end{document}