TransWikia.com

topsep, itemsep, partopsep, parsep - what do they each mean (and what about the bottom)?

TeX - LaTeX Asked on August 9, 2020

The enumitem package documentation says:

topsep, itemsep, partopsep, parsep? Look it up, n00bz. L0L

Ok, it doesn’t quite say that, but it also doesn’t illustrate what these dimensions mean. Can I get a diagram with what each of these means? And what’s the equivalent of bottomsep?

2 Answers

The book by Leslie Lamport, LaTeX: a document preparation system (1994) has a figure like the one you asked for on page 113, which explains, among other things, that the vertical space at the bottom of a list is always the same as the space at the top. The latter depends on the circumstances, namely, on whether the list was or was not started in vertical mode.

This is the corresponding figure in “The LaTeX Companion”

enter image description here

Correct answer by GuM on August 9, 2020

Ok since you've asked the question with a picture, I'll answer with one (more or less).

Summmary

  • itemsep = vertical space added after each item in the list.
  • parsep = vertical space added after each paragraph in the list.
  • topsep = vertical space added above and below the list.
  • partopsep = vertical space added above and below the list, but only if the list starts a new paragraph.

Sample document

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=thetopsep; itemsep=theitemsep; parsep=theparsep; partopsep=thepartopsep}
begin{document}
hrulefill
begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
itemprintvalues
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.
itemlongline
end{enumerate}
hrulefillpar
hrulefill
begin{enumerate}[topsep=0pt,itemsep=20pt,parsep=0pt,partopsep=0pt]
itemprintvalues
item When we set |itemsep| then this much space is placed between items but no space between paragraphs within an item.
itemlonglinelongline
end{enumerate}
hrulefillpar
hrulefill
begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=20pt,partopsep=0pt]
itemprintvalues
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.
itemlonglinelongline
end{enumerate}
hrulefillpar

hrulefill
begin{enumerate}[topsep=20pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
itemprintvalues
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]
itemprintvalues
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}
hrulefillpar
hrulefillpar
begin{enumerate}[topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=20pt]
itemprintvalues
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}

output of code

Answered by Alan Munn on August 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP