I want the the following table to be perfectly centered within the margin, with an approximately even spacing between each column.
\documentclass[a4paper,11pt]{article}
\usepackage{color,amsmath,amsfonts,amssymb}
\usepackage[english]{babel}
\usepackage{colortbl}
\usepackage{booktabs,dcolumn,caption}
\usepackage{expdlist} %expanded list environment
\usepackage{longtable} %multipage table
\usepackage{setspace} %for \singlespacing
\usepackage{adjustbox} %center tables
\usepackage{icomma}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\setstretch{1}
\captionsetup{labelsep=newline,singlelinecheck=false} % optional
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\setlength{\LTleft}{0pt}
\setlength{\LTright}{0pt} %full margins
\oddsidemargin 0.5cm %
\evensidemargin 0.5cm %
\textwidth 15cm %
\topmargin -0.2in %
\textheight 23.5cm %
\headheight 15pt %
\doublerulesep2pt
\begin{document}
\footnotesize
\begin{longtable}{@{} l @{\extracolsep{\fill}} *{2}{d{5}} @{}}
\caption{Pearson correlations} \\
\toprule
& \multicolumn{1}{l}{$(del1,del2)$}
& \multicolumn{1}{l}{$(del1,del3)$} \\
\midrule
\endfirsthead
\multicolumn{2}{@{}l}{\emph{(continued)}} \\
\toprule
& \multicolumn{1}{l}{$(del1,del2)$}
& \multicolumn{1}{l}{$(del1,del3)$} \\
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{3}{r@{}}{\emph{(continued)}}
\endfoot
\bottomrule
\endlastfoot
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
Hello & -0.032(Q>0.671) & 0.036(Q>0.620) \\
\end{longtable}
%\vspace{-0.8cm}
{\noindent ....}
\clearpage
\end{document}
Best Answer
I'm not totally clear on what is required. It looks like you have four data columns: two of the data itself and two of some form of error (or similar). I'd therefore use that structure, with the repeated part using
@
from thearray
package:For the first data column, I've reserved space for two 'digits' before the decimal marker to allow for the negative sign. The other spacings are easy: simply the number of actual digits.