如何让表格适合列?

如何让表格适合列?

你好,我有一张包含 ACM SIG Proceedings 模板的两列表格 http://www.acm.org/sigs/publications/proceedings-templates

这是我的乳胶:

\documentclass{sig-alternate}
\usepackage{ctable}
\begin{document}
\begin{table}[h]
  \centering

    \begin{tabular}{rrrrr}
    \toprule
    \multicolumn{1}{c}{\small{QoS Attribute}} & \small{Sequential} & \small{Parallel} & \small{Loop} & \small{Conditional} \\
    \midrule
    \small{Response Time} & $\sum\limits_{i=1}^n q(s_i)$   & $\max\limits_{i=1}^n q(s_i)$   & k(q(s))   & $\max\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Availablity} & $\prod\limits_{i=1}^n q(s_i)$   & $\prod\limits_{i=1}^n q(s_i)$   & $q(s)^k$   &  $\min\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Throughput} & $\min\limits_{i=1}^n q(s_i)$   & $\min\limits_{i=1}^n q(s_i)$  & $q(s)$  & $\min\limits_{i=1}^n q(s_i)$ \\
    \bottomrule
    \end{tabular}%
\caption{Add caption}
  \label{tab:compositionalStructure}%
\end{table}
This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1

\end{document} 

enter image description here

问题是表格长度无法容纳第一列的宽度,如蓝色线条所示。有什么方法可以让表格变小吗?特别是,如何让字体变小(我\small按照代码所示尝试,但我不知道如何处理方程式)以及如何让表格间距变小(我不知道怎么做)?

答案1

我不确定该sig-alternate课程的确切页面宽度是多少,但从您的图像来看,它大约是 5.0 英寸。

通过对第一列使用一种p{}列类型,消除第一列左侧和最后一列右侧的列,并减少列间间距,@{\hspace{0.5em}}您可以挤压表格以使其适合:

enter image description here

笔记:

代码:

\documentclass{article}
\usepackage{ctable}
\usepackage[paperwidth=5.0in,showframe]{geometry}
\begin{document}
\begin{table}[h]
  \centering

    \begin{tabular}{@{}p{0.7in}r@{\hspace{0.5em}}r@{\hspace{0.5em}}r@{\hspace{0.5em}}r@{}}
    \toprule
    \multicolumn{1}{@{}c}{\small{QoS Attribute}} & \small{Sequential} & \small{Parallel} & \small{Loop} & \small{Conditional} \\
    \midrule
    \small{Response Time} & $\sum\limits_{i=1}^n q(s_i)$   & $\max\limits_{i=1}^n q(s_i)$   & k(q(s))   & $\max\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Availablity} & $\prod\limits_{i=1}^n q(s_i)$   & $\prod\limits_{i=1}^n q(s_i)$   & $q(s)^k$   &  $\min\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Throughput} & $\min\limits_{i=1}^n q(s_i)$   & $\min\limits_{i=1}^n q(s_i)$  & $q(s)$  & $\min\limits_{i=1}^n q(s_i)$ \\
    \bottomrule
    \end{tabular}%
\caption{Add caption}
  \label{tab:compositionalStructure}%
\end{table}
This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1 This is line 1

\end{document} 

我下载了该sig-alternate课程(2012 年 5 月版本),原始表格和修改后的表格似乎都很合适,因此也许您在 MWE 中错过了其他设置:

enter image description here

笔记:

代码:

\documentclass{sig-alternate}
\usepackage{ctable}
\usepackage{showframe}
\begin{document}
\noindent
    \begin{tabular}{rrrrr}
    \toprule
    \multicolumn{1}{c}{\small{QoS Attribute}} & \small{Sequential} & \small{Parallel} & \small{Loop} & \small{Conditional} \\
    \midrule
    \small{Response Time} & $\sum\limits_{i=1}^n q(s_i)$   & $\max\limits_{i=1}^n q(s_i)$   & k(q(s))   & $\max\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Availablity} & $\prod\limits_{i=1}^n q(s_i)$   & $\prod\limits_{i=1}^n q(s_i)$   & $q(s)^k$   &  $\min\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Throughput} & $\min\limits_{i=1}^n q(s_i)$   & $\min\limits_{i=1}^n q(s_i)$  & $q(s)$  & $\min\limits_{i=1}^n q(s_i)$ \\
    \bottomrule
    \end{tabular}%

\bigskip
\noindent
    \begin{tabular}{@{}p{0.7in}r@{\hspace{0.5em}}r@{\hspace{0.5em}}r@{\hspace{0.5em}}r}
    \toprule
    \multicolumn{1}{@{}c}{\small{QoS Attribute}} & \small{Sequential} & \small{Parallel} & \small{Loop} & \small{Conditional} \\
    \midrule
    \small{Response Time} & $\sum\limits_{i=1}^n q(s_i)$   & $\max\limits_{i=1}^n q(s_i)$   & k(q(s))   & $\max\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Availablity} & $\prod\limits_{i=1}^n q(s_i)$   & $\prod\limits_{i=1}^n q(s_i)$   & $q(s)^k$   &  $\min\limits_{i=1}^n q(s_i)$ \\
\midrule
    \small{Throughput} & $\min\limits_{i=1}^n q(s_i)$   & $\min\limits_{i=1}^n q(s_i)$  & $q(s)$  & $\min\limits_{i=1}^n q(s_i)$ \\
    \bottomrule
    \end{tabular}%
\end{document} 

相关内容