Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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)?

share|improve this question
    
How about using longtable, booktabs, ragged2e and array. Makes great tables if you compensate for tabcolsep. –  1010011010 May 26 at 0:19

1 Answer 1

up vote 5 down vote accepted

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:

enter image description here

Notes:

  • The showframe option of the geometry package was used to show the frame. And also adjust the page margins.

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

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:

enter image description here

Notes:

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} 
share|improve this answer
    
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
1  
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
1  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.