如何使用 minipage 并旋转 90 度

如何使用 minipage 并旋转 90 度
\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{booktabs}      % nice rules
\usepackage{adjustbox}     % adjusting table (too wide)
\usepackage{rotating}      % sidewaytables
\usepackage{array}

\begin{document}


\begin{sidewaystable}
\centering
\begin{minipage}{0.5 \textwidth}
\begin{tabular}{
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
}
    \toprule
              & \multicolumn{2}{c}{\text{PPN2003}} 
              & \multicolumn{2}{c}{\text{Our}} \\
    \ell_{\text{max}}
    & \multicolumn{2}{c}{$-461.708$}
    & \multicolumn{2}{c}{$-457.741$} \\
    \midrule
        \text{Parameter}
              & \text{Estimate}   & \text{Gradient} 
              & \text{Estimate}   & \text{Gradient} \\
            w_1          & 0.505 & -0.936& 0.308  & 0.000 \\
            w_2          & 0.121 & 2.350 & 0.273  & 0.000 \\
            w_3          & 0.000 & -7.073& 0.000  & 0.000 \\
            \eta_{p2}    & 8.201 & 0.021 & 19.189 & 0.000 \\
            \eta_{\phi 2}& 1.568 & 0.105 & 13.166 & 0.000 \\
            \mu_p        & 2.168 & 0.048 & 2.233  & 0.000 \\
            \mu_\phi     & -0.386& -2.562& -11.472& 0.000 \\
            \tau_{p3}    & -1.296& 0.013 & -1.236 & 0.000 \\
            \tau_{p4}    & -3.081& -0.051& -2.740 & 0.000 \\
            \tau_{p5}    & -2.534& 0.038 & -2.267 & 0.000 \\
            \tau_{p6}    & -1.903& -0.007& -1.844 & 0.000 \\
            \tau_{p7}    & -2.437& -0.002& -2.250 & 0.000 \\
            \tau_{p8}    & -1.100& 0.007 & -0.851 & 0.000 \\
            \tau_{p9}    & 1.367 & 0.044 & 8.376  & 0.000 \\
            \tau_{\phi 2}& 0.283 & -0.227& -0.662 & 0.000 \\
            \tau_{\phi 3}& 1.620 & -0.279& 0.296  & 0.000 \\
            \tau_{\phi 4}& 0.552 & -0.381& -0.185 & 0.000 \\
            \tau_{\phi 5}& -0.433& -0.399& -1.199 & 0.000 \\
            \tau_{\phi 6}& 0.199 & -0.410& -0.656 & 0.000 \\
            \tau_{\phi 7}& 0.101 & -0.320& -0.358 & 0.000 \\
            \tau_{\phi 8}& -0.333& -0.388& -1.004 & 0.000 \\
    \bottomrule
\end{tabular}
\end{minipage}
%
\begin{minipage}{0.5 \textwidth}
\begin{tabular}{
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}
}
    \toprule
    & \multicolumn{2}{c|}{\text{PPN2003}} & \multicolumn{2}{c}{\text{Our}} \\
    & c=1   & c=2   & c=1   & c=2 \\
    \midrule
        p_{2c} & 0.897 & 1.000 & 0.903 & 1.000 \\
        p_{3c} & 0.705 & 1.000 & 0.730 & 1.000 \\
        p_{4c} & 0.286 & 0.999 & 0.376 & 1.000 \\
        p_{5c} & 0.410 & 1.000 & 0.492 & 1.000 \\
        p_{6c} & 0.566 & 1.000 & 0.596 & 1.000 \\
        p_{7c} & 0.433 & 1.000 & 0.496 & 1.000 \\
        p_{8c} & 0.744 & 1.000 & 0.799 & 1.000 \\
        p_{9c} & 0.972 & 1.000 & 1.000 & 1.000 \\
    \midrule
        \phi_{1c} & 0.405 & 0.765 & 0.000 & 0.845 \\
        \phi_{2c} & 0.475 & 0.812 & 0.000 & 0.737 \\
        \phi_{3c} & 0.775 & 0.943 & 0.000 & 0.880 \\
        \phi_{4c} & 0.542 & 0.850 & 0.000 & 0.819 \\
        \phi_{5c} & 0.306 & 0.679 & 0.000 & 0.621 \\
        \phi_{6c} & 0.454 & 0.799 & 0.000 & 0.738 \\
        \phi_{7c} & 0.429 & 0.783 & 0.000 & 0.792 \\
        \phi_{8c} & 0.328 & 0.700 & 0.000 & 0.666 \\
    \bottomrule
