这是我的桌子:
\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}
输出如下:
我想减小第一列的宽度(从而增加第二列和第三列的宽度),以便第三列的文本适合一行。
我搜索了很多,但找不到我理解的、对我有用的解决方案。
提前谢谢!
答案1
\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}
您可以dimexp
根据您的数据更改值以匹配 1