1

I am working on producing a good-looking floating enumerate. What still needs to be done is to add booktabs' toprule above the first enumerate's item and booktab's bottomrule below the last enumerate's item. Why do I want that? Because that makes it for the reader more evident that this is not an in-text enumerate. A sketch of my request:

Sketch of my request

Problem: toprule and bottomrule seem to be designed for tabular

Question1: How to do this elegantly for my case? Elegant in end result and elegant in code.
I think the elegance in end results is mainly concerned about
(1) What amount of vertical space between the first item and the toprule? Likewise for last item and bottomrule. Perhaps this should be same amounts as with a table for consistency, perhaps it should be larger because the vertical spaces between enumerate items are larger than the vertical spaces between tabular rows. I am open for design thoughts here.
(2) What amount of vertical space between toprule and the regular text above it? Likewise for bottomrule and the caption below it. My gut feeling says this is not a problem and that it would be the same vertical spaces as with a table. Still, I am not familiar with the intricacies of toprule and bottomrule.

Question2 for bonus points:
I use booktab's toprule and bottomrule for my thesis, but the journal I wish to submit to uses revtex. Revtex again has its own equivalents:

\def\toprule{\hline\hline}%
\def\botrule{\hline\hline}%

If your solution requires tweaking for revtex's toprule and botrule, would you be so kind to show me how?

My current best MWE is:

\documentclass{article}

\usepackage{booktabs}

%For my floating enumerate
\usepackage{trivfloat}
\trivfloat{enum}

\usepackage{enumitem}

\usepackage{calc}
%Allocate several lengths to be used later on
\newlength{\lengtha}
\newlength{\lengthb}
\newlength{\lengthc}

\begin{document}

Some test sentences are written here. Some test sentences are written here. Some test sentences are written here.
%My centered floating enumerate
\setlength{\lengtha}{\widthof{2.} + \labelsep + \widthof{A description of the second step is written here}}
\setlength{\lengthb}{\textwidth-\lengtha}
\setlength{\lengthc}{\lengthb/2}
\begin{enum}[!h]
    \begin{enumerate}[leftmargin=*, label={}, labelwidth=0mm, labelindent=\lengthc]
    \item 1.\hspace{\labelsep}First step in a procedure\\
    A description of the first step is written here
    \item 2.\hspace{\labelsep}Second step in a procedure\\
    A description of the second step is written here
    \item 3.\hspace{\labelsep}Third step in a procedure\\
    A description of the third step is written here
    \end{enumerate}
\caption{My floating enum}
\end{enum}
Some test sentences are written here. Some test sentences are written here. Some test sentences are written here.

\end{document}

1 Answer 1

1

Instead of fitting toprule and bottomrule in an enumerate I opted for a tabular and change its vertical spacing to reflect an enumerate. I produced four results: Four results 1) Regular table with toprule and bottomrule. To compare with.
2) Table with enumerate's itemsep spacing between items.
It looks a bit too crammed, the space between the items and the rules should be larger
3) Floating enumerate with
aboverulesep set to itemsep (normally set to 0.4ex)
aboverulesep set to 0.65/0.4*itemsep (normally set to 0.65ex)
This look good
4) Floating enumerate with
aboverulesep set to topsep (in enumerate is topsep the space between first/last item and surrounding text (under normal conditions))
belowrulesep also set to topsep
Not good, the toprule looks more like a separation rule between two parts instead of belonging to the enumerate.

There's no aboverulesep and belowrulesep for Revtex's toprule and botrule, so I inserted in both cases an itemsep space. See last, commented, version in the following code:

\documentclass{article}

\usepackage{booktabs}

%For my floating enumerate
\usepackage{trivfloat}
\trivfloat{enum}

\usepackage{enumitem}

\usepackage{calc}
%Allocate several lengths to be used later on
\newlength{\lengtha}
\newlength{\lengthb}
\newlength{\lengthc}

%Fit results on one page
\usepackage[top=2cm, bottom=2cm]{geometry}
\begin{document}

\noindent
Regular table.
Some test sentences are written here. Some test sentences are written here.
\begin{table}[!h]
\centering
\begin{tabular}{@{}l@{}}
\toprule
some item is written here\\
some item is written here\\
some item is written here\\
some item is written here\\
\bottomrule
\end{tabular}
\caption{Some caption here.}
\end{table}
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
\\
\\
Table with enumerate spacing between items.
Some test sentences are written here. Some test sentences are written here.
\begin{table}[!h]
\centering
\begin{tabular}{@{}l@{}}
\toprule
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\
\bottomrule
\end{tabular}
\caption{Some caption here.}
\end{table}
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
\\
\\
Enum with enumerate spacing between items and relative itemsep spacing.
\begin{enum}[!h]
\centering
\setlength{\lengtha}{\belowrulesep / \aboverulesep * \itemsep}
\setlength{\belowrulesep}{\lengtha}
\setlength{\aboverulesep}{\itemsep}
\begin{tabular}{@{}l@{}}
\toprule
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\
\bottomrule
\end{tabular}
\caption{Some caption here.}
\end{enum}
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
\\
\\
Enum with enumerate spacing between items and absolute topsep spacing.
Some test sentences are written here. Some test sentences are written here.
\begin{enum}[!h]
\centering
\setlength{\aboverulesep}{\topsep}
\setlength{\belowrulesep}{\topsep}
\begin{tabular}{@{}l@{}}
\toprule
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\[\itemsep]
some item is written here\\
\bottomrule
\end{tabular}
\caption{Some caption here.}
\end{enum}
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
Some test sentences are written here. Some test sentences are written here.
%\\
%\\
%Revtex solution:
% \begin{enum}[!h]
% \centering
% \begin{tabular}{@{}l@{}}
% \toprule
% \noalign{\vskip \itemsep}
% some item is written here\\[\itemsep]
% some item is written here\\[\itemsep]
% some item is written here\\[\itemsep]
% some item is written here\\[\itemsep]
% \botrule
% \end{tabular}
% \caption{Some caption here.}
% \end{enum}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .