I'm trying to remove the vertical space above/below \itemize lists that appear in a \longtable. That is, I'd like these lists to all align to the top of their cells:
Answers to similar versions of this problem abound (see here, here, and here, for example). All the solutions involve editing the table by hand, adding various \vspace or other commands.
I am generating my table from a Markdown file with pandoc, though, have have no control over the table output, so modifying the resulting table isn't possible. Here's a MWE.
Given this Markdown file:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
: Sample grid table.
+---------------+---------------+--------------------+
| Fruit | Price | Advantages |
+===============+===============+====================+
| Bananas | $1.34 | - built-in wrapper |
| | | - bright color |
+---------------+---------------+--------------------+
| Oranges | $2.10 | - cures scurvy |
| | | - tasty |
+---------------+---------------+--------------------+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
- Don't
- mess
- with
- this
- list
- though
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
… which gets converted to this TeX file with pandoc -s -V documentclass=memoir blah.md -o blah.tex:
\documentclass[]{memoir}
\usepackage{longtable,booktabs}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\begin{longtable}[c]{@{}lll@{}}
\caption{Sample grid table.}\tabularnewline
\toprule
\begin{minipage}[b]{0.20\columnwidth}\raggedright\strut
Fruit
\strut\end{minipage} &
\begin{minipage}[b]{0.20\columnwidth}\raggedright\strut
Price
\strut\end{minipage} &
\begin{minipage}[b]{0.27\columnwidth}\raggedright\strut
Advantages
\strut\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{0.20\columnwidth}\raggedright\strut
Fruit
\strut\end{minipage} &
\begin{minipage}[b]{0.20\columnwidth}\raggedright\strut
Price
\strut\end{minipage} &
\begin{minipage}[b]{0.27\columnwidth}\raggedright\strut
Advantages
\strut\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.20\columnwidth}\raggedright\strut
Bananas
\strut\end{minipage} &
\begin{minipage}[t]{0.20\columnwidth}\raggedright\strut
\$1.34
\strut\end{minipage} &
\begin{minipage}[t]{0.27\columnwidth}\raggedright\strut
\begin{itemize}
\tightlist
\item
built-in wrapper
\item
bright color
\end{itemize}
\strut\end{minipage}\tabularnewline
\begin{minipage}[t]{0.20\columnwidth}\raggedright\strut
Oranges
\strut\end{minipage} &
\begin{minipage}[t]{0.20\columnwidth}\raggedright\strut
\$2.10
\strut\end{minipage} &
\begin{minipage}[t]{0.27\columnwidth}\raggedright\strut
\begin{itemize}
\tightlist
\item
cures scurvy
\item
tasty
\end{itemize}
\strut\end{minipage}\tabularnewline
\bottomrule
\end{longtable}
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
\begin{itemize}
\tightlist
\item
Don't
\item
mess
\item
with
\item
this
\item
list
\item
though
\end{itemize}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
\end{document}
And finally produces this document:
I've found a couple possible solutions, but they don't work—the space remains:
- Put cells inside
minipages and do something with\@minipagetrue, since that should make it soitemizedoesn't add vertical space. Pandoc already wraps each of the cells inside aminipage, but the vertical space still appears. - Use
\package{enumitem}and\setlist[itemize]{noitemsep, topsep=0pt}to globally remove spacing above all lists. However, this is not specific to only lists inside tables (and it doesn't modify this list anyway).
So, in the end, how can I remove the space before and after itemize lists inside minipages that are inside longtables without directly modifying the table itself (i.e. only adding or modifying commands and macros in the preamble)



\strut? Without the struts, the spacing is just fine. – Mico Feb 11 '17 at 08:01