How to change the width of one column in a table

This is my table:

\documentclass{scrbook}
\usepackage{tabularx}
\begin{document}

\renewcommand{\arraystretch}{1.8}   %Presets from my institute
\newcolumntype{M}{X<{\vspace{4pt}}} %Presets from my institute

\begin{table}[!h]
\begin{tabularx}{\textwidth}{| M | M | M |}
\hline
& \textbf{Some text} & \textbf{some text that is too long for this column}\\[-3ex]
\hline
\textbf{text} & a number & a number\\
\hline
\textbf{text} & a number & a number\\
\hline
\textbf{text} & a number & a number\\
\hline
\end{tabularx}
\end{table}

\end{document}


With this output:

I want to decrease the width of the first column (and consequently increase the width of the second and third column) so that the text of the third column fits in one line.

I searched a lot but could not find a solution that I understood and that worked for me.

• Did you already try with "l" instead of the first "M"? Feb 2, 2021 at 11:49
• I would guess columns 1 and 2 should both be l not M (also why the [-3ex] making the rule over-print the text? Feb 2, 2021 at 11:57
• Thanks guys, that actually was the solution. I was so caught up in the issue that I tried a lot of complicated approaches but not the simple one. [-3ex] was there because without it the row was too high. Now with the "l" instead of the "M" in the first column, it works without the [-3ex]. Feb 2, 2021 at 12:56

\documentclass{scrbook}
\usepackage{tabularx}
\begin{document}

\renewcommand{\arraystretch}{1.8}   %Presets from my institute
\newcolumntype{M}{X<{\vspace{4pt}}} %Presets from my institute

\begin{table}[!h]
\begin{tabular}{
|p{\dimexpr.10\linewidth-2\tabcolsep-1.3333\arrayrulewidth}% column 1
|p{\dimexpr.25\linewidth-2\tabcolsep-1.3333\arrayrulewidth}% column 2
|p{\dimexpr.65\linewidth-2\tabcolsep-1.3333\arrayrulewidth}|% column 3
}
\hline
& \textbf{Some text} & \textbf{some text that is too long for this column}\\
\hline
\textbf{text} & a number & a number\\
\hline
\textbf{text} & a number & a number\\
\hline
\textbf{text} & a number & a number\\
\hline
\end{tabular}
\end{table}

\end{document}


You can change the dimexp values to match 1 according to your data

• Thanks a lot. This also solves my problem. I tried that approach before but forgot to change "tabularx" to "tabular" and remove the "{\textwidth}". Therefore it didn't work back then. Feb 2, 2021 at 13:07