1

enter image description hereI would like the data in the columns to be centered/aligned with respect to plus/minus and X symbols. Here is the code, I have used. Can someone please help me with it.

\begin{table}[b!]
\begin{center}
\footnotesize 
\caption{\label{tab:table1}
Summary of fiber characteristics. } 
\begin{tabular} {|c||c|c|c|c|c|c|c|}
\hline
Type &  $\overline L [\mu$m] & $\overline D [\mu$m] & $\beta$  & $\overline L^+$ & $\tau$ [ms] & St & $ V_s$ [m/s]\\
\hline \hline
t1 & 921 $\pm$ 142 & 28 $\pm$ 2.1 & 32.9 $\pm$ 5.6 & 16 $\pm$ 2.5 & 0.21 $\pm$ 0.03 & 0.06 $\pm$ 0.01 & $-3 \times 10^{-4}$\\
\hline
t2 & 950 $\pm$ 96 & 15.3 $\pm$ 0.9  & 62.1 $\pm$ 7.3 & 16.5  $\pm$ 1.7 & 0.07 $\pm$ 0.009 & 0.02 $\pm$ 0.003 &  $-1 \times 10^{-4}$\\
\hline
t3 & 1446 $\pm$ 212 & 21.2 $\pm$ 0.97  & 68.2 $\pm$ 10.5 & 25.2  $\pm$ 3.7 & 0.14 $\pm$ 0.014 & 0.04 $\pm$ 0.004 &  $-2 \times 10^{-4}$\\
\hline
t4  & 1594 $\pm$ 174 & 52 $\pm$ 3.62 & 30.7 $\pm$ 3.9 & 27.7 $\pm$ 3& 0.7 $\pm$ 0.1 & 0.22 $\pm$ 0.03 & $-1.1 \times 10^{-3}$\\
\hline
t5  & 2917 $\pm$ 242 & 62 $\pm$ 5.5  & 47.0 $\pm$ 5.7 & 50.8  $\pm$ 4.2& 1.12 $\pm$ 0.2 & 0.34 $\pm$ 0.06 &  $-1.7 \times 10^{-3}$\\
\hline
t6 & 3044 $\pm$ 317 & 35.5 $\pm$ 6.5  & 85.5 $\pm$ 8.9 & 52.9  $\pm$ 5.5 & 0.41 $\pm$ 0.15 & 0.13 $\pm$ 0.05 &  $-6 \times 10^{-4}$\\
\hline
t7 & 3840 $\pm$ 414.6 & 38.5 $\pm$ 2.9  & 99.7 $\pm$ 10.7 & 66.8  $\pm$ 7.2 & 0.6 $\pm$ 0.09 & 0.18 $\pm$ 0.03 &  $-1.8 \times 10^{-3}$\\
\hline
\end{tabular}
\end{center}
\end{table}
1
  • Welcome to TeX.SE! Please make your code snippet be compilable, then we do not have to guess what you are doing ...
    – Mensch
    Oct 11, 2021 at 11:19

1 Answer 1

2

With use of the siunitx package:

\documentclass{article}
\usepackage{siunitx}

\begin{document}
    \begin{table}[b!]
    \caption{Summary of fiber characteristics. }
\centering
\footnotesize
\sisetup{uncertainty-mode=separate}
\renewcommand\arraystretch{1.3}  
    \label{tab:table1}
\begin{tabular} {|c||S[table-format=4.0(2)]
               *{3}{|S[table-format=2.1(3)]}
               *{2}{|S[table-format=1.3(4)]}
                    |S[table-format=-1.1e3,
                       round-mode=places,
                       round-precision=1]|}
\hline
Type    & {$\overline L [\mu$m]}    & {$\overline{D} [\mu$m]}   & {$\beta$}  
        & {$\overline L^+$ }        & {$\tau$ [ms]}             & {St}
        & {$V_s$ [m/s]  }       \\
\hline \hline
t1 & 921(142)   & 28.(21)   & 32.9(56)  & 16.(25)    & 0.21(3)   & 0.06(1)  & -3e-4 \\
\hline
t2 & 950(96)    & 15.3(9)   & 62.1(73)  & 16.5(17)  & 0.07(0.9) & 0.02(0.3) & -1e-4 \\
\hline
t3 & 1446(212)  & 21.2(97)  & 68.2(105) & 25.2(37)  & 0.14(1.4) & 0.04(0.4) & -2e-4 \\
\hline
t4 & 1594(174)  & 52.(362)  & 30.7(39)  & 27.7(3)   & 0.70(10)  & 0.22(3)  & -1.1e-3\\
\hline
\end{tabular}
    \end{table}
