Graphics, Figures & TablesTable runs off page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daithi81
Posts: 9
Joined: Sat Nov 21, 2009 10:25 pm

Table runs off page

Post by daithi81 »

Hello, I have an issue where my table is spilling off the page by one column. There is plenty of room to the left in the margin for the table if I could get it to position exactly centre in the page. I have tried \centering but it had no effect. The package geometry will affect the whole document, and I don't want that. I just want the table pushed to the left. Any ideas?

Preamble:

Code: Select all

\documentclass{article}

\usepackage{graphicx} 
\usepackage{amsmath}
\usepackage[bottom]{footmisc}
\usepackage{harvard}

\setcounter{secnumdepth}{0}
Table:

Code: Select all

\begin{table}[h]
\centering
\begin{tabular}{l|ccccccccc}
\hline
\hline
 & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\ 
\hline 
Quality of Governance, 2002 & 2.59 & 1.53 & 2.63 & 1.27 & 2.59 & 2.73 & 2.51 & 2.65 & 1.32 \\ 
 & (0.57) & (0.55) & (0.55) & (0.52) & (0.57) & (0.6) & (0.56) & (0.58) & (0.52) \\
\hline
Africa Dummy &  & -0.81 &  & -0.92 &  &  &  &  & -0.96 \\ 
 &  & (0.19) &  & (0.19) &  &  &  &  & (0.2) \\
Asia Dummy &  &  & 0.11 & -0.17 &  &  &  &  & -0.29 \\ 
 &  &  & (0.18) & (0.16) &  &  &  &  & (0.18) \\
Prop of Catholics &  &  &  &  & 0.001 &  &  & 0.001 & 0.0002 \\ 
 &  &  &  &  & (0.02) &  &  & (0.003) & (0.002) \\
Prop of Muslims &  &  &  &  &  & 0.002 &  & 0.002 & 0.003 \\ 
 &  &  &  &  &  & (0.002) &  & (0.003) & (0.003) \\
Prop of Protestants &  &  &  &  &  &  & -0.008 & -0.007 & -0.003 \\ 
 &  &  &  &  &  &  & (0.004) & (0.004) & (0.004) \\ 
$R^2$ & 0.59 & 0.72 & 0.59 & 0.74 & 0.59 & 0.57 & 0.61 & 0.6 & 0.74 \\ 
\hline
\end{tabular}
\caption{Robustness Checks} 
\end{table}

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

daithi81
Posts: 9
Joined: Sat Nov 21, 2009 10:25 pm

Re: Table runs off page

Post by daithi81 »

I thought I found a solution here, but when I tried to install blindtext.sty, it said it was not found. Baffling.

http://texblog.net/latex-archive/layout ... ure-table/
daithi81
Posts: 9
Joined: Sat Nov 21, 2009 10:25 pm

Re: Table runs off page

Post by daithi81 »

I have tried and failed with all of these.

http://www.latex-community.org/forum/vi ... f=5&t=3472
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Table runs off page

Post by localghost »

If you would have read the blindtext manual, you would know what it does and that it is not necessary to translate the given code to your example.

Keeping the width of the table or adjusting the margins is not always the best solution. In many cases there are enough other places left for improvement.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{dcolumn}

\newcolumntype{d}[1]{D{.}{.}{#1}}

\begin{document}
  \begin{table}[!ht]
    \caption{Robustness Checks}
    \centering
%    \small  % Decrease font size (if necessary)
    \begin{tabular}{l|*4{d{1.2}}*5{d{1.3}}}\hline\hline
      & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} & \multicolumn{1}{c}{(5)} & \multicolumn{1}{c}{(6)} & \multicolumn{1}{c}{(7)} & \multicolumn{1}{c}{(8)} & \multicolumn{1}{c}{(9)} \\ \hline
      Quality of Governance, & 2.59 & 1.53 & 2.63 & 1.27 & 2.59 & 2.73 & 2.51 & 2.65 & 1.32 \\
      2002 & (0.57) & (0.55) & (0.55) & (0.52) & (0.57) & (0.6) & (0.56) & (0.58) & (0.52) \\ \hline
      Africa Dummy &  & -0.81 &  & -0.92 &  &  &  &  & -0.96 \\
      &  & (0.19) &  & (0.19) &  &  &  &  & (0.2) \\
      Asia Dummy &  &  & 0.11 & -0.17 &  &  &  &  & -0.29 \\
      &  &  & (0.18) & (0.16) &  &  &  &  & (0.18) \\
      Prop of Catholics &  &  &  &  & 0.001 &  &  & 0.001 & 0.0002 \\
      &  &  &  &  & (0.02) &  &  & (0.003) & (0.002) \\
      Prop of Muslims &  &  &  &  &  & 0.002 &  & 0.002 & 0.003 \\
      &  &  &  &  &  & (0.002) &  & (0.003) & (0.003) \\
      Prop of Protestants &  &  &  &  &  &  & -0.008 & -0.007 & -0.003 \\
      &  &  &  &  &  &  & (0.004) & (0.004) & (0.004) \\
      $R^2$ & 0.59 & 0.72 & 0.59 & 0.74 & 0.59 & 0.57 & 0.61 & 0.6 & 0.74 \\ \hline
   \end{tabular}
  \end{table}
\end{document}
For more information about the involved packages see their manuals on CTAN or on your local machines on the command prompt.

Code: Select all

texdoc dcolumn

Thorsten
Post Reply