2

in this table:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bigstrut}

\begin{document}
   \begin{tabular}{rcc}
    \hline
    Text 1  & $6,58\pm0,45$     & $6,94\pm0,51$\bigstrut[t]\\
    Text 2  & $25\pm1$          & $29\pm3$\\
    Text 3  & $8,16\pm 2,23$    & $11,01\pm1,93$\\
    Text 4  & $60\pm 14$        & $148\pm8$\\
    Text 5  & $90,7\pm 2,5$     & $109,2\pm3,8$\\
    Text 6  & $0,030\pm 0,008$  & $0,034\pm0,004$\\
    Text 7  & $5,72\pm 0,66$    & $143,47\pm38,47 $\\
    Text 8  & --                & $(10,81\pm1,19)\times10^{5}$\\
    Text 9  & --                & $‑12,95\pm 0,35$\bigstrut[b]\\
    \hline
    \end{tabular}
\end{document}

How can I align the elements in columns 2 and 3 by the \pm symbol. I'd like to have all the \pm symbols aligned in the center

enter image description here

3

In my view, aligning the numbers before and after the \pm symbols on their respective decimal markers is at least as important as aligning the \pm symbols. To achieve the former objective, I suggest you use the dcolumn package. (That way, you will also avoid the excessive spacing after the commas that serve as the decimal markers.) To achieve the latter, simply place the \pm directives in separate columns.

Incidentally, the "minus" symbol in the final row of your tabular environment isn't an ASCII symbol; I've replaced it with - (simple dash) to that TeX can generate a mathematical minus symbol.

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{array,dcolumn,booktabs}
\newcolumntype{d}[1]{D{,}{,}{#1}} % numbers aligned on decimal commas
\newcolumntype{C}{>{${}}c<{{}$}}  % for columns that house "\pm" symbols
\begin{document}
\begin{tabular}{@{} l d{2.3}@{}C@{}d{2.3} d{3.3}@{}C@{}d{2.6}}
    \toprule
    Text 1  & 6,58&\pm&0,45     & 6,94&\pm&0,51\\
    Text 2  & 25&\pm&1          & 29&\pm&3\\
    Text 3  & 8,16&\pm& 2,23    & 11,01&\pm&1,93\\
    Text 4  & 60&\pm& 14        & 148&\pm&8\\
    Text 5  & 90,7&\pm& 2,5     & 109,2&\pm&3,8\\
    Text 6  & 0,030&\pm& 0,008  & 0,034&\pm&0,004\\
    Text 7  & 5,72&\pm& 0,66    & 143,47&\pm&38,47 \\
    Text 8  & \multicolumn{3}{c}{--}  & (10,81&\pm&1,19)\times10^{5}\\
    Text 9  & \multicolumn{3}{c}{--}  & -12,95&\pm& 0,35\\
    \bottomrule
\end{tabular}
\end{document}
3

A solution using siunitx

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bigstrut}

\usepackage[separate-uncertainty=true,output-decimal-marker={,}]{siunitx}
\usepackage{booktabs}

\begin{document}
\begin{table}
   \begin{tabular}{rS[table-format=2.3(3)]S[%   
        table-format=-3.3(4)e1, 
        table-align-exponent = false, 
        table-space-text-post={)$\times 10^5$},
        table-space-text-pre={(},
        table-align-text-post=false,
        table-align-text-pre=false,
   ]}
    \toprule
    Text 1  & 6.58 +- 0.45    & 6.94 +- 0.51\\
    Text 2  & 25 +- 1         & 29 +- 3\\
    Text 3  & 8.16 +- 2.23    & 11.01 +- 1.93\\
    Text 4  & 60 +- 14        & 148 +- 8\\
    Text 5  & 90.7 +- 2.5     & 109.2 +- 3.8\\
    Text 6  & 0.030 +- 0.008  & 0.034 +- 0.004\\
    Text 7  & 5.72 +- 0.66    & 143.47 +- 38.47 \\
    Text 8  & {--}            & {(}10.81(119){)$\times 10^5$}\\% (10.81e5 +- 1.19e5)
    Text 9  & {--}            & -12.95 +- 0.35\\
    \bottomrule
    \end{tabular}
\end{table}

\end{document}

enter image description here

  • 1
    Assuming one of the (typesetting) objectives is to align the uncertainty-component numbers on their decimal markers, the number "14" in the left-hand column of row 4 and the number "38,47" in the right-hand column of row 5 wouldn't see to be fully aligned. Can anything be done about this? – Mico Jul 5 '17 at 15:24
  • 1
    @Mico Yes, one could wait for v3, see tex.stackexchange.com/questions/85769/… or use your answer instead :) – user36296 Jul 5 '17 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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