Tabelleneinträge ausrichten

Tabelleneinträge ausrichten

Vielleicht ist meine Frage trivial, aber ich wäre dankbar, wenn mir jemand beim Ausrichten der Spalten meiner Tabelle helfen könnte. Das Problem ist, dass die Einträge nicht in schönen Spalten ausgerichtet sind. Hier ist ein funktionierendes Beispiel:

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

Antwort1

Dies liegt daran, dass die Spaltenköpfe zu groß sind. Ich schlage vor, zu verwenden, tabularxum sicherzustellen, dass die Tabelle nicht in den Rand überläuft, makecellZeilenumbrüche in Standardspalten zuzulassen und da die Spaltenköpfe immer noch etwas zu breit sind, habe ich sie in ein Feld mit Nullbreite eingefügt und den Abstand zwischen den Spalten verringert:

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

Bildbeschreibung hier eingeben

verwandte Informationen