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
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
- Attachments
-
- samplefile2.tex
- (1.42 KiB) Downloaded 302 times
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Data Alignment and Improvements for a Table

Good night
Data Alignment and Improvements for a Table
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}