How can I align numeric values in the body of my table by decimal point when some of those values are accompanied by character values? For example, say I wanted to report some standard deviations in a column aligned by decimal point such that each one is enclosed in parentheses. How can I do things like this?

Update Based on answer by David Carlisle

    \begin{table}[h]
    \begin{tabularx}{\textwidth}{lD{.}{.}{7.4}}
    \toprule
    \multicolumn{1}{c}{Test} & \multicolumn{1}{c}{Test 2} \\
    \midrule
    Test & \mathrm{abcde}(1.23)\\
    Test2 & (4.321)\\
    \bottomrule
    \end{tabularx}
    \end{table}
up vote 5 down vote accepted

It always helps if you provide a document showing the problem, but basically dcolumn doesn't really mind about extra characters. (12.3) and 12.3 would both be aligned on the . If you use the centre on . form then there is nothing else to do; if you use the form D{.}{.}{3.2} to specify the space before and after the . you just need to specify enough space for the text parts, specified in multiples of the width of a digit.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.