First of all, by explicitly going into math mode siunitx is no longer able to correctly align your numbers. There is however a workaround to make selected cells bold, with help from the etoolbox package. This solution is also mentioned at
tex.se
I also recommend to make use of the
\sisetup
command to set default settings for siunitx, this can be done either as global settings in the preamble, at any point in your text, and also within the
table
environment. If you want to use different settings for your tables than for the rest of your text, but the same across all tables you could even further simplify your life by defining a new environment to wrap your table in. This is especially useful since you mention having lots of tables, and I presume you want them to have the same look. I also added a few extra options to reserve space for a sign in front of the number (
table-sign-mantissa
) and the asterisk behind it (
table-space-text-post
), since the current code gave some warnings about overfull hboxes.
Finally, I know you provided a
minimal working example, so perhaps you already use it in your real document, but the booktabs package provides a few commands that replace
\hline
with rules of different width and fine tuned spacing.
Code: Select all
\documentclass[12pt]{article}
\usepackage{array}
\usepackage{siunitx}
% enable siunitx to properly align bold numbers
\usepackage{etoolbox}
\robustify\bfseries
% Produce nicer tables
\usepackage{booktabs}
% Declare new environment with default settings for siunitx
% It needs a single (possibly empty) argument for placement options
\newenvironment{sitable}[1]{
\begin{table}[#1]
\sisetup{
detect-all,
table-number-alignment = center,
add-integer-zero = false,
table-figures-integer = 1,
table-figures-decimal = 3,
table-sign-mantissa,
table-space-text-post = *,
}
\centering
\addtolength{\tabcolsep}{0.1cm}
}{
\end{table}
}
\begin{document}
\begin{sitable}{h}
\begin{tabular}{cSS}
\toprule
\textbf{DATA} & {\textbf{MMRS2}} & {\textbf{MMRS3}} \\
\midrule
A & .111 & .090 \\
B & \bfseries .222 & .100 \\
C & -.333 & -.110 \\
D & \bfseries -.444 & .120* \\
E & \bfseries .555 & -.130* \\
F & .006 & \bfseries .666 \\
G & .007* & .777 \\
H & -.008 & \bfseries .888 \\
\bottomrule
\end{tabular}
\end{sitable}
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit