表格中的 Compactitem 在环境之后产生额外的垂直空间

表格中的 Compactitem 在环境之后产生额外的垂直空间

如果我在 tabular(x) 中使用 compactitem,列表环境前后会有垂直空格。我该如何删除该空格?

\documentclass[11pt, a4paper]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage{paralist, tabularx}

\begin{document}

\begin{compactitem}
\item Item 1
\item Item 2
\end{compactitem}
    There is no verstical space after the compactitem-environment.



\bigskip
\begin{tabularx}{\textwidth}{l X}
\hline
a & b\\
a &     \begin{compactitem}
\item Item 1
\item Item 2
\end{compactitem}\\
a& \dots but in the tabular, there \emph{is} vertical space after and before the einvironment!\\
\hline
\end{tabularx}

\end{document}

答案1

\documentclass[11pt, a4paper]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage{paralist, tabularx}
\makeatletter
\renewcommand\tabularxcolumn[1]{>{\@minipagetrue}p{#1}}
\makeatother
\begin{document}

\begin{tabularx}{\textwidth}{l X}\hline
a & b\\
a &     \begin{compactitem}
\item Item 1
\item Item 2
\end{compactitem}\\[-\normalbaselineskip]
a& \dots but in the tabular, there \emph{is} vertical space after and before the einvironment!\\
\hline
\end{tabularx}

\end{document}

在此处输入图片描述

相关内容