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

I dont think that sidewaystable should be used here? But I have tried many packages and just can't quite get it to work.

What I want, is something like this:

enter image description here

1
  • One problem is, with stray spaces, your two tables exceed the \textwidth, and so a linefeed occurs. Try something like: \begin{minipage}{0.40 \textwidth}...\end{minipage}\hspace{0.18\textwidth}}\begin{minipage}{0.40 \textwidth}...\end{minipage} Dec 15, 2014 at 15:25

3 Answers 3

10

Here's a possible solution. Note also the usage of siunitx for the numeric tables.

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

enter image description here

4
  • how to place the tables above one another instead of side by side, what is the actual parameter i have to adjust/lookup?
    – droid192
    Apr 23, 2019 at 11:49
  • @ItsmeJulian Change \qquad between the two subtables into a blank line
    – egreg
    Apr 23, 2019 at 12:41
  • thank you. How do i reference each table with one label each (not the common one 4Cmodelpars)?
    – droid192
    Apr 23, 2019 at 12:59
  • @ItsmeJulian You add a \label in the subtable environment; as usual, inside the argument to \caption or after it.
    – egreg
    Apr 23, 2019 at 13:18
6

This uses \rotatebox to rotate the minipages and using stacking to place the subcaptions under the tables.

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

enter image description here

5

Here is an attempt using swiss army knife aka 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .