2

I made a table with tabularx which has a multicolumn row first followed by 2 rows, which have 2 columns, the first column should have a fixed size (p{7mm}) the second should be X. If I set the size of the first column to 7mm, the second column is not expanded to textwidth. How can I solve this?! enter image description here

 \documentclass[a4paper, 12pt, DIV14, BCOR5mm, toc=listof, toc=bibliography]{scrreprt}
%usepackage
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{xfrac}
\usepackage[fleqn]{amsmath}

\usepackage{calc} 
\begin{document}


\begin{tabularx}{\textwidth}{@{}p{7mm}X@{}}
    \multicolumn{2}{@{}>{\setlength{\hsize}{2\hsize}\addtolength{\hsize}{2\tabcolsep}}X@{}}{Kollagen-I/III-Quotient (Western blot) in Haut und Faszie von Patienten mit Leistenhernien bzw. Narbenhernien. }\\
    a & Leistenherniengewebe (Fascia transversalis, * indirekte Hernie oder direkte Hernie versus Kontrolle, p<0,001; ** indirekte Hernie gegen direkte Hernie, p>0,05).\\
    b & Narbenherniengewebe (Haut, * p<0,01 versus Kontrolle, ** p<0,01 versus stabile Narbe, *** p<0,01 versus Narbenhernie).\\
\end{tabularx} 
\end{document}

1 Answer 1

1

The second argument of the \multicolumn instruction is creating the issue you're looking to fix. Instead of

\multicolumn{2}{@{}>{\setlength{\hsize}{2\hsize}\addtolength{\hsize}{2\tabcolsep}}X@{}}

you should write

\multicolumn{2}{@{} p{\textwidth} @{}}

It's worth keeping in mind that an X column is, for all intents and purposes, a p{<width>} column, where LaTeX is tasked with calculating the value of <width>. If one already knows the intended width (here: \textwidth), there's little point in burdening LaTeX with an additional calculation, right?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .