Some cells in my table contain numbers that have to be aligned around the decimal separator. So, I use dcolumn
to produce the desired alignment. Some of the cells, however, have to be written out with a smaller font size while keeping the same alignment around the decimal separator.
Unfortunately, these latter cells display an inconsistent behavior in their font size: the font size remains smaller up to the decimal separator, while returning to the normal font size in the subsequent digits. I produce hereby a MWE using the standalone
class for mere purposes of representation.
I have already attempted some alternatives, for instance using the package relsize
and its related command \mathsmaller
. None of my numerous attempts took me anywhere. Moreover, I could not find this type of issue being documented anywhere else.
Can anybody help solve this inconsistency in the font size?
% Minimal Working Example
\documentclass[varwidth=\maxdimen]{standalone}
\usepackage{multicol}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{.}{D{.}{.}{2.3}}
\begin{document}
\begin{table}
\begin{tabular}{c.}
Header A & \multicolumn{1}{c}{Header B} \\
Item 1 & -0.522 \\
\scriptsize(Item 2) & \scriptstyle 0.001
\end{tabular}
\end{table}
\end{document}
D
column type splits the contents on the decimal and then typesets things in a special way. So if you have\foo L.R
you end up withSOMETHING{\too L}.{SOMETHING{R}
and this\foo
never reaches theR
part in the typesetting. As an alternative todcolumn
have a look atsiunitx
, besides typesetting units it also typesets table data, and its font handling is a lot better, though you'd use\scriptsize
not\scriptstyle
.