I have a code as given below:
\documentclass[10pt]{article}
\usepackage{ltablex}
\begin{document}
\begin{tabularx}{\textwidth}{@{}rr@{}}
A & $0.11^{***}$\\ & (-12.112) \\ B & $0.15^{*}$\\ & (-8.452)\\
C & $0.76^{}$\\ & (12.452)\\
\end{tabularx}
\end{document}
This produces a result as given below:
However, I want "stars (***/*) etc. to be formatted differently as given in the picture below:
Please let me know how to format the table. Thanks.
Best Answer
You may want to use the dcolumn package for this purpose: It provides a column type called
D
which serves to align numbers in a column on the decimal marker without need for further intervention to handle symbols such as(
,)
, and*
.Because the contents of a
D
column are automatically typeset in math mode, there's also no need to specify opening and closing$
markers. However, if you have a cell -- say, in the header row -- in aD
-type column that contains some text or other mostly non-numeric material, be sure to encase it in a\mulicolumn{1}{c}{<some text>}
macro.In the MWE below, I've modified the numbers relative to your code to make them conform to the structure of the numbers in the screenshot you posted.