在乳胶中居中 table,标题位于单元格上方
centre a table in latex with headings above cells
我有一个 table 我希望适合页边距。我还希望将 EPS 和 PPS 都添加到单元格的中间上方,并将这两个输入。我不确定为什么添加标题也不起作用。这是代码:
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
\multicolumn{5}{c}{} \
\hline
&EPS:Pre &EPS:Post &PPS:Pre & PPS:Post \
\hline
Species tested:&13 &15& 43& 43\
Compounds tested:& 745 & 745& 310& 361 \
Unique tests:& 193& 193& 406& 407\
Total experiments:&17,811 &17,929& 107,470& 130,926\
\hline
\end{tabular}
\label{tab}
谢谢。
有几个问题。
您的 table 太大,边距和列间距太大。我做了一个微调列宽的宏。
要重新定义列(例如将 header 居中),您可以使用 `\multicolumn{1}{c}{header}
\label 分配一个在编号环境中使用的数字。它与 table
环境相关,而不是 tabular
。标签出现在 caption
内。此外,table 位于 table 环境的中心。
\documentclass{article}
\begin{document}
\newcommand{\colwidth}{0.17\textwidth}
\newcommand{\centercolumn}[1]{\multicolumn{1}{c|}{#1}}
\begin{table}
\centering
\begin{tabular}{ |p{3cm}||p{\colwidth}|p{\colwidth}|p{\colwidth}|p{\colwidth}| }
% \multicolumn{5}{c}{} \ useless, I think
\hline
&\centercolumn{EPS:Pre} &\centercolumn{EPS:Post} &\centercolumn{PPS:Pre} & \centercolumn{PPS:Post} \
\hline
Species tested:&13 &15& 43& 43\
Compounds tested:& 745 & 745& 310& 361 \
Unique tests:& 193& 193& 406& 407\
Total experiments:&17,811 &17,929& 107,470& 130,926\
\hline
\end{tabular}
\caption{My table}
\label{tab:1}
\end{table}
\end{document}
我有一个 table 我希望适合页边距。我还希望将 EPS 和 PPS 都添加到单元格的中间上方,并将这两个输入。我不确定为什么添加标题也不起作用。这是代码:
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
\multicolumn{5}{c}{} \
\hline
&EPS:Pre &EPS:Post &PPS:Pre & PPS:Post \
\hline
Species tested:&13 &15& 43& 43\
Compounds tested:& 745 & 745& 310& 361 \
Unique tests:& 193& 193& 406& 407\
Total experiments:&17,811 &17,929& 107,470& 130,926\
\hline
\end{tabular}
\label{tab}
谢谢。
有几个问题。
您的 table 太大,边距和列间距太大。我做了一个微调列宽的宏。
要重新定义列(例如将 header 居中),您可以使用 `\multicolumn{1}{c}{header}
\label 分配一个在编号环境中使用的数字。它与
table
环境相关,而不是tabular
。标签出现在caption
内。此外,table 位于 table 环境的中心。
\documentclass{article}
\begin{document}
\newcommand{\colwidth}{0.17\textwidth}
\newcommand{\centercolumn}[1]{\multicolumn{1}{c|}{#1}}
\begin{table}
\centering
\begin{tabular}{ |p{3cm}||p{\colwidth}|p{\colwidth}|p{\colwidth}|p{\colwidth}| }
% \multicolumn{5}{c}{} \ useless, I think
\hline
&\centercolumn{EPS:Pre} &\centercolumn{EPS:Post} &\centercolumn{PPS:Pre} & \centercolumn{PPS:Post} \
\hline
Species tested:&13 &15& 43& 43\
Compounds tested:& 745 & 745& 310& 361 \
Unique tests:& 193& 193& 406& 407\
Total experiments:&17,811 &17,929& 107,470& 130,926\
\hline
\end{tabular}
\caption{My table}
\label{tab:1}
\end{table}
\end{document}