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.

As you can see from the following MWE, it would be really great to adjust the widths individually for a couple of columns individually. Also how can I decrease the page margins of the table, if the need arises?

\documentclass{article}
%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\begin{document}

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabularx}{\textwidth}{>{\raggedleft\arraybackslash}XXXXX}
    \addlinespace
    \toprule
    \multicolumn{1}{c}{Variable } & Source & Spatial coverage & Temporal coverage & Frequency \\
    \midrule
    Urban Social Disturbances & USDAA, PRIO, Oslo & 55 cities (49 countries) & 1960-2010 & Event-based \\
    Local food prices & FAO GIEWS database  & 43 markets (in common with USDAA) & 1990-Present (unbalanced) & Monthly \\
    Total population & WDI 2010, World Bank & 190 countries & 1960-2011 & Annual \\
    Urban population (as p.c. of total) & WDI 2010, World Bank & 190 countries & 1960-2011 & Annual \\
    Internet penetration & WDI 2010, World Bank & 177 countries & 1960-2011 & Annual \\
    Percapita GDP (constant, 2000 level) & WDI 2010, World Bank & 248 countries & 1960-2011 & Annual \\
    Index of democracy & QoG database, U of Gothenberg & 202 countries & 1960-2011 & Annual \\
    \bottomrule
    \end{tabularx}%
  \label{tab:addlabel}%
\end{table}%


\end{document}
share|improve this question
    
Please indicate which columns' widths you need to adjust. –  Mico May 20 '12 at 10:34
    
@Mico say 1 and 3 –  Abhimanyu Arora May 20 '12 at 10:35

2 Answers 2

up vote 5 down vote accepted

This makes some columns wider than others, makes all columns ragged left or right and makes the table wider than the page. You may want to fiddle with the numbers to get the look you want: enter image description here

\documentclass{article}
%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{calc}
\begin{document}

\begin{table}[htbp]
  \caption{Add caption}
  \noindent\hspace*{-1cm}\begin{tabularx}{\textwidth+2cm}{
>{\raggedleft\arraybackslash\advance\hsize1em}X
>{\raggedright\arraybackslash\advance\hsize1em }X
>{\raggedright\arraybackslash}X
>{\raggedright\arraybackslash\advance\hsize-1em }X
>{\raggedright\arraybackslash\advance\hsize-1em }X
}
    \addlinespace
    \toprule
    \multicolumn{1}{c}{Variable } & Source & Spatial coverage & Temporal coverage & Frequency \\
    \midrule
    Urban Social Disturbances & USDAA, PRIO, Oslo & 55 cities (49 countries) & 1960-2010 & Event-based \\
    Local food prices & FAO GIEWS database  & 43 markets (in common with USDAA) & 1990-Present (unbalanced) & Monthly \\
    Total population & WDI 2010, World Bank & 190 countries & 1960-2011 & Annual \\
    Urban population (as p.c. of total) & WDI 2010, World Bank & 190 countries & 1960-2011 & Annual \\
    Internet penetration & WDI 2010, World Bank & 177 countries & 1960-2011 & Annual \\
    Percapita GDP (constant, 2000 level) & WDI 2010, World Bank & 248 countries & 1960-2011 & Annual \\
    Index of democracy & QoG database, U of Gothenberg & 202 countries & 1960-2011 & Annual \\
    \bottomrule
    \end{tabularx}\hspace*{-1cm}%
  \label{tab:addlabel}%
\end{table}%

\noindent aaa\dotfill aaa


\noindent aaa\dotfill aaa



\end{document}
share|improve this answer

For a more high-level column definition, you could use tabu. The code below makes the first two columns twice as wide as the others. X[3,c] would give you a centered column that is three times the width of a 1-unit-column, the latter being dynamically calculated from the table width (which, as in your example, is \textwidth).

\usepackage{booktabs}
\usepackage{tabu}

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabu} to \textwidth {X[2,l]
                                X[2,l]
                                X[1,l]
                                X[1,l]
                                X[1,l]}
    \addlinespace
    \toprule
    \multicolumn{1}{c}{Variable } & Source & Spatial coverage & Temporal coverage & Frequency \\
    \midrule
    Urban Social Disturbances & USDAA, PRIO, Oslo & 55 cities (49 countries) & 1960-2010 & Event-based \\
    \bottomrule
    \end{tabu}
    \label{tab:addlabel}%
\end{table}%
share|improve this answer

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.