\end{tabular}
\end{minipage}
    \caption{XXXXXXXXXXXXX}
    \label{tab:4Cmodelpars}
\end{sidewaystable}


\end{document}

我觉得sidewaystable这里不应该用这个?但是我试过很多包,还是不能让它正常工作。

我想要的是这样的:

在此处输入图片描述

答案1

siunitx这是一个可能的解决方案。还请注意数字表的用法。

\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{subcaption}
\usepackage{booktabs} % nice rules
\usepackage{adjustbox} % adjusting table (too wide) 
\usepackage{rotating} % sidewaytables
\usepackage{siunitx}

\begin{document}


\begin{table}[p]
\centering
\rotatebox[origin=bl]{90}{%
\begin{subtable}[b]{0.55\textheight}
\centering
\begin{tabular}{
  >{$}l<{$}
  S[table-format=-1.3]
  S[table-format=-2.3]
  S[table-format=-2.3]
  S[table-format=1.3]
}
\toprule
  & \multicolumn{2}{c}{PPN2003}
  & \multicolumn{2}{c}{Our} \\
l_{\text{max}}
  & \multicolumn{2}{c}{$-461.708$}
  & \multicolumn{2}{c}{$-457.741$} \\
\midrule
\text{Parameter}
  & {Estimate} & {Gradient} 
  & {Estimate} & {Gradient} \\
w_1           &  0.505 & -0.936 &   0.308 & 0.000 \\
w_2           &  0.121 &  2.350 &   0.273 & 0.000 \\
w_3           &  0.000 & -7.073 &   0.000 & 0.000 \\
\eta_{p2}     &  8.201 &  0.021 &  19.189 & 0.000 \\
\eta_{\phi 2} &  1.568 &  0.105 &  13.166 & 0.000 \\
\mu_p         &  2.168 &  0.048 &   2.233 & 0.000 \\
\mu_\phi      & -0.386 & -2.562 & -11.472 & 0.000 \\
\tau_{p3}     & -1.296 &  0.013 &  -1.236 & 0.000 \\
\tau_{p4}     & -3.081 & -0.051 &  -2.740 & 0.000 \\
\tau_{p5}     & -2.534 &  0.038 &  -2.267 & 0.000 \\
\tau_{p6}     & -1.903 & -0.007 &  -1.844 & 0.000 \\
\tau_{p7}     & -2.437 & -0.002 &  -2.250 & 0.000 \\
\tau_{p8}     & -1.100 &  0.007 &  -0.851 & 0.000 \\
\tau_{p9}     &  1.367 &  0.044 &   8.376 & 0.000 \\
\tau_{\phi 2} &  0.283 & -0.227 &  -0.662 & 0.000 \\
\tau_{\phi 3} &  1.620 & -0.279 &   0.296 & 0.000 \\
\tau_{\phi 4} &  0.552 & -0.381 &  -0.185 & 0.000 \\
\tau_{\phi 5} & -0.433 & -0.399 &  -1.199 & 0.000 \\
\tau_{\phi 6} &  0.199 & -0.410 &  -0.656 & 0.000 \\
\tau_{\phi 7} &  0.101 & -0.320 &  -0.358 & 0.000 \\
\tau_{\phi 8} & -0.333 & -0.388 &  -1.004 & 0.000 \\
\bottomrule
\end{tabular}
\caption{This is the first subtable}
\end{subtable}\qquad
\begin{subtable}[b]{0.35\textheight}
\centering
\begin{tabular}{
  >{$}l<{$}
  S[table-format=1.3]
  S[table-format=1.3]
  S[table-format=1.3]
  S[table-format=1.3]
}
\toprule
  & \multicolumn{2}{c}{PPN2003} & \multicolumn{2}{c}{Our} \\
  & {$c=1$}   & {$c=2$}   & {$c=1$}   & {$c=2$} \\
\cmidrule(lr){2-3}\cmidrule(lr){4-5}
p_{2c} & 0.897 & 1.000 & 0.903 & 1.000 \\
p_{3c} & 0.705 & 1.000 & 0.730 & 1.000 \\
p_{4c} & 0.286 & 0.999 & 0.376 & 1.000 \\
p_{5c} & 0.410 & 1.000 & 0.492 & 1.000 \\
p_{6c} & 0.566 & 1.000 & 0.596 & 1.000 \\
p_{7c} & 0.433 & 1.000 & 0.496 & 1.000 \\
p_{8c} & 0.744 & 1.000 & 0.799 & 1.000 \\
p_{9c} & 0.972 & 1.000 & 1.000 & 1.000 \\
\midrule
\phi_{1c} & 0.405 & 0.765 & 0.000 & 0.845 \\
\phi_{2c} & 0.475 & 0.812 & 0.000 & 0.737 \\
\phi_{3c} & 0.775 & 0.943 & 0.000 & 0.880 \\
\phi_{4c} & 0.542 & 0.850 & 0.000 & 0.819 \\
\phi_{5c} & 0.306 & 0.679 & 0.000 & 0.621 \\
\phi_{6c} & 0.454 & 0.799 & 0.000 & 0.738 \\
\phi_{7c} & 0.429 & 0.783 & 0.000 & 0.792 \\
\phi_{8c} & 0.328 & 0.700 & 0.000 & 0.666 \\
\bottomrule
\end{tabular}
\caption{This is the second subcaption}
\end{subtable}%
}% end of \rotatebox

