Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
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

1 Answer 1

up vote 7 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.