colunas não têm o mesmo tamanho, embora centralizadas

colunas não têm o mesmo tamanho, embora centralizadas

fiz uma mesa assim

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
  \begin{document}
    \begin{table}[htb]
        \centering
        \caption{Reproduzierbarkeit der Elektroden}
        \begin{tabular}{ccccc|c|c|c|c|}
            \toprule
                \textbf{Elektrode} &\multicolumn{4}{c}{\textbf{Mittelwert [mV]}} &\multicolumn{4}{c}{\textbf{maximale Abweichung [\%]}} \\  
            \midrule
                &pH 6 &pH 7 & pH 8 &pH 9 &pH 6 &pH 7 &pH 8&pH 9\\
            \cmidrule[0.5pt]{2-9}
                 6 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 7 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 8 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 9 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
            \bottomrule
            \label{tab:reproduzierbarkeit}
        \end{tabular} 
    \end{table}
  \end{document}

e o que eu recebo é:

insira a descrição da imagem aqui

Então, por que a largura da nona coluna é maior que as outras, embora todas as linhas estejam centralizadas? Como posso mudar isso para que cada coluna tenha a mesma largura?

Obrigado!

Responder1

Você precisa ter certeza de que as células estendidas são mais largas do que a entrada de várias colunas.

insira a descrição da imagem aqui

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
  \begin{document}
    \begin{table}[htb]
        \centering
        \newcommand\x{\makebox[1pt]{}}
        \caption{Reproduzierbarkeit der Elektroden}
        \begin{tabular}{@{}c*4{>\x c<\x}|*4{>\x c<\x|}@{}}
            \toprule
                \textbf{Elektrode} &\multicolumn{4}{c}{\textbf{Mittelwert [mV]}} &\multicolumn{4}{c}{\textbf{maximale Abweichung [\%]}} \\  
            \midrule
                &pH 6 &pH 7 & pH 8 &pH 9 &pH 6 &pH 7 &pH 8&pH 9\\
            \cmidrule[0.5pt]{2-9}
                 6 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 7 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 8 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
                 9 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
            \bottomrule
            \label{tab:reproduzierbarkeit}
        \end{tabular} 
    \end{table}
  \end{document}

Responder2

Você poderia fazer isso. Não sei quais exatamente você deseja com largura igual. Isso faz com que as quatro colunas finais tenham largura igual usando um novo tipo de coluna H:

\documentclass{article}
\usepackage{array,calc}
\newlength{\origtabcolsep}
\setlength{\origtabcolsep}{\tabcolsep}
\newlength{\mycolswidth}
\settowidth{\mycolswidth}{\textbf{maximale Abweichung [\%]}}
\newlength{\mycolwidth}
\setlength{\mycolwidth}{.25\mycolswidth-.75\tabcolsep}
\newcolumntype{H}{>{\centering\arraybackslash}p{\mycolwidth}|}
\usepackage{booktabs}
\begin{document}
  \begin{table}[htb]
      \centering
      \caption{Reproduzierbarkeit der Elektroden}
      \setlength{\tabcolsep}{.75\origtabcolsep}
      \begin{tabular}{*{5}{c}|*{4}{H}}
          \toprule
              \textbf{Elektrode} &\multicolumn{4}{c}{\textbf{Mittelwert [mV]}} &\multicolumn{4}{c}{\textbf{maximale Abweichung [\%]}} \\
          \midrule
              &pH 6 &pH 7 & pH 8 &pH 9 &pH 6 &pH 7 &pH 8&pH 9\\
          \cmidrule[0.5pt]{2-9}
               6 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
               7 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
               8 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
               9 & 111 & 111 & 111 & 111 & 10 & 12 & 13 & 11\\
          \bottomrule
          \label{tab:reproduzierbarkeit}
      \end{tabular}
  \end{table}
\end{document}

Tabular usando novo tipo de coluna, H, para as 4 colunas finais

informação relacionada