\caption{XXXXXXXXXXXXX}
\label{tab:4Cmodelpars}
\end{table}


\end{document}

在此处输入图片描述

答案2

这用于\rotatebox旋转minipages并使用堆叠将子标题放置在表格下方。

\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{booktabs}      % nice rules
\usepackage{adjustbox}     % adjusting table (too wide)
\usepackage{rotating}      % sidewaytables
\usepackage{array}
\usepackage{stackengine}
\begin{document}

\begin{table}
\rotatebox{90}{
\begin{minipage}{0.70 \textwidth}
\stackunder[12pt]{
\begin{tabular}{
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
}
    \toprule
              & \multicolumn{2}{c}{\text{PPN2003}} 
              & \multicolumn{2}{c}{\text{Our}} \\
    \ell_{\text{max}}
    & \multicolumn{2}{c}{$-461.708$}
    & \multicolumn{2}{c}{$-457.741$} \\
    \midrule
        \text{Parameter}
              & \text{Estimate}   & \text{Gradient} 
              & \text{Estimate}   & \text{Gradient} \\
            w_1          & 0.505 & -0.936& 0.308  & 0.000 \\
            w_2          & 0.121 & 2.350 & 0.273  & 0.000 \\
            w_3          & 0.000 & -7.073& 0.000  & 0.000 \\
            \eta_{p2}    & 8.201 & 0.021 & 19.189 & 0.000 \\
            \eta_{\phi 2}& 1.568 & 0.105 & 13.166 & 0.000 \\
            \mu_p        & 2.168 & 0.048 & 2.233  & 0.000 \\
            \mu_\phi     & -0.386& -2.562& -11.472& 0.000 \\
            \tau_{p3}    & -1.296& 0.013 & -1.236 & 0.000 \\
            \tau_{p4}    & -3.081& -0.051& -2.740 & 0.000 \\
            \tau_{p5}    & -2.534& 0.038 & -2.267 & 0.000 \\
            \tau_{p6}    & -1.903& -0.007& -1.844 & 0.000 \\
            \tau_{p7}    & -2.437& -0.002& -2.250 & 0.000 \\
            \tau_{p8}    & -1.100& 0.007 & -0.851 & 0.000 \\
            \tau_{p9}    & 1.367 & 0.044 & 8.376  & 0.000 \\
            \tau_{\phi 2}& 0.283 & -0.227& -0.662 & 0.000 \\
            \tau_{\phi 3}& 1.620 & -0.279& 0.296  & 0.000 \\
            \tau_{\phi 4}& 0.552 & -0.381& -0.185 & 0.000 \\
            \tau_{\phi 5}& -0.433& -0.399& -1.199 & 0.000 \\
            \tau_{\phi 6}& 0.199 & -0.410& -0.656 & 0.000 \\
            \tau_{\phi 7}& 0.101 & -0.320& -0.358 & 0.000 \\
            \tau_{\phi 8}& -0.333& -0.388& -1.004 & 0.000 \\
    \bottomrule
\end{tabular}
}{(a) subcaption to first table}
\end{minipage}%
\hspace{0.18\textwidth}
%
\begin{minipage}{0.40 \textwidth}
\stackunder[87pt]{
\begin{tabular}{
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}
}
    \toprule
    & \multicolumn{2}{c|}{\text{PPN2003}} & \multicolumn{2}{c}{\text{Our}} \\
    & c=1   & c=2   & c=1   & c=2 \\
    \midrule
        p_{2c} & 0.897 & 1.000 & 0.903 & 1.000 \\
        p_{3c} & 0.705 & 1.000 & 0.730 & 1.000 \\
        p_{4c} & 0.286 & 0.999 & 0.376 & 1.000 \\
        p_{5c} & 0.410 & 1.000 & 0.492 & 1.000 \\
        p_{6c} & 0.566 & 1.000 & 0.596 & 1.000 \\
        p_{7c} & 0.433 & 1.000 & 0.496 & 1.000 \\
        p_{8c} & 0.744 & 1.000 & 0.799 & 1.000 \\
        p_{9c} & 0.972 & 1.000 & 1.000 & 1.000 \\
    \midrule
        \phi_{1c} & 0.405 & 0.765 & 0.000 & 0.845 \\
        \phi_{2c} & 0.475 & 0.812 & 0.000 & 0.737 \\
        \phi_{3c} & 0.775 & 0.943 & 0.000 & 0.880 \\
        \phi_{4c} & 0.542 & 0.850 & 0.000 & 0.819 \\
        \phi_{5c} & 0.306 & 0.679 & 0.000 & 0.621 \\
        \phi_{6c} & 0.454 & 0.799 & 0.000 & 0.738 \\
        \phi_{7c} & 0.429 & 0.783 & 0.000 & 0.792 \\
        \phi_{8c} & 0.328 & 0.700 & 0.000 & 0.666 \\
    \bottomrule
\end{tabular}
}{(b) subcaption to second table}
\end{minipage}
}
    \caption{XXXXXXXXXXXXX}
    \label{tab:4Cmodelpars}
