0

As seen in the picture below, the length of some scientific values are shorter than the others due to use of + and - sign. + sign occupies more space than -. Values are aligned left by default. How to align left and right(justify)?

\begin{table*}[htbp]
\centering
\caption{}
\begin{adjustbox}{max width=\textwidth}
{\renewcommand{\arraystretch}{1.3}%
\begin{tabular}{rrrrrrrrrrr}
\hline
\multicolumn{2}{c}{\multirow{2}[2]{*}{Functions}} & \multicolumn{2}{c}{FCDE} &         \multicolumn{2}{c}{POBL-ADE} & \multicolumn{2}{c}{FWA-DE} & \multicolumn{2}{c}{FERDE} & \multicolumn{1}{c}{CDEOA} \\
\multicolumn{2}{c}{} & \multicolumn{2}{c}{Mean Error±Std Dev} & \multicolumn{2}{c}{Mean Error±Std Dev} & \multicolumn{2}{c}{Mean Error±Std Dev} & \multicolumn{2}{c}{Mean Error±Std Dev} & \multicolumn{1}{c}{Mean Error±Std Dev} \\ \hline
\multicolumn{1}{c}{\multirow{3}[5]{*}{\parbox{1.4cm}{\textit{Unimodal Functions}}}} & \multicolumn{1}{c}{$F_1$} & \multicolumn{1}{l}{6.54E+04±4.90E+04} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{1.60E+04±1.22E+04} & \multicolumn{1}{l}{+} & \multicolumn{1}{l}{2.76E+05±1.82E+05} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{5.41E+02±5.41E+02} & \multicolumn{1}{l}{+} & \multicolumn{1}{l}{4.64E+04±4.26E+04} \\
\multicolumn{1}{c}{} & \multicolumn{1}{c}{$F_2$} & \multicolumn{1}{l}{0.00E+00±0.00E+00} & \multicolumn{1}{l}{$\approx$} & \multicolumn{1}{l}{3.14E+02±7.52E+02} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{0.00E+00±1.87E-16} & \multicolumn{1}{l}{$\approx$} & \multicolumn{1}{l}{2.39E-03±2.39E-03} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{0.00E+00±8.01E-13} \\
\multicolumn{1}{c}{} & \multicolumn{1}{c}{$F_3$} & \multicolumn{1}{l}{3.51E+01±1.26E+02} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{0.00E+00±4.59E-09} & \multicolumn{1}{l}{$\approx$} & \multicolumn{1}{l}{0.00E+00±4.74E-16} & \multicolumn{1}{l}{+} & \multicolumn{1}{l}{1.13E-03±1.13E-03} & \multicolumn{1}{l}{-} & \multicolumn{1}{l}{1.05E-05±6.68E-05} \\
%\bottomrule
\end{tabular}}%
\end{adjustbox}
\label{tab:table3}%
\end{table*}%

enter image description here

7
  • 1
    Could you precise a bit more the behavior you want to achieve? Also, please try to provide a complete minimal working example (one starting with \documentclass{article} and ending with \end{document}, so that it can be compiled directly).
    – summer
    Commented Mar 20, 2015 at 13:29
  • 1
    If you want the justify the standard deviations separately from the data, put them into two columns using l@{}l Commented Mar 20, 2015 at 14:45
  • 1
    I suggest to use the capabilities of package siunitx to deal with values in tables. Is quite handy in the document body as well to write numbers with their respective units.
    – Johannes_B
    Commented Mar 20, 2015 at 15:04
  • 1
    Out of curiosity, why didn't you provide a complete minimal working example (one starting with \documentclass{article} and ending with \end{document}, so that it can be compiled directly).
    – Johannes_B
    Commented Mar 20, 2015 at 15:08
  • all the other comments are relevant. for a minimalistic approach, just wrap a hyphen in $-$ to get the real minus sign. (plus just happens to work but it's really an accident. that would also best be put between dollar signs.) Commented Mar 20, 2015 at 15:26

2 Answers 2

3

I would recommend to use siunitx and its really powerfull S table specifier.

You then just have to adjust your numbering slightly and give the correct table-format-option. Here it is 1.2(3)e-2 because you have 1 digit before the decimal point, two digits after it, 3 digits for the standard deviation and 2 digits plus a sign in the exponent.

For more on that, please consider the documentation: http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/siunitx/siunitx.pdf

Here is what I have done with your table (i did not include everything):

\documentclass{scrartcl}

\usepackage{fontspec}

\usepackage[separate-uncertainty=true]{siunitx}
\usepackage{booktabs}

\begin{document}

\begin{table}
  \tiny
  \centering
  \caption{Set with booktabs and siunitx}
  \label{tab:table3}%
  \begin{tabular}{c *{5}{S[table-format=1.2(3)e-2]}}
  \toprule
  {Functions} & {FCDE} & {POBL-ADE} &  {FWA-DE} & {FERDE} & {CDEOA} \\
  \midrule
  $F_1$ & 6.54+-4.90e+04 & 1.60+-1.22e+04 & 2.76+-1.82e+05 & 5.41+-5.41e+02 &  4.64+-4.26e+04 \\
  $F_2$ & 0.00+-0.00e+00 & 3.14+-7.52e+02 & 0.00+-1.87e-16 & 2.39+-2.39e-03 & 0.00+-8.01e-13 \\
  $F_3$ & 0.35+-1.26e+02 & 0.00+-4.59e-09 & 0.00+-4.74e-16 & 1.13+-1.13e-03 & 1.05+-6.68e-05 \\
  \bottomrule
  \end{tabular}%
\end{table}%

\end{document}

And this is the result:

result

Most of the numbers you have in this table are kind of suspicious to me. Mostly because the errors are an order of magnitude greater than the value or because 0±1e-16 smells like numerical problems and should be exactly 0.

Also keep the table more simple. Those signs and redundant informations make it hard to read.

0

One option would be to find package for scientific notation, where would have + and - same size. However, the most convenient way to align things in LaTeX tables is just to make separated columns for it. From..

& \multicolumn{1}{l}{0.00E+00±0.00E+00} &

do something like...

& 0.00 & E+00 & ±0.00 & E+00 &

Than of course you have redefine columns of table at header and change multicolumn number in members of first two rows.

I am also not following, why you have multicolumns everywhere.

1
  • It's one way to change the alignment from r to l. Commented Mar 20, 2015 at 17:52

You must log in to answer this question.

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