2

I'm trying to align numbers in a table by the dots. I know of one method using the siunitx package. But I can't load the package. siunitx error:

"incompatible-package"! Package 'SIunits' incompatible. \__siunitx_load_check:n 

Probably a conflict to the SIunit package which I'm using.

But I found another way to make the aligning but the table doesn't fit the numbers.

\documentclass[a4paper,12pt,icelandic]{report}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1} }
\begin{table}[H]
\centering
\begin{tabular}{|rcld{1}|}
    \hline
      $O_{3}(g) + 2H^{+} + 2e^{-}$ & $\rightleftharpoons$ & $O_{2}(g) + H_{2}O$ & 2.07     \\
    $H_{2}O_{2} + 2H^{+} + 2e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.776    \\
                    $Au^{+}+e^{-}$ & $\rightleftharpoons$ & $Au$                & 1.68     \\
                $Cl_{2}(g)+2e^{-}$ & $\rightleftharpoons$ & $2 Cl^{-}$          & 1.3583   \\
      $O_{2}(g) + 4H^{+} + 4e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.229    \\
    $H_{2}O_{2} + 2e^{-} + 2e^{-}$ & $\rightleftharpoons$ & $2 OH^{-}$          & 0.88     \\
                  $ Ag^{+}+e^{-} $ & $\rightleftharpoons$ & $Ag$                & 0.7996   \\
           $ O_{2}+2H_{2}O+4e^{-}$ & $\rightleftharpoons$ & $4 OH^{-}$          & 0.401    \\ \hline
                 $ 2H^{+}+2e^{-} $ & $\rightleftharpoons$ &                     & 0.000... \\ \hline
                  $Fe^{3+}+3e^{-}$ & $\rightleftharpoons$ & $Fe$                & -0.036   \\ \hline

\end{tabular} 
\end{table}

enter image description here

2 Answers 2

4

you have told dcolumn that you only have one decimal place in the numbers so it only leaves room for one digit after the . Also please always post complete documents not fragments with bits removed. The 2.4 leaves enough room for a minus sign and a digit to the left of the . and 4 digits after.

\documentclass[a4paper,12pt,icelandic]{report}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1} }
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{|rcld{2.4}|}
    \hline
      $O_{3}(g) + 2H^{+} + 2e^{-}$ & $\rightleftharpoons$ & $O_{2}(g) + H_{2}O$ & 2.07     \\
    $H_{2}O_{2} + 2H^{+} + 2e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.776    \\
                    $Au^{+}+e^{-}$ & $\rightleftharpoons$ & $Au$                & 1.68     \\
                $Cl_{2}(g)+2e^{-}$ & $\rightleftharpoons$ & $2 Cl^{-}$          & 1.3583   \\
      $O_{2}(g) + 4H^{+} + 4e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.229    \\
    $H_{2}O_{2} + 2e^{-} + 2e^{-}$ & $\rightleftharpoons$ & $2 OH^{-}$          & 0.88     \\
                  $ Ag^{+}+e^{-} $ & $\rightleftharpoons$ & $Ag$                & 0.7996   \\
           $ O_{2}+2H_{2}O+4e^{-}$ & $\rightleftharpoons$ & $4 OH^{-}$          & 0.401    \\ \hline
                 $ 2H^{+}+2e^{-} $ & $\rightleftharpoons$ &                     & 0.000\\ \hline
                  $Fe^{3+}+3e^{-}$ & $\rightleftharpoons$ & $Fe$                & -0.036   \\ \hline

\end{tabular} 
\end{table}
\end{document}
1
  • Thanks for this David. Just used 2.6 and it works like a charm!
    – Bjartmar
    Commented Nov 24, 2014 at 22:00
1

I think the problem is your ... in the second-to-last row in your table. I was able to use the siunitx package by replacing ... with \dots.

Also, have a look at the mhchem package. I've replaced your first equation using the \ce{} command provided by mhchem.

\documentclass[a4paper,12pt]{report}
\usepackage[icelandic]{babel}
\usepackage{dcolumn}
\usepackage{siunitx}
\usepackage[version=3]{mhchem}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|rclS|}
    \hline
      \ce{O3_{(g)} + 2H+ + 2e-} & \ce{<=>} & \ce{O2_{(g)} + H2O} & 2.07     \\
    $H_{2}O_{2} + 2H^{+} + 2e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.776    \\
                    $Au^{+}+e^{-}$ & $\rightleftharpoons$ & $Au$                & 1.68     \\
                $Cl_{2}(g)+2e^{-}$ & $\rightleftharpoons$ & $2 Cl^{-}$          & 1.3583   \\
      $O_{2}(g) + 4H^{+} + 4e^{-}$ & $\rightleftharpoons$ & $2 H_{2}O$          & 1.229    \\
    $H_{2}O_{2} + 2e^{-} + 2e^{-}$ & $\rightleftharpoons$ & $2 OH^{-}$          & 0.88     \\
                  $ Ag^{+}+e^{-} $ & $\rightleftharpoons$ & $Ag$                & 0.7996   \\
           $ O_{2}+2H_{2}O+4e^{-}$ & $\rightleftharpoons$ & $4 OH^{-}$          & 0.401    \\ \hline
                 $ 2H^{+}+2e^{-} $ & $\rightleftharpoons$ &                     & 0.000\dots \\ \hline
                  $Fe^{3+}+3e^{-}$ & $\rightleftharpoons$ & $Fe$                & -0.036   \\ \hline
\end{tabular} 
\end{table}
\end{document}

enter image description here

3
  • Thank you very much for your answer. But for some reason I can't load the siunitx package due to conflict to the SIunit package. I'm using commands that siunitx doesn't support elsewhere in my thesis. Like \degree \micro e.t.c. - But I also want to thank you for introducing me to the chem package.
    – Bjartmar
    Commented Nov 24, 2014 at 19:35
  • @bjartmar You're welcome. You might consider taking another look at the siunitx documentation. I'm certain it has the equivalent of the commands you mention, but the implementation might be slightly different. Here is a good place to start tex.stackexchange.com/a/21943/24974
    – erik
    Commented Nov 24, 2014 at 20:07
  • Thanks again. I will definitely take a look at this later. I'm just about to finish this thesis. It would take me to long to figure everything out. :)
    – Bjartmar
    Commented Nov 24, 2014 at 21:37

You must log in to answer this question.

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