LaTeX forum ⇒ Graphics, Figures & TablesAlignment of Table Head to "±" Sign

Information and discussion about graphics, figures & tables in LaTeX documents.
Andlauge
Posts: 1
Joined: Tue Jul 23, 2013 5:28 pm

Alignment of Table Head to "±" Sign

Postby Andlauge » Tue Jul 23, 2013 5:35 pm

Hi,

I've made this table using the dcolumn package in the preamble. However, are headlines (i.e. "Size (nm)" and $N_{R6G(mean)}$) are not centered above the "±" signs in the table.
  1. \begin{table}[!htb]
  2. \centering
  3. \resizebox{11cm}{!}{
  4. \begin{tabular}{D{,}{\, \pm \,}{-1} D{,}{\, \pm \,}{-1} c D{,}{\, \pm \,}{-1} D{,}{\, \pm \,}{-1} c D{,}{\, \pm \,}{-1} D{,}{\, \pm \,}{-1}} \toprule[1.5pt]
  5. \multicolumn{2}{c}{\head{Mock}} & & \multicolumn{2}{c}{\head{SF9}} & & \multicolumn{2}{c}{\head{HEK293}} \\
  6. \multicolumn{1}{c}{Size (nm)} & \multicolumn{1}{c}{$N_{R6G(mean)} $} & & \multicolumn{1}{c}{Size (nm)} & \multicolumn{1}{c}{$N_{R6G(mean)} $} & & \multicolumn{1}{c}{Size (nm)} & \multicolumn{1}{c}{$N_{R6G(mean)} $} \\ \cmidrule(lr){1-8}
  7. 81.5,0.6 & 75,2 & & 74.5,0.4 & 83,1 & & 75.5,0.4 & 80,1 \\
  8. 122.3,0.5 & 106,1 & & 120.8,0.6 & 160,3 & & 120.8,0.6 & 146,2 \\
  9. 169.1,0.9 & 181,4 & & 172.7,1.0 & 274,8 & & 170.9,1.0 & 263,6\\
  10. 236.3,2.5 & 327,11 & & 235.6,2.0 & 513,21 & & 239.7,2.9 & 545,21\\ \bottomrule[1.5pt]
  11. \end{tabular}
  12. }
  13. \caption[Number of transported R6G molecules]{Summary of VMAT2 transport.}
  14. \label{tab:VMATsummary}
  15. \end{table}

Any ideas on how I can do this?
Last edited by localghost on Tue Jul 23, 2013 5:43 pm, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Jul 24, 2013 12:32 pm

Welcome to the LaTeX community!

I would use the siunitx package for number alignment in tables (and also for typesetting units):

  1. \documentclass{article}
  2. \usepackage{array,booktabs}
  3. \usepackage{siunitx}
  4. \sisetup{separate-uncertainty}
  5. \newcommand*\head[1]{\textbf{#1}}
  6. \begin{document}
  7.  
  8. \begin{table}
  9. \centering
  10. \small
  11. \begin{tabular}{
  12. S[table-format=3.1(2)]
  13. S[table-format=3.2]
  14. S[table-format=3.1(2)]
  15. S[table-format=3.2]
  16. S[table-format=3.1(2)]
  17. S[table-format=3.2]
  18. }
  19. \toprule
  20. \multicolumn{2}{c}{\head{Mock}} &
  21. \multicolumn{2}{c}{\head{SF9}} &
  22. \multicolumn{2}{c}{\head{HEK293}} \\
  23. {Size (\si{\nano\metre})} & {$N_{R6G(mean)}$} &
  24. {Size (\si{\nano\metre})} & {$N_{R6G(mean)}$} &
  25. {Size (\si{\nano\metre})} & {$N_{R6G(mean)}$} \\
  26. \midrule
  27. 81.5(6) & 75,2 & 74.5(4) & 83,1 & 75.5(4) & 80,1 \\
  28. 122.3(5) & 106,1 & 120.8(6) & 160,3 & 120.8(6) & 146,2 \\
  29. 169.1(9) & 181,4 & 172.7(10) & 274,8 & 170.9(10) & 263,6\\
  30. 236.3(25) & 327,11 & 235.6(20) & 513,21 & 239.7(29) & 545,21\\
  31. \bottomrule
  32. \end{tabular}
  33. \caption[Number of transported R6G molecules]{Summary of VMAT2 transport.}
  34. \label{tab:VMATsummary}
  35. \end{table}
  36.  
  37. \end{document}


table.png
table.png (30.68 KiB) Viewed 2121 times


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests