I have a table that contains a lot of numbers. I have been defining new column types to allow me to specify column widths and allow \newline
within a cell. Some of my columns of numbers are in exponential format. I previously had these as text, like "0.496E+07" but to be consistent with the rest of the document, I have just converted them to \num{0.496e7}
using siunitx
. The problem is that now the numbers are not aligned.
I am unsure how I could use the S
column type because I don't know how to redefine it with a width as I have with R{width}
for r
for example.
I tried using \tablenum
but everything scoots out of the RHS of the table column, and I can't work out whether I can fix that using table-format
.
\documentclass[12pt, a4paper, oneside, fleqn]{report}
% Page geometry etc
%----------------------------
\usepackage{setspace} % allow different line spacing
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\usepackage[showframe,top=2.5cm, left=3.5cm, bottom=2.5cm, right=2.5cm, includehead]{geometry}
\geometry{headheight=28pt, headsep=18pt}
% Maths stuff
%------------
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{array}
\renewcommand{\arraystretch}{1.5}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcommand{\head}[1]{\centering\textbf{#1}}
\setlength{\tabcolsep}{0.11cm}
\begin{document}
\onehalfspacing
\begin{table}
\centering
\footnotesize
\begin{tabular}{|L{3.2cm} || r | R{2.0cm} | r| R{1.1cm} || r | R{2.0cm}| r | R{1.1cm} | }
\hline
\multirow{2}{*}{ } & \multicolumn{4}{ c ||}{\textbf{Full Selection}} & \multicolumn{4}{ c |}{\textbf{Max Condition Number $\mathbf{10^6}$}}\tabularnewline \cline{2-9}
\head{Method and Details} & \head{NCh} & \head{Condition Number} & \head{DFS} & \head{DFS\newline per chan} & \head{NCh} & \head{Condition Number} & \head{DFS} & \head{DFS\newline per chan} \tabularnewline [0.5ex]
\hline
\textbf{1:} & 210 & \num{0.496E+07} & 84.3 & 0.40 & 153 & \num{0.8126E+06} & 69.3 & 0.45 \\
\textbf{2:} 8 Clear 1.3 WVE & 183 & \num{0.130E+11} & 207.1 & 1.13 & 76 & \num{0.9469E+06} & 91.5 & 1.20 \\ [1ex]
% [1ex] adds vertical space
\hline
\end{tabular}
\caption{caption }
\end{table}
\end{document}
Here's what the output looks like, note the lack of alignment in column 3: