将宽表居中

将宽表居中

我似乎无法将这个表格居中。这是我的代码。我也尝试过使用 \centering。有一个很大的缩进,表格一直延伸到页面的右边缘。

\documentclass{article}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
    \begin{document}
        \begin{center}
            \begin{tabularx}{1.55\textwidth}{c *{10}{Y}}
            \toprule\toprule

            & \multicolumn{5}{c}{Reward+Private}  
            & \multicolumn{5}{c}{No Reward+Public}\\
            & \multicolumn{5}{c}{minus No Reward+Private}  
            & \multicolumn{5}{c}{minus No Reward+Private}\\
            \cmidrule(lr){2-6} \cmidrule(l){7-11}
            &\multicolumn{5}{c}{Price}&\multicolumn{5}{c}{Price}\\
            \cmidrule(lr){2-6} \cmidrule(l){7-11}
            Endowment& 0.5  & 1    & 1.5  & 2    & Mean 
                     & 0.5  & 1    & 1.5  & 2    & Mean\\
            \midrule
            2.40     & $-.0068$ & $-.0168$  & .0157 &.0816 & .0211 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.0825) & (.0646) & (.0641) & (.0724) & (.0350) 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            3.60     & .0511 & .0516 & .0572 & .1212 & .0719 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.0769) & (.0599) & (.0614) & (.0672) & (.0328) 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            Mean     & .0228 & .0173 & .0367 & .1013 & .0467 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.1013) & (.0438) & (.0441) & (.0491) & (.0239) 
                     & x.xx & x.xx & x.xx & x.xx & \\

            \bottomrule
        \end{tabularx}
    \end{center}
    \end{document}

答案1

表格太宽,无法居中。

如果您坚持使用宽表,则可以使用sidewaystablefromrotating包。

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx, booktabs, rotating}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
    \begin{document}
        \begin{center}
        \begin{sidewaystable}
            \begin{tabularx}{\textwidth}{c *{10}{Y}}
            \toprule\toprule

            & \multicolumn{5}{c}{Reward+Private}  
            & \multicolumn{5}{c}{No Reward+Public}\\
            & \multicolumn{5}{c}{minus No Reward+Private}  
            & \multicolumn{5}{c}{minus No Reward+Private}\\
            \cmidrule(lr){2-6} \cmidrule(l){7-11}
            &\multicolumn{5}{c}{Price}&\multicolumn{5}{c}{Price}\\
            \cmidrule(lr){2-6} \cmidrule(l){7-11}
            Endowment& 0.5  & 1    & 1.5  & 2    & Mean 
                     & 0.5  & 1    & 1.5  & 2    & Mean\\
            \midrule
            2.40     & $-.0068$ & $-.0168$  & .0157 &.0816 & .0211 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.0825) & (.0646) & (.0641) & (.0724) & (.0350) 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            3.60     & .0511 & .0516 & .0572 & .1212 & .0719 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.0769) & (.0599) & (.0614) & (.0672) & (.0328) 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            Mean     & .0228 & .0173 & .0367 & .1013 & .0467 
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & (.1013) & (.0438) & (.0441) & (.0491) & (.0239) 
                     & x.xx & x.xx & x.xx & x.xx & \\

            \bottomrule
        \end{tabularx}
        \end{sidewaystable}
    \end{center}
    \end{document}

但我认为两个分开的表格看起来并不是那么糟糕,而且很容易比较彼此之间的值。

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

    \begin{document}
        \begin{center}
            \begin{tabularx}{\textwidth}{c *{5}{Y}}
            \toprule\toprule
            & \multicolumn{5}{c}{Reward+Private}  \\
            & \multicolumn{5}{c}{minus No Reward+Private} \\ 
            \cmidrule(lr){2-6} 
            &\multicolumn{5}{c}{Price}\\
            \cmidrule(lr){2-6} 
            Endowment& 0.5  & 1    & 1.5  & 2    & Mean\\
            \midrule
            2.40     & $-.0068$ & $-.0168$  & .0157 &.0816 & .0211 \\
                     & (.0825) & (.0646) & (.0641) & (.0724) & (.0350)\\
            3.60     & .0511 & .0516 & .0572 & .1212 & .0719\\
                     & (.0769) & (.0599) & (.0614) & (.0672) & (.0328) \\
            Mean     & .0228 & .0173 & .0367 & .1013 & .0467\\
                     & (.1013) & (.0438) & (.0441) & (.0491) & (.0239) \\
            \bottomrule
        \end{tabularx}
    \end{center}

    \begin{center}
            \begin{tabularx}{\textwidth}{c *{5}{Y}}
            \toprule\toprule

            & \multicolumn{5}{c}{No Reward+Public}\\
            & \multicolumn{5}{c}{minus No Reward+Private}\\
            \cmidrule(lr){2-6}            
            &\multicolumn{5}{c}{Price}\\
            \cmidrule(lr){2-6}
            Endowment& 0.5  & 1    & 1.5  & 2    & Mean \\
            \midrule
            2.40     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            3.60     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            Mean     & x.xx & x.xx & x.xx & x.xx & x.xx\\
                     & x.xx & x.xx & x.xx & x.xx & x.xx\\
            \bottomrule
        \end{tabularx}
        \end{center}
    \end{document}

相关内容