I wanted columns that were ragged left as well as pushed up against the left. I achieved this with dummy (Z) columns of 0pt width and multicolumn headers.
However, now I can't add any space between the columns because it messes with the alignment. Even trying to add 0pt of space causes a misalignment. What is going on here?
MWE
\documentclass{report}
\usepackage{inputenc}
\usepackage{array}
\usepackage{booktabs}
\usepackage[singlelinecheck=false]{caption}
\newcommand{\mc}{\multicolumn} % multicolumn is too many letters...
\newcolumntype{Z}{@{}p{0pt}} % dummy column
\begin{document}
% Value column is correctly aligned
\begin{table}[h]
\caption*{\textit{Value} column is correctly aligned}
\begin{tabular}[l]{@{} r@{ }rZ rZ @{}}
\toprule
\mc{3}{@{}l}{Time} & \mc{2}{l@{}}{Value} \\
\midrule
6h & 0m & & -1.1 & \\
19h & 15m & & 26.3 & \\
\bottomrule
\end{tabular}
\end{table}
% With \hskip, Value column is not correctly aligned
\vspace{2em}
\begin{table}[h]
\caption*{\textit{Value} column is not correctly aligned}
\begin{tabular}{@{} r@{ }rZ @{\hskip 20pt} rZ @{}}
\toprule
\mc{3}{@{}l}{Time} & \mc{2}{l@{}}{Value} \\
\midrule
6h & 0m & & -1.1 & \\
19h & 15m & & 26.3 & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Edit: Image
Edit2: Answer
siunitx seems to be what I want. The following table is way better for what I'm trying to do.
\begin{tabular}[h!]{
@{}
S[
table-format=2,
table-space-text-post=\si{\hour},
table-number-alignment=left]
@{\hspace{5pt}}
S[
table-format=2,
table-space-text-post=\si{\meter},
table-number-alignment=left]
S[
table-format=-1.1,
table-number-alignment=left]
@{}
}
\toprule
\mc{2}{@{}l}{Time} & {Value} \\
\midrule
6 \si{\hour} & 0 \si{\meter} & -1.1 \\
19 \si{\hour} & 15 \si{\meter} & 26.3 \\
\bottomrule
\end{tabular}
\si{\meter}
is a bit of a hack, but I prefer m
to min
for minute as it takes up less space and is consistent with d
for day and h
for hour.
Thanks to everyone who replied!
p{0pt}
can't be the right way to get any effect)