How to fix an odd interaction between the tabularx and ntheorem packages?

After posting this answer to the query How to increase the width of one column and decrease the width of the other one by the same length?, I thought about how to generalize (and simplify) the OP's setting, e.g., by using explicit theorem-like environments in the two columns.

In the following MWE, which employs the tabularx and amsthm packages, things work fine. (The framelines in the screenshot indicate the edges of the text block.) In the first tabularx environment, the first column is narrower than the second, and in the second tabularx environment, the situation is reversed. In both environments, the filler text that makes up the body of the "theorems" occupies the full width of the cell:

\documentclass{article}
\usepackage[a4paper,margin=2.5cm,showframe]{geometry}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\hsize=#1\hsize}X}
\usepackage{lipsum}

\usepackage{amsthm}
%\usepackage{ntheorem}

\newtheorem{theorem}{Theorem}

\begin{document}
\noindent % First column is narrower than second:
\begin{tabularx}{\textwidth}{@{} L{0.8} | L{1.2} @{}}
\begin{theorem} \lipsum*[2] \end{theorem} &
\begin{theorem} \lipsum*[2] \end{theorem}
\end{tabularx}

\bigskip\noindent % Now, first column is wider:
\begin{tabularx}{\textwidth}{@{} L{1.2} | L{0.8} @{}}
\begin{theorem} \lipsum*[2] \end{theorem} &
\begin{theorem} \lipsum*[2] \end{theorem}
\end{tabularx}
\end{document}


However, if I comment out the instruction \usepackage{amsthm} and activate the instruction \usepackage{ntheorem} in the preceding MWE (and leave everything else unchanged), I get a rather different result: In the first tabularx environment, the text in the right-hand cell does not occupy the available horizontal space; in the second tabularx environment, both columns now take up the same width even as the width of the text in both cells is restricted to that of the second column.

Question: Have I encountered a bug in either ntheorem or tabularx, or did I set up the mechanism for generating X columns of varying widths incorrectly?

Some background information: The issue occurs with both TeXLive2019 and the current pre-release version of TeXLive2020. I use tabularx 2020/01/15 v2.11c, amsthm 2017/10/31 v2.20.4, and ntheorem Version 1.33 <2011/08/15>. AFAICT, the issue appears to be independent of the choice of document class.

• It obviously can't be a bug in tabularx. let me look.... – David Carlisle Mar 14 at 20:15

Recent (since 2017) versions of the tabularx manual have documented that setting \hsize isn't enough if you need to embed latex list environments (including trivlists like theorems), you need to set \linewidth to match.

using

\usepackage{tabularx}
\newcolumntype{L}[1]{>{\hsize=#1\hsize\linewidth=\hsize}X}
\usepackage{lipsum}

%\usepackage{amsthm}
\usepackage{ntheorem}

• And I must confess to not having looked closely at the user guide of the tabularx package in a while. I just noticed that the 2020/01/15 version of the package's user guide explicitly recommends >{\hsize=#1\hsize\linewidth=\hsize}X -- and not just >{\hsize=#1\hsize}X as I seem to have remembered from earlier versions. – Mico Mar 14 at 21:14
• @Mico oh b@@@r and you almost made me admit to an error in the doc (I did not of course actually look at the doc just now:-) – David Carlisle Mar 14 at 21:37
• @Mico tools changes.txt says 2017-09-28 David Carlisle <latex-bugs@latex-project.org> * tabularx.dtx: set \linewidth as well as \hsize in the column widths documentation. I shall edit the answer to say it is user error not a failing in the doc! – David Carlisle Mar 14 at 21:39
• Well, I've gone ahead and modified/corrected about a dozen answers from the past year or so which used only \hsize=#1\hsize but not \linewidth=\hsize} as well. – Mico Mar 14 at 21:53