\end{table}

\end{document}

在此处输入图片描述

答案3

这是使用瑞士军刀的尝试,又名tikz

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{capt-of}
\usepackage{booktabs}      % nice rules
\usepackage{tikzpagenodes}     % adjusting table (too wide)
\usepackage{array}
\usetikzlibrary{positioning}

\begin{document}
\begin{table}[htb]
\begin{tikzpicture}[remember picture]
\node[anchor=south west,rotate=90,text width=0.6\textheight,align=center] (a) at ([yshift=0cm]current page text area.west) {
\begin{tabular}{
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
>{$}c<{$}
}
    \toprule
              & \multicolumn{2}{c}{\text{PPN2003}}
              & \multicolumn{2}{c}{\text{Our}} \\
    \ell_{\text{max}}
    & \multicolumn{2}{c}{$-461.708$}
    & \multicolumn{2}{c}{$-457.741$} \\
    \midrule
        \text{Parameter}
              & \text{Estimate}   & \text{Gradient}
              & \text{Estimate}   & \text{Gradient} \\
            w_1          & 0.505 & -0.936& 0.308  & 0.000 \\
            w_2          & 0.121 & 2.350 & 0.273  & 0.000 \\
            w_3          & 0.000 & -7.073& 0.000  & 0.000 \\
            \eta_{p2}    & 8.201 & 0.021 & 19.189 & 0.000 \\
            \eta_{\phi 2}& 1.568 & 0.105 & 13.166 & 0.000 \\
            \mu_p        & 2.168 & 0.048 & 2.233  & 0.000 \\
            \mu_\phi     & -0.386& -2.562& -11.472& 0.000 \\
            \tau_{p3}    & -1.296& 0.013 & -1.236 & 0.000 \\
            \tau_{p4}    & -3.081& -0.051& -2.740 & 0.000 \\
            \tau_{p5}    & -2.534& 0.038 & -2.267 & 0.000 \\
            \tau_{p6}    & -1.903& -0.007& -1.844 & 0.000 \\
            \tau_{p7}    & -2.437& -0.002& -2.250 & 0.000 \\
            \tau_{p8}    & -1.100& 0.007 & -0.851 & 0.000 \\
            \tau_{p9}    & 1.367 & 0.044 & 8.376  & 0.000 \\
            \tau_{\phi 2}& 0.283 & -0.227& -0.662 & 0.000 \\
            \tau_{\phi 3}& 1.620 & -0.279& 0.296  & 0.000 \\
            \tau_{\phi 4}& 0.552 & -0.381& -0.185 & 0.000 \\
            \tau_{\phi 5}& -0.433& -0.399& -1.199 & 0.000 \\
            \tau_{\phi 6}& 0.199 & -0.410& -0.656 & 0.000 \\
            \tau_{\phi 7}& 0.101 & -0.320& -0.358 & 0.000 \\
            \tau_{\phi 8}& -0.333& -0.388& -1.004 & 0.000 \\
    \bottomrule
\end{tabular}
\captionof{table}{my table}
};
%
\node[anchor=south west,rotate=90,text width=0.3\textheight,align=center] at (a.south east) {
\begin{tabular}{
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}|
>{$}c<{$}
>{$}c<{$}
}
    \toprule
    & \multicolumn{2}{c|}{\text{PPN2003}} & \multicolumn{2}{c}{\text{Our}} \\
    & c=1   & c=2   & c=1   & c=2 \\
    \midrule
        p_{2c} & 0.897 & 1.000 & 0.903 & 1.000 \\
        p_{3c} & 0.705 & 1.000 & 0.730 & 1.000 \\
        p_{4c} & 0.286 & 0.999 & 0.376 & 1.000 \\
        p_{5c} & 0.410 & 1.000 & 0.492 & 1.000 \\
        p_{6c} & 0.566 & 1.000 & 0.596 & 1.000 \\
        p_{7c} & 0.433 & 1.000 & 0.496 & 1.000 \\
        p_{8c} & 0.744 & 1.000 & 0.799 & 1.000 \\
        p_{9c} & 0.972 & 1.000 & 1.000 & 1.000 \\
    \midrule
        \phi_{1c} & 0.405 & 0.765 & 0.000 & 0.845 \\
        \phi_{2c} & 0.475 & 0.812 & 0.000 & 0.737 \\
        \phi_{3c} & 0.775 & 0.943 & 0.000 & 0.880 \\
        \phi_{4c} & 0.542 & 0.850 & 0.000 & 0.819 \\
        \phi_{5c} & 0.306 & 0.679 & 0.000 & 0.621 \\
        \phi_{6c} & 0.454 & 0.799 & 0.000 & 0.738 \\
        \phi_{7c} & 0.429 & 0.783 & 0.000 & 0.792 \\
        \phi_{8c} & 0.328 & 0.700 & 0.000 & 0.666 \\
    \bottomrule
\end{tabular}
    \caption{XXXXXXXXXXXXX}
};
\end{tikzpicture}
\caption{Common caption}
\end{table}


\end{document}

在此处输入图片描述

相关内容