Alinhar entradas da tabela

Alinhar entradas da tabela

Talvez minha dúvida seja trivial, mas agradeço se alguém puder me ajudar a alinhar as colunas da minha tabela. O problema é que as entradas não estão alinhadas em colunas bonitas. Aqui está um exemplo prático:

    \documentclass[12pt]{article}
    \usepackage{graphicx}
    \usepackage{booktabs,multirow,tabularx,multicol}
    \begin{document}
    \begin{table}
        \resizebox{1\columnwidth}{!}{%
            \begin{tabular}{ccccccccccccccccccc}
                \toprule
                \multicolumn{3}{c}{Bookmaker's Odds} && \multicolumn{3}{c}{Bookmaker's Probabilities} && \multicolumn{3}{c}{Equal Weighting} && \multicolumn{3}{c}{Proportional Weighting} &&   \multicolumn{3}{c}{Logarithmic Weighting} \\
                \cmidrule(l){1-3} \cmidrule(l){5-7} \cmidrule(l){9-11} \cmidrule(l){13-15} \cmidrule(l){17-19}
                1  &  5  &  1 && 2 & 2 & 2  && 2  &  2  &  2    && 2 & 2 & 2 && 2 & 2 & 2 \\
                3  &  3  &  3 && 2 & 2 & 2  && 2  &  2  &  2    && 2 & 2 & 2 && 2 & 2 & 2 \\
                1  &  5  &  1 && 2 & 2 & 2  && 2  &  2  &  2    && 2 & 2 & 2 && 2 & 2 & 2 \\   
                \bottomrule
            \end{tabular}
        }
    \end{table}
\end{document}

Responder1

Isso ocorre porque os cabeçalhos das colunas são muito grandes. Proponho usar tabularxpara garantir que a tabela não ultrapasse a margem, makecellpara permitir quebras de linha nas colunas padrão e, como os cabeçalhos das colunas ainda são um pouco largos, coloquei-os em uma caixa com largura nula e reduzi o espaçamento entre colunas :

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{booktabs,multirow, makecell, tabularx,multicol}

\begin{document}

\begin{table}
\centering\setlength{\tabcolsep}{4pt}
\renewcommand{\theadfont}{\small}
        \begin{tabularx}{\linewidth}{*{19}{@{}>{\centering\arraybackslash}X}@{}}
            \toprule
            \multicolumn{3}{c}{\makebox[0pt]{\thead{Bookmaker's\\ Odds}}} && \multicolumn{3}{c}{\makebox[0pt]{\thead{Bookmaker's\\ Probabilities}}} && \multicolumn{3}{c}{\makebox[0pt]{\thead{Equal\\ Weighting}}} && \multicolumn{3}{c}{\makebox[0pt]{\thead{Proportional\\ Weighting}}} && \multicolumn{3}{c}{\makebox[0pt]{\thead{Logarithmic\\ Weighting}}} \\
            \cmidrule{1-3} \cmidrule{5-7} \cmidrule{9-11} \cmidrule{13-15} \cmidrule{17-19}
            1 & 5 & 1 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 \\
            3 & 3 & 3 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 \\
            1 & 5 & 1 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 && 2 & 2 & 2 \\
            \bottomrule
        \end{tabularx}
\end{table}

\end{document} 

insira a descrição da imagem aqui

informação relacionada