在 tabularx 中使用多列

在 tabularx 中使用多列

我正在尝试将宽表格放入我的文档中。我为表格使用了 tabularx 选项。有人能帮我看看如何才能放入这个宽表格吗?

我的表的代码是

\begin{table}[H]

\caption{Work Roll Dimensions \cite{drawingarchive}}

\label{tab:workrolldimension}

\begin{tabularx}{500pt}{|l|l|l|l|l|l|l|l|l|l|}

\hline

\textbf{\begin{tabular}[c]{@{}l@{}}Stand \\ No.\end{tabular}} & \textbf{\begin{tabular}[c]{@{}l@{}}Groove \\ Shape\end{tabular}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Height\\ (Depth)\\ Hg\\ mm\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Groove \\ Angle\\ ag\\ °\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Relief \\ Radius\\ R0\\ mm\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Bottom\\ Radius\\ R1\\ mm\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Bottom\\ Radius \\ R2\\ mm\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Width \\ at \\ collar\\ Wg\\ mm\end{tabular}}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Top \\ Width \\ Wt\\ mm\end{tabular}}} &
\multicolumn{1}{c|}

{\textbf{\begin{tabular}[c]{@{}c@{}}Roll\\ Dia\\ D\\ mm\end{tabular}}}\\ \hline

0  & Box      & 35   & 16.5 & 10 & 20  & -   & 154.09 & 133.35 & 560\\ \hline

1  & Box  Oval & 40   & 19.5 & 10 & 20  & 180 & 108.51 & 85.45 & 530\\ \hline

2  & Oval     & 28.5 & -    & 10 & 130 & -   & -      & -     & 505\\ \hline

3  & Round    & 33   & 60   & 8  & 41  & -   & 85.45  & -      & 460\\ \hline

4  & Oval   & 21.426 & -    & 10 & 71.554 & -  & -  & -         & 460\\ \hline

\end{tabularx}

\end{table}

输出

我需要确保表格适合页面顶部的边缘线。

期望您的支持。

提前致谢

答案1

一些解决方案tabularray

请注意,您不需要添加其他tabular来格式化标题:

\documentclass[a4paper]{book}
\usepackage{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\usepackage{caption}
\usepackage{float}

\begin{document}
\begin{table}[H]\small\centering
\caption{Work Roll Dimensions XXX}\label{tab:workrolldimension}
\begin{tblr}{
    colspec={cX*{8}{c}},
    width=\textwidth,
    row{1}={m, c, font=\bfseries},
    hlines, vlines,
    colsep=4.7pt
    }
{Stand\\ No.} & {Groove \\ Shape} & {Height\\ (Depth)\\ Hg\\ mm} & {Groove \\ Angle\\ ag\\ °} & {Relief \\ Radius\\ R0\\ mm} & {Bottom\\ Radius\\ R1\\ mm} & {Bottom\\ Radius \\ R2\\ mm} & {Width \\ at \\ collar\\ Wg\\ mm} & {Top \\ Width \\ Wt\\ mm} & {Roll\\ Dia\\ D\\ mm}\\ 
0 & Box & 35 & 16.5 & 10 & 20 & - & 154.09 & 133.35 & 560\\ 
1 & Box Oval & 40 & 19.5 & 10 & 20 & 180 & 108.51 & 85.45 & 530\\ 
2 & Oval & 28.5 & - & 10 & 130 & - & - & - & 505\\ 
3 & Round & 33 & 60 & 8 & 41 & - & 85.45 & - & 460\\ 
4 & Oval & 21.426 & - & 10 & 71.554 & - & - & - & 460\\ 
\end{tblr}
\end{table}

Or, more professional, without vertical rules:

\begin{table}[H]\small\centering
\caption{Work Roll Dimensions XXX}\label{tab:workrolldimension}
\begin{tblr}{
    colspec={cX[c]*{8}{c}},
    width=\textwidth,
    row{1}={m, c, font=\bfseries},
    colsep=4.7pt
    }
\toprule
{Stand\\ No.} & {Groove \\ Shape} & {Height\\ (Depth)\\ Hg\\ mm} & {Groove \\ Angle\\ ag\\ °} & {Relief \\ Radius\\ R0\\ mm} & {Bottom\\ Radius\\ R1\\ mm} & {Bottom\\ Radius \\ R2\\ mm} & {Width \\ at \\ collar\\ Wg\\ mm} & {Top \\ Width \\ Wt\\ mm} & {Roll\\ Dia\\ D\\ mm}\\ 
\midrule
0 & Box & 35 & 16.5 & 10 & 20 & - & 154.09 & 133.35 & 560\\ 
1 & Box Oval & 40 & 19.5 & 10 & 20 & 180 & 108.51 & 85.45 & 530\\ 
2 & Oval & 28.5 & - & 10 & 130 & - & - & - & 505\\ 
3 & Round & 33 & 60 & 8 & 41 & - & 85.45 & - & 460\\ 
4 & Oval & 21.426 & - & 10 & 71.554 & - & - & - & 460\\ 
\bottomrule
\end{tblr}
\end{table}
\end{document}

在此处输入图片描述

相关内容