\end{document}

enter image description here

Addendum: It seems that you prefer to have only aligned data at \pm sign. and consistency of data, which is required at use of siunitx package, is not important, than try the following solution:

\documentclass{article}

\begin{document}
    \begin{table}[b!]
\centering
\footnotesize
\caption{\label{tab:table1}
Summary of fiber characteristics. }
\begin{tabular} {|l|*{6}{r@{\,}c@{\,}l|} c | }
\hline
Type &  \multicolumn{3}{c|}{$\overline L [\mu$m]} 
        & \multicolumn{3}{c|}{$\overline D [\mu$m]} 
            & \multicolumn{3}{c|}{$\beta$}
                & \multicolumn{3}{c|}{$\overline L^+$} 
                    & \multicolumn{3}{c|}{$\tau$ [ms]} 
                        & \multicolumn{3}{c|}{St} 
                            & \multicolumn{3}{c|}{$V_s$ [m/s]}\\
\hline \hline
t1 & 921 & $\pm$ & 142 & 28 & $\pm$ & 2.1 & 32.9 & $\pm$ & 5.6 & 16 & $\pm$ & 2.5 & 0.21 & $\pm$ & 0.03 & 0.06 & $\pm$ & 0.01 & $-3$ &$\times$&  $10^{-4}$\\
\hline
t2 & 950 & $\pm$ & 96 & 15.3 & $\pm$ & 0.9  & 62.1 & $\pm$ & 7.3 & 16.5 & $\pm$ & 1.7 & 0.07 & $\pm$ & 0.009 & 0.02 & $\pm$ & 0.003 &  $-1$ &$\times$& $10^{-4}$\\
\hline
t3 & 1446 & $\pm$ & 212 & 21.2 & $\pm$ & 0.97  & 68.2 & $\pm$ & 10.5 & 25.2 & $\pm$ & 3.7 & 0.14 & $\pm$ & 0.014 & 0.04 & $\pm$ & 0.004 &  $-2$ &$\times$& $10^{-4}$\\
\hline
t4  & 1594 & $\pm$ & 174 & 52 & $\pm$ & 3.62 & 30.7 & $\pm$ & 3.9 & 27.7 & $\pm$ & 3& 0.7 & $\pm$ & 0.1 & 0.22 & $\pm$ & 0.03 & $-1.1$ &$\times$& $10^{-3}$\\
\hline
t5  & 2917 & $\pm$ & 242 & 62 & $\pm$ & 5.5  & 47.0 & $\pm$ & 5.7 & 50.8 & $\pm$ & 4.2& 1.12 & $\pm$ & 0.2 & 0.34 & $\pm$ & 0.06 &  $-1.7$ &$\times$& $10^{-3}$\\
\hline
t6 & 3044 & $\pm$ & 317 & 35.5 & $\pm$ & 6.5  & 85.5 & $\pm$ & 8.9 & 52.9 & $\pm$ & 5.5 & 0.41 & $\pm$ & 0.15 & 0.13 & $\pm$ & 0.05 &  $-6$ &$\times$& $10^{-4}$\\
\hline
t7 & 3840 & $\pm$ & 414.6 & 38.5 & $\pm$ & 2.9 & 99.7 & $\pm$ & 10.7 & 66.8 & $\pm$ &7.2 & 0.6 & $\pm$ & 0.09 & 0.18 & $\pm$ & 0.03 &  $-1.8$ &$\times$& $10^{-3}$\\
\hline
\end{tabular}
    \end{table}
\end{document}

enter image description here

12
  • Hi, thank you so much for your answer. The decimals after the plus/minus sign in columns #6 and #7 are not correct. How can I fix this? Also, I tried the same script and added the missing rows, it ends up with the same decimal places error in the result.
    – Subhani
    Oct 11, 2021 at 12:39
  • @Subhani, huh, this are errors at transcribing of uncertainties of siunitx format. Corrected now but please check, if it is now correct.
    – Zarko
    Oct 11, 2021 at 12:51
  • Hi. I got the following error and the field is blank after compiling.Package siunitx Error: Invalid number '0.14(1.4)'.
    – Subhani
    Oct 11, 2021 at 12:57
  • 1
    @Subhani, at me compilation is performed without any errors. Which version of siunitx you use? I test with v3.0.32, last revised 2021-09-29.
    – Zarko
    Oct 11, 2021 at 13:02
  • thanks. I am using the same version of the package. If possible could you please share the snapshot of the result? I see that, the decimals units are not correct in the posted picture.
    – Subhani
    Oct 12, 2021 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .