Graphics, Figures & Tablesproblem centering a table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sdaza
Posts: 8
Joined: Thu Nov 11, 2010 12:15 am

problem centering a table

Post by sdaza »

Hi everyone,
I have the following table (see example). The problem is that it is located in the middle of a page (vertical and horizontal centering), and I just want it to be located next to the main text and horizontally centered. I don't know what the problem with the code is. I have tried with begin{center}, but just move the tabular area.

\begin{table}[htbp]
\caption{Estimation results c8.2 (i)
\label{c8.2a}}
\centering
\begin{tabular}{lcc} \hline\hline
& (1) & (2) \\
VARIABLES & price & price \\ \hline
& & \\
lotsize & 0.00207*** & 0.00207 \\
& (0.000642) & (0.00125) \\
sqrft & 0.123*** & 0.123*** \\
& (0.0132) & (0.0177) \\
bdrms & 13.85 & 13.85 \\
& (9.010) & (8.479) \\
Constant & -21.77 & -21.77 \\
& (29.48) & (37.14) \\
& & \\
Observations & 88 & 88 \\
R-squared & 0.672 & 0.672 \\ \hline
\multicolumn{3}{c}{ Standard errors in parentheses} \\
\multicolumn{3}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.1} \\
\end{tabular}
\end{table}


Thank you in advance.
Sebastian

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

problem centering a table

Post by localghost »

I can't comprehend the problem. The code below works as expected.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{blindtext}

\begin{document}
  \blindtext
  \begin{table}[!ht]
    \caption{Estimation results c8.2 (i)}\label{c8.2a}
    \centering
    \begin{tabular}{lcc} \hline\hline
      & (1) & (2) \\
      VARIABLES & price & price \\ \hline
      & & \\
      lotsize & 0.00207*** & 0.00207 \\
      & (0.000642) & (0.00125) \\
      sqrft & 0.123*** & 0.123*** \\
      & (0.0132) & (0.0177) \\
      bdrms & 13.85 & 13.85 \\
      & (9.010) & (8.479) \\
      Constant & -21.77 & -21.77 \\
      & (29.48) & (37.14) \\
      & & \\
      Observations & 88 & 88 \\
      R-squared & 0.672 & 0.672 \\ \hline
      \multicolumn{3}{c}{ Standard errors in parentheses} \\
      \multicolumn{3}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.1} \\
    \end{tabular}
  \end{table}
\end{document}
I will spare more suggestions for improvements at this point.

Please use the »Code« environment when posting code.


Thorsten
Post Reply