将表格格式化为两列文章中的列宽

将表格格式化为两列文章中的列宽

快照

我在一篇文章中制作了这些表格,我需要让这些表格的列宽与文章的列宽相同,或者以任何看起来最合适的方式排列。我也不想在行之间放置一个完整的换行符,但如果不这样做,它们就会相互融合。此外,我需要为表格创建一个标题,但标题看起来被挤压了……

    \documentclass[letterpaper]{article}
    \usepackage{aaai}
    \usepackage{times}
    \usepackage{helvet}
    \usepackage{courier}
    \usepackage{graphicx}
    \usepackage{array}
    \newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}
    \graphicspath{ {images/} }
    \frenchspacing
    \setlength{\pdfpagewidth}{8.5in}
    \setlength{\pdfpageheight}{11in}

     \begin{document}
    The random Feature set consists of eleven predictors which were chosen at random from the Sustainability Base Building 232 dataset.
   \begin{table}
\begin{tabular}{c L c}
\hline
Index&Description&Object Type \\\hline\\
A&232 RF1 HWS VALVE 14&Binary Output \\\\
B&232 A1 DX CAP SIGNAL&Analog Output \\\\
C&232 RSB P1 START/STOP&Binary Output\\\\
D&232 CRCP VALVE S28A&Analog Output\\\\
E&232 GWRV LOOPOUT&Analog Value \\\\
F&232 M1 AVG FLOW&Analog Value\\\\
G&232 ZONE N121 N125 AVERAGE TEM&Analog Value \\\\
H&232 S1 DPT AVG C&Analog Value\\\\
I&232 HP3 HEAT STAGE TIMER&Analog Value\\\\
J&232 N1 COOLING OFF&Analog Value\\\\
\hline
\end{tabular}
\end{table}
\begin{table}
\begin{tabular}{c c c c c c c}
\hline
&Min&1st Qu&Median&Mean&3rd Qu&Max \\\hline
&0.00E+00&0.00E+00&0.00E+00&3.83E-01&1.00E+00&1.00E+00 \\\\
&0.00E+00&0.00E+00&0.00E+00&8.84E-01&0.00E+00&5.00E+00 \\\\
&0.00E+00&0.00E+00&0.00E+00&3.83E-01&1.00E+00&1.00E+00  \\\\
&0.00E+00&2.00E-05&1.83E-01&1.19E+01&6.02E-01&1.00E+02  \\\\
&0.00E+00&5.23E-01&7.72E+01&5.16E+01&9.95E+01&1.00E+02 \\\\
&1.49E+03&1.86E+03&1.91E+03&2.09E+03&2.34E+03&3.06E+03  \\\\
&6.69E+01&7.15E+01&7.27E+01&7.30E+01&7.47E+01&7.88E+01  \\\\
&3.00E+01&4.25E+01&4.85E+01&4.76E+01&5.25E+01&5.90E+01  \\\\
&0.00E+00&1.00E+04&1.00E+04&8.12E+03&1.00E+04&1.00E+04  \\\\
&7.30E+01&7.40E+01&7.40E+01&7.40E+01&7.40E+01&7.40E+01  \\\\
\end{tabular}
\end{table}
    \end{document}

答案1

  • 对于第一个表,我建议您使用一个tabularx环境,其中中间列给出列类型的居中版本X。]]
  • 对于第二列,我建议 (a) 使用tabular*环境,(b) 使用数学模式+-符号,(c) 使用指令 将字体大小减小 10% \small,以及 (d) 在指数部分仅显示一位而不是两位数字。 (如果您希望显示两位数指数,则需要使用\footnotesize而不是\small。)
  • 对于这两个表,我建议你不是始终使用额外的空白行。相反,请考虑增加 的值\arraystretch。在下面的示例中,我将\arraystretch两个表的值都设置为 1.65;您可以随意调整此参数以满足您的喜好。

(对于下面的屏幕截图,我[h!]对两个表都使用了定位说明符。在实际文档中,您可能需要删除这些说明符。)

在此处输入图片描述

\documentclass[letterpaper,twocolumn]{article}
    %\usepackage{aaai}  % 
    \usepackage{mathptmx} % Times Roman for text *and* math
    \usepackage[scaled]{helvet}
    \usepackage{courier}
    \frenchspacing
    \usepackage{booktabs,tabularx}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
%    \setlength{\pdfpagewidth}{8.5in}
%    \setlength{\pdfpageheight}{11in}

\begin{document}

The random feature set consists of eleven predictors which were chosen at random from the Sustainability Base Building 232 dataset.

\begin{table}[h!]
\renewcommand\arraystretch{1.65}
\begin{tabularx}{\columnwidth}{@{}cCc@{}}
\toprule
Index&Description&Object Type \\
\midrule
A&232 RF1 HWS VALVE 14&Binary Output \\
B&232 A1 DX CAP SIGNAL&Analog Output \\
C&232 RSB P1 START\slash STOP&Binary Output\\
D&232 CRCP VALVE S28A&Analog Output\\
E&232 GWRV LOOPOUT&Analog Value \\
F&232 M1 AVG FLOW&Analog Value\\
G&232 ZONE N121 N125 AVERAGE TEM&Analog Value \\
H&232 S1 DPT AVG C&Analog Value\\
I&232 HP3 HEAT STAGE TIMER&Analog Value\\
J&232 N1 COOLING OFF&Analog Value\\
\bottomrule
\end{tabularx}
\end{table}

\begin{table}[h!]
\renewcommand\arraystretch{1.65}
\setlength\tabcolsep{0pt}
\small
\begin{tabular*}{\columnwidth}{c @{\extracolsep{\fill}} ccccc}
\toprule
Min&1st Qu&Median&Mean&3rd Qu&Max \\
\midrule
0.00E$+$0&0.00E$+$0&0.00E$+$0&3.83E$-$1&1.00E$+$0&1.00E$+$0  \\
0.00E$+$0&0.00E$+$0&0.00E$+$0&8.84E$-$1&0.00E$+$0&5.00E$+$0  \\
0.00E$+$0&0.00E$+$0&0.00E$+$0&3.83E$-$1&1.00E$+$0&1.00E$+$0  \\
0.00E$+$0&2.00E$-$5&1.83E$-$1&1.19E$+$1&6.02E$-$1&1.00E$+$2  \\
0.00E$+$0&5.23E$-$1&7.72E$+$1&5.16E$+$1&9.95E$+$1&1.00E$+$2  \\
1.49E$+$3&1.86E$+$3&1.91E$+$3&2.09E$+$3&2.34E$+$3&3.06E$+$3  \\
6.69E$+$1&7.15E$+$1&7.27E$+$1&7.30E$+$1&7.47E$+$1&7.88E$+$1  \\
3.00E$+$1&4.25E$+$1&4.85E$+$1&4.76E$+$1&5.25E$+$1&5.90E$+$1  \\
0.00E$+$0&1.00E$+$4&1.00E$+$4&8.12E$+$3&1.00E$+$4&1.00E$+$4  \\
7.30E$+$1&7.40E$+$1&7.40E$+$1&7.40E$+$1&7.40E$+$1&7.40E$+$1  \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}

相关内容