3

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}
2
  • Please indicate which columns' widths you need to adjust.
    – Mico
    Commented May 20, 2012 at 10:34
  • @Mico say 1 and 3 Commented May 20, 2012 at 10:35

2 Answers 2

7

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .