# How to remove vertical space after align inside tabularx?

I want to remove all vertical space below an align environment, but inside a tabularx environment. I tried setting belowdisplayskip and belowdisplayshortskip to 0 (as suggested here), but while this removed some vertical space, the result still looks like this:

What can I do to remove the vertical space directly after the a+b=c equation? The above image has been obtained using the following code:

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\linewidth}{|l|X|}
\hline
some & text
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\begin{align*}
a + b = c
\end{align*}
\\
\hline
* & this row should be directly under the equation with no vertical space in between. \\
\hline
\end{tabularx}

\end{document}


Note that it works fine if...

• I simply remove the equation;
• there is another line of text after the equation in the same table cell;
• or the equation contains a cases environment with at least two lines

... as can be seen in this image:

• What happens, if you set \setlength{\belowdisplayskip}{0pt} to -1em, instead of 0? – gilu May 23 '17 at 7:19
• @gilu Then it looks fine in the first example I've posted, but it ruins the output for the second and third example in my last image (i.e. if the equation is followed by another line of text or contains a cases environment). Ideally, I'd like a solution that works regardless of whether the equation contains cases / is followed by text or not. – vauge May 23 '17 at 7:25

it gets a bit confused over inserted struts....

simplest is probably just to detect this case and back up:

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{tabularx}
\showoutput
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{|l|
>{\setlength{\belowdisplayskip}{0pt}%
\setlength{\belowdisplayshortskip}{0pt}%
}
X
<{\ifhmode\ifnum\prevgraf>0 \vskip-\normalbaselineskip \mbox{}\fi\fi}
|}
\hline
some & text
\begin{align*}
a + b = c
\end{align*}
\\
\hline
* & this row should be directly under the equation with no vertical space in between. \\
\hline
\end{tabularx}

\end{document}