las columnas no tienen el mismo tamaño aunque estén centradas

las columnas no tienen el mismo tamaño aunque estén centradas

Hice una mesa como esta

\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}

y lo que obtengo es:

ingrese la descripción de la imagen aquí

Entonces, ¿por qué el ancho de la novena columna es mayor que el de las demás, aunque todas las filas están centradas? ¿Cómo puedo cambiar esto para que cada columna tenga el mismo ancho?

¡Gracias!

Respuesta1

Debe asegurarse de que las celdas distribuidas sean más anchas que la entrada de varias columnas.

ingrese la descripción de la imagen aquí

\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}

Respuesta2

Podrías hacer esto. No sé exactamente cuáles quieres del mismo ancho. Esto hace que las últimas cuatro columnas tengan el mismo ancho usando un nuevo tipo de columna 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 el nuevo tipo de columna, H, para las últimas 4 columnas

información relacionada