In the following table, the numbers take up too much room. I do not want to landscape the table because there are too many rows.
So, I'd like to do both of the following:
- Create more space between some of the columns. Especially if some columns don't require as much width, I'd like to know whether it is better that I manually set this space in order to optimize.
- Shift the table to both the left and right in the process. When I adjust the
\textwidth
, that just moves it to the right. I'd like the table to still remain centered within the page.
I'd like for the contents to be centered within each column as they are with the current code.
I see a similar posting, but I don't know how to incorporate the results and if that is exactly what I'm trying to do:
Adding space between columns in a table
\documentclass[12pt,english]{article}
\usepackage{longtable}
\usepackage{fullpage}
\usepackage{times}
\usepackage[flushleft]{threeparttable}
\usepackage[font=large,labelfont=bf,tableposition=top,textfont=bf]{caption}
\usepackage{tabularx}
\usepackage{booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\clearpage \newpage
\begin{table}[!ht]
\caption{Table Title}
\def\arraystretch{1.05}
\vspace{-0.2cm}
\begin{threeparttable}
\small
\begin{tabularx}{\textwidth}{l*{10}{C}}
\hline \hline \addlinespace
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10) \\
Variable Name & 1234566 & 6543216 & 2233456 & 6655432 & 1830349 & 1234532 & 2532534 & 838285 & 123456 & 1285838 \\
\hline \hline \addlinespace
\end{tabularx}
\begin{tablenotes}
\vspace{0.1cm}
\footnotesize{
\item \noindent \hspace{-1.8mm} Notes:
\noindent Sources:
}
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
Best Answer
Here are my suggestions:
\setlength\tabcolsep{3pt}
to cut the amount of intercolumn whitespace in half. (The default value of this parameter is6pt
.)\small
(immediately after\begin{threeparttable}
) with\footnotesize
. (This also lets you get rid of the subsequent\footnotesize
command.)Eliminate the vertical whitespace before the first column and after the final column by changing the
tabularx
setup as follows:(note the two new
@{}
elements).With these changes, I manage to get the table to fit into the allocated textblock width. My papersize is
US Letter
; if yours isA4
, you'll probably need to reduce thetabcolsep
macro's value further, to2pt
.Separately, since you're already loading the
booktabs
package, why don't you also replace the hideous\hline\hline
commands with\toprule
and\midrule
, respectively. (This also lets you get rid of the\addlinespace
instructions.)Please note that the package
times
is obsolete. I suggest you load the packagemathptmx
instead -- unless you really want to mix Times New Roman as the text font and Computer Modern as the math font...Addendum: On the subject of changing the width of the text block: Have a look at this answer for an example of how one may use the
geometry
package's commands\newgeometry
and\restoregeometry
to achieve this objective.