The best I could come up with from various information I found was to introduce a new macro (\Xwdth
) to pre-compute the size, taking into account additional width variables. Then I created a multicolumn wrapper \multiX
for convenience.
\documentclass{article}\usepackage{tabularx}\begin{document}\pagestyle{empty}\newcommand{\Xwdth}[1]{\dimexpr#1\hsize+#1\tabcolsep+#1\tabcolsep+#1\arrayrulewidth-2\tabcolsep-\arrayrulewidth\relax}\newcommand{\multiX}[2]{\multicolumn{#1}{>{\hsize=\Xwdth{#1}}X}{#2}}\newcommand{\multiXr}[2][1]{\multicolumn{#1}{>{\hsize=\Xwdth{#1}\raggedright\arraybackslash}X}{#2}}\newcommand{\sbl}{\tiny Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdiet mi nec ante.}\begin{tabularx}{0.95\textwidth}{X|X|X|X|X} \hline c\hfill 1 & c\hfill 2 & c\hfill 3 & c\hfill 4 & c\hfill 5\\\hline c\hfill 1 & c\hfill 2 & c\hfill 3 & c\hfill 4 & \sbl\\\hline c\hfill 1 & c\hfill 2 & c\hfill 3 & c\hfill 4 & \multiX{1}{\sbl}\\\hline c\hfill 1 & c\hfill 2 & c\hfill 3 & \multiX{2}{\sbl}\\\hline c\hfill 1 & c\hfill 2 & \multiX{3}{\sbl}\\\hline c\hfill 1 & \multiX{4}{\sbl}\\\hline \multiX{5}{\sbl}\\\hline\end{tabularx}\end{document}