6

I would center 10e-1 and 10e-3 at the center of the 4 multicolumn. How can I do?

\usepackage{siunitx}
\usepackage{multirow}
\usepackage{booktabs}


\begin{table}[htp]
    \centering
    \begin{tabular}{lS[table-format=1.4]
                     S[table-format=1.4]
                     S[table-format=1.4]
                     S[table-format=1.4]}
        \toprule
            {\emph{Nodi}} & \multicolumn{4}{c}{PEP} \\
            \cmidrule(lr){2-5}
                        & \num{10e-1} &     &       & \num{10e-3} \\
            \cmidrule(lr){2-5}
                        & {BC}   & {PNC}    & {BC} & {PNC} \\
        \midrule
        1               & 1.1107 & 1.1112  & 1.001  & 1.001 \\
        3               & 1.3046 & 1.1488  & 1.003  & 1.0029 \\
        7               & 1.597  & 1.1734  & 1.007  & 1.006 \\
        12              & 1.8435 & 1.188   & 1.0117 & 1.0089 \\
        20              & 2.0836 & 1.2009  & 1.0201 & 1.0122 \\
        25              & 2.1777 & 1.2064  & 1.0246 & 1.0134 \\
        35              & 2.3101 & 1.2141  & 1.0347 & 1.0153 \\
        50              & 2.4443 & 1.2223  & 1.0488 & 1.0167 \\
        65              & 2.5501 & 1.228   & 1.0636 & 1.0175 \\
        75              & 2.6109 & 1.2308  & 1.0723 & 1.0178 \\
        90              & 2.6915 & 1.235   & 1.0864 & 1.0184 \\
        100             & 2.7417 & 1.237   & 1.0954 & 1.0186 \\
        \bottomrule
    \end{tabular}
\end{table}
  • 2
    Please, add the necessary packages that are needed for typesetting the example. Did you try {\num{10e-1}}? It seems to be all that's needed. – egreg Dec 23 '12 at 23:21
  • Is & \multicolumn{4}{c}{\num{10e-1}\quad\num{10e-3}} \\ what you are looking for? Does not quite make sense to me, but that does place both the 10e-1 and 10e-3 at the center of the 4 columns. – Peter Grill Dec 23 '12 at 23:28
  • @PeterGrill yeah right...now it works great.... – Mazzy Dec 23 '12 at 23:32
7

To get the two elements centered within the four columns, simply treat them as one \multicolumn element:

& \multicolumn{4}{c}{\num{10e-1}\quad\num{10e-3}} \\ 

enter image description here

Code:

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}
\begin{table}[htp]
    \centering
    \begin{tabular}{lS[table-format=1.4]
                     S[table-format=1.4]
                     S[table-format=1.4]
                     S[table-format=1.4]}
        \toprule
            {\emph{Nodi}} & \multicolumn{4}{c}{PEP} \\
            \cmidrule(lr){2-5}
                        & \multicolumn{4}{c}{\num{10e-1}\quad\num{10e-3}}  \\
            \cmidrule(lr){2-5}
                        & {BC}   & {PNC}    & {BC} & {PNC} \\
        \midrule
        1               & 1.1107 & 1.1112  & 1.001  & 1.001 \\
        3               & 1.3046 & 1.1488  & 1.003  & 1.0029 \\
        7               & 1.597  & 1.1734  & 1.007  & 1.006 \\
        12              & 1.8435 & 1.188   & 1.0117 & 1.0089 \\
        20              & 2.0836 & 1.2009  & 1.0201 & 1.0122 \\
        25              & 2.1777 & 1.2064  & 1.0246 & 1.0134 \\
        35              & 2.3101 & 1.2141  & 1.0347 & 1.0153 \\
        50              & 2.4443 & 1.2223  & 1.0488 & 1.0167 \\
        65              & 2.5501 & 1.228   & 1.0636 & 1.0175 \\
        75              & 2.6109 & 1.2308  & 1.0723 & 1.0178 \\
        90              & 2.6915 & 1.235   & 1.0864 & 1.0184 \\
        100             & 2.7417 & 1.237   & 1.0954 & 1.0186 \\
        \bottomrule
    \end{tabular}
\end{table}
\end{document}
| improve this answer | |

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.