# Remove space above itemize list within table environment

I want to include an itemize-list inside a table-environment, in a compact way to save space. However, there is a large gap above the list when in the table, but not when after a paragraph in normal text:

\documentclass[12pt]{scrbook}
\usepackage{paralist}
\usepackage{enumitem} % enumerate?
\usepackage{tabularx}

\begin{document}
some text
\begin{compactitem}  \item  point1  \item point2 \end{compactitem}
\begin{table}[ht!]
\setlength{\leftmargini}{7pt}
\begin{tabularx}{\linewidth}{l | X | X }\hline \hline
& ECB& FED\\ \hline
M1 & \begin{itemize}[noitemsep,topsep=0pt]   \item  point1  \item point2 \end{itemize}
& \begin{compactitem}  \item  point1  \item point2   \end{compactitem}
\end{tabularx}
\end{table}

\end{document}


As you can see, I tested both the compactitem from paralist package, as well as itemize from enumitem with its options [noitemsep,topsep=0pt]. They produce slightly different heights. This works between normal paragraphs, but in the table, it does not. I would want the "point1" to be at the same level as the "M1".

This one, with a slight indent that is visible when there is a line break (the word "Assets" starts a bit further to the right than the word "during"), is the result of

\begin{minipage}[t]{\hsize}\begin{compactitem}
\item Assets can be \textbf{difficult to value} during periods of hyperinflation
\end{compactitem}\end{minipage}


Comparing the two proposed solutions: The following MWE compares the two solutions directly, defining new environments, respectively, named compactitemt and compactitemm.

\documentclass%[12pt,abstracton,titlepage,parskip=false, no, no,twoside=true,open=right]
{scrbook}

%\usepackage{listings}
\usepackage{paralist}
%\usepackage{newtxtext}%antpolt mathpazo %\usepackage{mathptmx} %\usepackage{newtxtext}
\usepackage{enumitem} % enumerate?
\newenvironment{compactitemm}{\begin{minipage}[t]{\hsize}\begin{compactitem}}{\end{compactitem}\end{minipage}} %this solution requires enumitem package
\newenvironment{compactitemt}{\begin{itemize}[nosep, wide=0pt,
%left=0pt %for neat, wide=0pt %for flush left to save space
before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}} ]   }{ \end{itemize} }
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tabularx}

\begin{document}

\begin{table}
\setlength{\leftmargini}{7pt} %this impacts the left margin of itemize package, i.e. stuff 2'' in table. 7pt aligns with the other solution.
\begin{tabularx}{\linewidth}{X | X }\hline
\multicolumn{2}{c}{stuff 1}\\ \hline
\begin{compactitemt}
\item x This line should break and we see where the next begins
\item y
\item z
\end{compactitemt}
& \begin{compactitemt}
\item a This line should break and we see where the next begins
\item b
\end{compactitemt}\\ \hline
\multicolumn{2}{c}{stuff 2}\\ \hline
\begin{compactitemm}
\item x This line should break and we see where the next begins
\item y
\item z This line should break and we see where the next begins
\end{compactitemm}
& \begin{compactitemm}
\item a This line should break and we see where the next begins
\item b
\end{compactitemm}\\ \hline
\end{tabularx}
\caption{MWE}
\end{table}

\end{document}


• If you use the compactitem environment, you need to encase it in \begin{minipage}[t]{\hsize} and \end{minipage} statements.
• If you use an itemize environment along with the enumitem package, you can add the statements

before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}}


to the list of options that go with \begin{itemize}.

\documentclass[12pt]{scrbook}
\usepackage{paralist,enumitem,tabularx}
\begin{document}

\begin{table}[ht!]
\setlength\extrarowheight{2pt} % optional, for a slighly more open "look"
\setlength{\leftmargini}{7pt}
\begin{tabularx}{\linewidth}{l | X | X }
\hline \hline
& ECB & FED\\
\hline
M1 & \begin{itemize}[nosep, left=0pt,
before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}} ]
\item point1
\item point2
\end{itemize}
& \begin{minipage}[t]{\hsize}
\begin{compactitem}
\item point1
\item point2
\end{compactitem}
\end{minipage}\\
\hline
\end{tabularx}
\end{table}

\end{document}

• Thank you. The minipage-solution is ideal, because I can define a new environment at the top of the document and thus easily create itemized lists in all tables! One minor point: when I have a linebreak in an \item, it can be seen that the first line is indented. Can this be fixed? I put a photo in the original question. Mar 21 '20 at 20:49
• @Marie.P. - I'm afraid I'm not sure I understand what you mean by "the first line is indented". To suppress hanging indentation in the itemize environment, just replace left=0pt with wide=0pt.
– Mico
Mar 21 '20 at 22:59
• I edited the question for more clarity. Would you perhaps also have an idea how that works for the compactitem-environment? Mar 22 '20 at 9:05

For the space above, it is enough to make LaTeX believe the cell is a minipage. For this, I borrowed a \compress command found in an answer to a question on this site. For the space below, you have to add a negative \baselineskip at the end.

\documentclass[12pt]{scrbook}
\usepackage{paralist}
\usepackage{enumitem} % enumerate?
\usepackage{tabularx}
\makeatletter
\newcommand{\compress}{\@minipagetrue}
\makeatother

\begin{document}
some text
\begin{compactitem} \item point1 \item point2 \end{compactitem}
\begin{table}[ht!]
\setlength{\leftmargini}{7pt}
\begin{tabularx}{\linewidth}{l | >{\compress}X |>{\compress} X }\hline \hline
& ECB& FED\\ \hline
M1 & \begin{itemize}[nosep, after=\vspace{-\baselineskip}] \item point1 \item point2 \end{itemize}\\
\hline
& & \begin{compactitem} \item point1 \item point2 \end{compactitem}\leavevmode\vspace*{-\baselineskip}
\\
\hline
\end{tabularx}
\end{table}

\end{document}