Hi,
I have a table that looks half decent. A fellow member actually helped me out with another table and I tried to copy-paste some of the code to this one. But the alignment of the data is not OK. Its left aligned on 2 rows and center aligned in the others. I want it center aligned for all rows but don't know how to fix it. Help!
Also, any tips for making the table look more professional would be highly appreciated.
Thank you in advance!
Cheers
Sonia
Graphics, Figures & Tables ⇒ Data Alignment and Improvements for a Table
-
- Posts: 6
- Joined: Sun Sep 09, 2012 6:08 pm
Data Alignment and Improvements for a Table
- Attachments
-
- samplefile2.tex
- (1.42 KiB) Downloaded 301 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

Data Alignment and Improvements for a Table
I believe it was me who answered your previous question. Since it's late right now I only have this advice for now: I used the siunitx package to align the data. If you haven't yet you should read its documentation about tabular material:
siunitx
Good night

Good night
site moderator & package author
Data Alignment and Improvements for a Table
Here is what I would do. Use siunitx' possibility to treat numbers with uncertainties and choose a suiting
Regards
table-format
and make the mid rule span the whole table:Code: Select all
\documentclass{article}
\usepackage{booktabs,siunitx}
\setlength\heavyrulewidth{1pt}
\begin{document}
\begin{table}[ht]
\centering
\sisetup{
separate-uncertainty = true,
table-space-text-post = *,
table-align-text-post = false,
range-phrase = --,
range-units = single
}
\begin{tabular}{l*3{S[table-format=3.1(3)]}}
\toprule
& {\SIrange{50}{59}{yr} (50s)}
& {\SIrange{60}{69}{yr} (60s)}
& {\SIrange{70}{79}{yr} (70s)} \\
\midrule
\textit{Male} & {$n=40$} & {$n=50$} & {$n=49$} \\
Age, yr & 55.2(31) & 65.5(29) & 73.7(29) \\
Height, \si{cm} & 174.6(61) & 174.2(57) & 171.3(74)* \\
Body mass, \si{kg} & 78.3(114) & 78.9(105) & 78.4(125) \\
\midrule
\textit{Female} & {$n=42$} & {$n=52$} & {$n=50$} \\
Age, yr & 54.7(29) & 65.4(29) & 73.7(24) \\
Height, \si{cm} & 162.9(69) & 163.2(62) & 160.8(57)* \\
Body mass, \si{kg} & 66.8(117) & 67.9(100) & 64.7(109) \\
\bottomrule
\end{tabular}
\caption[Subject characteristics: age, height, body mass]{Subject characteristics:
Values are Mean $\pm$ SD; $n$=number of subjects; Males are significantly
taller ($P<0.05$) and heavier ($P<0.05$) than women in all age groups.
*Significantly different from all other groups ($P<0.05$). }
\label{subject-characs}
\end{table}
\end{document}
site moderator & package author