这enumitem
包装文档说:
\topsep
,,,?\itemsep
\partopsep
\parsep
好吧,它并没有完全说明这一点,但它也没有说明这些维度的含义。我可以得到一个图表来说明每个维度的含义吗? 相当于什么\bottomsep
?
答案1
答案2
好的,既然您用图片提问,我就用一张图片(或多或少)来回答。
概括
\itemsep
= 列表中每个项目后面添加的垂直空间。\parsep
= 列表中的每个段落后添加的垂直空间。\topsep
= 在列表上方和下方添加的垂直空间。\partopsep
= 在列表上方和下方添加垂直空间,但仅当列表开始新段落时。
示例文档
\documentclass[]{article}
\usepackage[margin=1in]{geometry}
\parindent=0pt
\usepackage{enumitem}
\usepackage{fancyvrb}
\DefineShortVerb{\|}
\newcommand{\longline}{This is a line of text that will form a paragraph which we can use in various places.\par}
\newcommand{\printvalues}{topsep=\the\topsep; itemsep=\the\itemsep; parsep=\the\parsep; partopsep=\the\partopsep}
\begin{document}
\hrulefill
\begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
\item\printvalues
\item With all |*sep| values set to 0pt there is no space above or below the enumeration nor between the items or paragraphs within the items.
\item\longline
\end{enumerate}
\hrulefill\par
\hrulefill
\begin{enumerate}[topsep=0pt,itemsep=20pt,parsep=0pt,partopsep=0pt]
\item\printvalues
\item When we set |\itemsep| then this much space is placed between items but no space between paragraphs within an item.
\item\longline\longline
\end{enumerate}
\hrulefill\par
\hrulefill
\begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=20pt,partopsep=0pt]
\item\printvalues
\item When we set |\parsep| then this much space is placed after every paragraph within an item. This will effectively also separate items too, since each single paragraph item will have the |\parsep| space after it.
\item\longline\longline
\end{enumerate}
\hrulefill\par
\hrulefill
\begin{enumerate}[topsep=20pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
\item\printvalues
\item When we set |\topsep| this much space is placed above and below the enumeration.
\end{enumerate}
\hrulefill
\begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=20pt]
\item\printvalues
\item When we set |\partopsep| this much space will be placed before and after a list only if the list is preceded by a |\par| (i.e., starts a new paragraph)
\item This enumerate is not preceded by a |\par| so no space is added.
\end{enumerate}
\hrulefill\par
\hrulefill\par
\begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=20pt]
\item\printvalues
\item When we set |\partopsep| this much space will be placed before and after a list only if the list is preceded by a |\par| (i.e., starts a new paragraph)
\item This enumerate is preceded by a |\par| so space is added.
\end{enumerate}
\hrulefill
\end{document}