[Tex/LaTex] alignment of numbers in exponential format in a table with complicated header rows

horizontal alignmentsiunitxtables

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:

table

Best Answer

As usual, any table that uses \multirow can immediately improved by removing it.

Use the features in siunitx, which go much beyond \num. As you see, you have to do just one measurement: the tabular, without the local setting of \tabcolsep is overfull by 9.52791pt, so I just cut off the necessary space doing a simple division. The exact result is .595494375pt, but 0.6 is just as good.

Please, avoid single vertical rules and abhor double vertical rules.

\documentclass[12pt, a4paper, oneside, fleqn]{report}
\usepackage{geometry}
\geometry{
  top=2.5cm,
  left=3.5cm,
  bottom=2.5cm,
  right=2.5cm,
  includehead,
  headheight=28pt,
  headsep=18pt,
  showframe,
}

\usepackage{siunitx}
\usepackage{array,booktabs}

\newcommand{\head}[1]{%
  \bfseries
  \begin{tabular}{@{}c@{}}
  \strut#1\strut
  \end{tabular}%
}

\begin{document}


\begin{table}
\centering 
\footnotesize
%%% Without the following, the overfull is 9.52791pt;
%%% since there are nine columns and so 16 intercolumn
%%% spaces, do 9.52791/16=0.6
\addtolength{\tabcolsep}{-0.6pt}
\begin{tabular}{
  @{}
  l
  S[table-format=3.0]
  S[table-format=1.3e2]
  S[table-format=3.1]
  S[table-format=1.2]
  S[table-format=3.0]
  S[table-format=1.4e2]
  S[table-format=3.1]
  S[table-format=1.2]
  @{}
}
\toprule
 & \multicolumn{4}{c}{\bfseries Full Selection} &
   \multicolumn{4}{c}{\bfseries\boldmath Max Condition Number $10^6$} \\
\cmidrule(lr){2-5} \cmidrule(l){6-9} % no "r" here because it's the last column
\multicolumn{1}{c}{\head{Method and \\ Details}} &
  \head{NCh} & \head{Condition \\ Number} & \head{DFS} & \head{DFS \\ per \\ chan} &
  \head{NCh} & \head{Condition \\ Number} & \head{DFS} & \head{DFS \\ per \\ chan} \\
\midrule
\textbf{1:}                 & 210 & 0.496E+07 &  84.3 & 0.40 & 153 & 0.8126E+06 & 69.3 & 0.45 \\ 
\textbf{2:} 8 Clear 1.3 WVE & 183 & 0.130E+11 & 207.1 & 1.13 &  76 & 0.9469E+06 & 91.5 & 1.20 \\
\bottomrule
\end{tabular}

\caption{caption}

\end{table}


\end{document}

enter image description here