# How to make the table fit into the column?

Hi I have a two columns table with ACM SIG Proceedings template http://www.acm.org/sigs/publications/proceedings-templates

Here is my latex:

\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}%
\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}


The problem is the table length cannot fit into the first columns width as shown as the blue color lines. Is there any way to make the table smaller? In particular, how to make the font smaller(i try \small as shown in code, but I do not know how to deal with equation) and the table spacing smaller (I do not know how to do it)?

-
How about using longtable, booktabs, ragged2e and array. Makes great tables if you compensate for tabcolsep. – 1010011010 May 26 '14 at 0:19

I am not sure what the exact page width of the sig-alternate class is, but from your image this I appeared to be about 5.0in.

By using a p{} column type for the first column, eliminating the column soacing to the left of the first column and to the right of the last column, and reducing the inter column spacing with a @{\hspace{0.5em}} you can sqeeuze your table to make it fit:

## Code:

\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}%
\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}


I downloaded the sig-alternate class (May 2012 version), and both the original and modified table seem to fit fine, so perhaps there are other settings you missed in your MWE:

## Code:

\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}

-
Thanks, it works! One small question, is it possible to make the \min and \max be bolded in this case? – william007 Nov 13 '12 at 8:25
Sure, but that is a totally separate question. You can try How can I get bold math symbols?. If you are unable to achieve the desired result you should post a new question. – Peter Grill Nov 13 '12 at 8:37
Alright, thanks for your answer, I have posted it as a separate question :) – william007 Nov 13 '12 at 9:26
@william007 What is the purpose of making \min and \max bold? IMHO the table will look uglier, if some operators are made bold. – Heiko Oberdiek Nov 13 '12 at 9:49