[Tex/LaTex] siunitx per-mode and math in s-column

math-modesiunitxtables

I am trying to use an siunitx s-column with per-mode = reciprocal for an units column but want to have my unit multiplied with a power. If there is a native way to do this with siunitx I missed it, so I used standard math instead. It seems an s-column implies math mode, so I just typed the power right after the units as \cubic\meter\per\mole \times10^{-5}. This works al right (despite feeling a little hacky) but where as in all other rows of the same table the per-mode-setting of reciprocal is respected, in the cell with the extra math, the \per is typeset as fraction with a /. When I remove the math, it is correctly typeset as reciprocal with a ^-1.

What is the correct way of doing this with siunitx if I don't want to introduce another column as the horizontal space is already quite limited due to two-column paper-style document layout?

Here the complete table:
Relevant loaded packages and options from the preamble:

\documentclass[a4paper, 10pt, twocolumn]{scrartcl}
\usepackage{siunitx}
    \sisetup{
        per-mode = symbol,
        output-decimal-marker = {.},
        list-final-separator = { und },
        list-pair-separator = { und },
        range-phrase = { bis },
        separate-uncertainty = true
    }
\usepackage{csquotes}
\usepackage{booktabs}

\begin{document}
\begin{table}[htbp]
    \centerline{
        \begin{tabular}{
            l
            s[table-unit-alignment=left, per-mode=reciprocal]
            S[table-format=3.3(2)]
            S[{table-format=3.3, table-space-text-post=~[0]}]
        }
            \toprule
                                    &                                           & {Experiment}      & {Literatur} \\
            \midrule
            \( p_\mathrm{c} \)      & \bar                                      &  37.3  +-  0.5    &  37.59    ~\cite{DeanLange}           \\
            \( V_\mathrm{c,mol} \)  & \cubic\centi\meter\per\mole               & 238    +- 32      & 198.05    ~\cite{BrakerAllen}     \\
            \( T_\mathrm{c} \)      & \degreeCelsius                            &  47    +-  1      &  45.6     ~\cite{Merck}               \\
            \( K_\mathrm{c} \)      &                                           &   3.00 +-  0.32   &   3.56                                \\
            \( a \)                 & \pascal\meter\tothe{6}\per\mole\tothe{2}  &   0.8  +-  0.53   &  78.57    ~\cite{ReidPrausnitzPoling} \\
            \( b \)                 & \cubic\meter\per\mole \times10^{-5}       &  88.5  +-  0.47   &   9.795   ~\cite{ReidPrausnitzPoling} \\
            \bottomrule
        \end{tabular}
    }
\end{table}
\end{document}

The problematic column is the second one, the problematic cell is in the last row. Specifically \cubic\meter\per\mole \times10^{-5}

(And yes, the experimental values are just non-sense, we didn't measure yet. FYI the measurement is about the Van-der-Waals gas behaviour of sulfur hexafluoride.)

Best Answer

First to your main issue which is the \times 10^{-5}. I think you are confusing the s column here, because you enter stuff that cannot be handled by siunitx. So I think siunitx escapes the s mode and so this cell is handled similar as if you would have bracketed it {...}. (As a hint you can just enter in a dummy row \cubic\meter\per\mole which will be handled correctly, but when you then just add let's say a after it, you will see that the output is switched back to the per mode, which is valid "outside" the s column. Maybe this is a bug that the column is still interpreting the unit stuff correctly (so without marking it with \si). We will see when Joseph has a look at the question ;))

So in my opinion the correct way would be to escape the s column by bracketing the cell and put in it your desired content, i.e. {\SI{e5}{\cubic\metre\per\mole}}.

Then I did some more changes to your table:

  1. I introduced a new column type L so you don't need to repeat the math mode for each cell. From that follows that you have to handle a possible heading different. Here I simply have chosen to use the \text command, but could also have used \multicolumn.

  2. Because the given headings are in German, as well as the given keys to siunitx which used translated values I assume you want to produce a German result. That could be done a bit easier by just setting locale=DE. But it can be done even cleverer by choosing the appropriate settings depending on the active language. For that I have added the languages english and ngerman to the \documentclass and added the babel package. Then you can add the locales to the language using the \addto command (have a look at the code below). (You can test it by uncommenting the \selectlanguage line.)

  3. Last I have moved the \cites to a separate column and used another \multicolumn command to center the heading above both column. To achieve that only the desired space is set between the two columns I use the @{...} expression, which "kills the inter-column space and replaces it with whatever is between the curly braces". In this case the space I use @{~}, but could have used any other space generating command.

  4. I have corrected the number of decimal digits to 2 in the first S column. At least for the given MWE this is the maximum number given.

Last I wanted to note that you could make use of the cellspace package (already present in the following code) to "enlarge" the spacing of cells with "large" content, e.g. a math symbol having both, a subscript and a superscript. To use it simply replace the line \newcolumntype{L}{>{$}l<{$}} by \newcolumntype{L}{>{$}Cl<{$}}. (For more details have a look at the cellspace manual.)


\documentclass[
    a4paper,
    10pt,
    twocolumn,
    english,ngerman,
        ]{scrartcl}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{array}
\usepackage{booktabs}
    \newcolumntype{L}{>{$}l<{$}}
\usepackage{cellspace}
    \addtolength\cellspacetoplimit{2pt}
    \addtolength\cellspacebottomlimit{2pt}
\usepackage{siunitx}
    \sisetup{
        per-mode = symbol,
        separate-uncertainty = true,
    }
    % add appropriate `locale' values to the corresponding languages
    \addto\extrasenglish{\sisetup{locale = UK}}
    \addto\extrasngerman{\sisetup{locale = DE}}
\begin{document}
%    \selectlanguage{english}
\begin{table}[htbp]
        \newcommand*\mc[1]{\multicolumn{2}{c}{#1}}
    \centerline{
        \begin{tabular}{
            L
            s[table-unit-alignment=left, per-mode=reciprocal]
            S[table-format=3.2(2)]
            S[table-format=3.3]
            @{~}l
        }
                \toprule
            \text{Symbol}     & {Einheit}                                 & {Experiment}      & \mc{Literatur} \\
                \midrule
            p_\mathrm{c}      & \bar                                      &  37.3  +-  0.5    &  37.59    & \cite{DeanLange}           \\
            V_\mathrm{c,mol}  & \cubic\centi\meter\per\mole               & 238    +- 32      & 198.05    & \cite{BrakerAllen}     \\
            T_\mathrm{c}      & \degreeCelsius                            &  47    +-  1      &  45.6     & \cite{Merck}               \\
            K_\mathrm{c}      &                                           &   3.00 +-  0.32   &   3.56                                \\
            a                 & \pascal\meter\tothe{6}\per\mole\tothe{2}  &   0.8  +-  0.53   &  78.57    & \cite{ReidPrausnitzPoling} \\
            b                 & {\SI{e5}{\cubic\meter\per\mole}}          &  88.5  +-  0.47   &   9.795   & \cite{ReidPrausnitzPoling} \\
                \bottomrule
        \end{tabular}
    }
\end{table}
\end{document}

image showing the result of above code