I am using trying to use the tabular*
environment to stretch a table to the page width. However the table gets stretched more than the page width defined on the preamble …
Here's my code:
\documentclass[12pt,a4paper]{article}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{natbib}
\usepackage{url}
\usepackage{float}
\usepackage{placeins}
\usepackage[font=small,labelfont=bf,margin=\parindent,tableposition=top]{caption}
\setcounter{MaxMatrixCols}{10}
\addtolength{\oddsidemargin}{-.875in}
\addtolength{\evensidemargin}{-.875in}
\addtolength{\textwidth}{1.75in}
\addtolength{\topmargin}{-.875in}
\addtolength{\textheight}{1.50in}
\parskip = 0pt
\pagestyle{plain}
\setlength{\parskip}{.0in}
\renewcommand{\baselinestretch}{1.3}
\newcommand{\figref}[1]{Figure~\ref{#1}}
\newcommand{\tabref}[1]{Table~\ref{#1}}
\newcommand{\secref}[1]{Section~\ref{#1}}
\newcommand{\eqnref}[1]{equation (\ref{#1})}
\newcommand{\chapref}[1]{Chapter~\ref{#1}}
\newenvironment{Question}[2][Question]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\FloatBarrier
\begin{table}[!htbp]
\centering
\caption{AAAA}
\caption*{AAAA}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{l @{\extracolsep{\fill}} cccccll}
\hline
\hline
\multicolumn{8}{c}{Panel A:} \\ \hline
& $\delta_1$ & t-stat & & $\delta_2$ & t-stat & & $R^2$ \\ \cline{2-3} \cline{5-6} \cline{8-8}
1 & -0.06 & -0.40 & & 0.8 & 16.0 & & 0.05 \\
2 & 0.04 & 0.23 & & 3.3 & 54.3 & & 0.39 \\
3 & 0.03 & 0.19 & & 1.7 & 41.0 & & 0.27 \\
4 & 0.17 & 0.89 & & 2.2 & 36.0 & & 0.22 \\
5 & 0.12 & 0.88 & & 1.2 & 28.0 & & 0.15 \\
6 & 0.02 & 0.13 & & -1.9 & -32.7 & & 0.19 \\
7 & 0.04 & 0.40 & & 0.2 & 5.9 & & 0.01 \\
8 & 0.13 & 0.61 & & 1.9 & 27.2 & & 0.14 \\
9 & -0.02 & -0.22 & & -0.5 & -14.8 & & 0.05 \\
10 & 0.14 & 1.11 & & 0.3 & 6.8 & & 0.01 \\
11 & -0.21 & -1.14 & & 0.5 & 8.7 & & 0.02 \\
12 & -0.22 & -2.16 & & 0.4 & 12.5 & & 0.03 \\ \hline
& \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & & \\
& \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & & \\ \hline
\multicolumn{8}{c}{Panel B:} \\ \hline
& $\delta_1$ & t-stat & & $\delta_2$ & t-stat & & $R^2$ \\ \cline{2-3} \cline{5-6} \cline{8-8}
1 & -0.13 & -0.58 & & 3.83 & 55.00 & & 0.40 \\
2 & -0.02 & -0.17 & & 2.35 & 49.92 & & 0.35 \\
3 & -0.05 & -0.39 & & 1.66 & 40.55 & & 0.26 \\
4 & -0.09 & -1.19 & & 0.79 & 33.25 & & 0.19 \\
5 & 0.00 & 0.13 & & -0.44 & -37.38 & & 0.23 \\ \hline
& \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & & \\
& \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & & \\ \hline
\multicolumn{8}{c}{Panel C:} \\ \hline
& $\delta_1$ & t-stat & & $\delta_2$ & t-stat & & $R^2$ \\ \cline{2-3} \cline{5-6} \cline{8-8}
1 & 0.07 & 0.76 & & -0.91 & -32.58 & & 0.19 \\
2 & 0.04 & 0.61 & & 0.05 & 2.24 & & 0.00 \\
3 & -0.05 & -0.65 & & 0.38 & 14.25 & & 0.04 \\
4 & -0.01 & -0.16 & & 0.69 & 25.03 & & 0.12 \\
5 & -0.10 & -0.60 & & 2.00 & 37.21 & & 0.23 \\ \hline
\end{tabular*}
\label{tab:Reg1}%
\end{table}%
Best Answer
When using the
@{\extracolsep{\fill}}
device, LaTeX sets the width of each intercolumn space to2\tabcolsep+\fill
. The default value of\tabcolsep
, at least in most document classes I'm familiar with, is6pt
.If the "natural" width of the
tabular*
environment, i.e., with\fill=0pt
(note:\fill
can not be negative), exceeds the width of the text block, three possible remedies should be considered:Eliminate the whitespace to the left of the first column and to the right of the final column (total savings:
2\tabcolsep
);Execute the instruction
\setlength\tabcolsep{0pt}
. That way, each intercolumn whitespace is equal to\fill
; andReduce the font size, e.g., by executing an instruction such as
\small
or\footnotesize
.The code below shows the results of using a
tabular*
with 14 instead of "just" 6 data columns to create an example of the table's width exceeding that of the text block. The firsttabular*
environment uses the default value of\tabcolsep
, whereas the second uses\tabcolsep=0pt
.Addendum, posted after the OP augmented his/her posting to show a "real" table: Not sure what your concern is about the tabular material not fitting in the width of the text block. I did notice, though, that the table is too tall to fit into the text block. However, that's because you've changed the lowel-level TeX macro
\baselineskip
. Instead of modifying\baselineskip
directly, I would load thesetstretch
package and issue the command\setstretch{1.3}
; that way, material in footnotes, tables, and arrays will not be stretched vertically.Your table has two unneeded column and a lot of unnecessary statements, c.f., all those
\multicolumn{1}{l}{}
directives. With some clean-up, replacing all\hline
directives with\midrule
s and all\cline
statements with\cmdirule
s, and using thedcolumn
package to align numeric data on the respective decimal markers, one gets: