长表该如何处理?

长表该如何处理?

我有一张很长的水平表格。我把它旋转成垂直表格,并希望它与表格在同一页Appendix。但是,它仍然太长,以至于它自动移动到下一页,留下一页空白。有没有什么办法可以处理这张表格?提前谢谢。

\documentclass[12pt]{report}

\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lipsum}

\begin{document}
\section*{Appendix I: Tables}
\lipsum

\begin{sidewaystable}\hspace*{1cm}
\footnotesize\setlength{\tabcolsep}{0.01pt}
\begin{tabular}{l@{\hspace{0.05pt}} *{18}{c}}
\toprule
\bfseries Model & \multicolumn{18}{c}{\bfseries Parameters} \\
\cmidrule(l){2-18}
& $\omega$ & $\phi$ & $\alpha$ & $\beta$ & $\gamma_1$ & $\gamma_2$ &     $\gamma_3$ & 
$\gamma_4$ & $\gamma_5$ & $\gamma_6$ & $\theta_1$  & $\theta_2$ & $\theta_3$ & $\theta_4$ 
& $\varphi_1$ & $\varphi_2$ & $\varphi_3$ \\
\misrule
\bfseries 1
& 0.235 & 0.766 & 0.0114 & 0.0028 & 0.172 & - & - & - & - & - & -
& - & -  & - & - & -  & -  \\
\bfseries 2
& - & 0.998  & 0.0032 & 0.0002 &  -0.0058 & -0.1887& - & - & - & - & 0.593 &
0.232 & - & - &  0.1476 & -0.1377 & -0.0288 \\
\bfseries 3
& - & 0.892 & 0.0662  & -0.0028 &  -0.0020 & -0.0452 &-0.2072& - & - & - &      0.0389 & 0.6374 & -  & -  & 0.661 & -0.204 & -0.073 \\
\bfseries 4
& 1 & - & - & - & 0.0003 & -0.0006 &  -0.0005 & 0.0002
-&-& &  0.823 & - & - & - & 0.0454 & -0.1384 \\
\bfseries 5
& 1 & - &  0.0054 & - & 0.0010 & -0.0002 & 0.0006 & -0.0020 & 0.0003 & -0.0007     & 0.8524 & 0.2764 & -0.2393& 0.0348 & 0.0395 & -0.4177&- \\
\midrule
\bfseries 6
& 0 & 0.42 & 0.0093& 0.0012 & 0.0052 & - & - & - & - & - & -
& - & - & - & - & - & -  \\
\bfseries 7
& 1 & 0.869  & -0.0238 & 0.0138 & -0.0055 & -0.1819 & - & - & - & - & -0.0055
& -0.1810 & - & - & -0.249 & 0.734 & - \\
\bfseries 8
& - & 0.944  & 0.0241 & 0.0010 & 0.0276 & -0.0508 & -0.2321 & - & - & - & 0.8437
& -0.0006 & - & - & -0.2746 & -0.1223 & 0.0077 & - \\
\bfseries 9
& 1 & 0.856 & -0.115 & 0.0207 & 0.0005 & -0.0010 & 0.0037 & 0.0005 & - & - & 0.893
& - & - & - & -0.1 & -0.184 & - \\
\bfseries 10
& 1 & 1 & -0.0069 & 0.0002 & -0.0002 & -0.0007 & -0.0001 & -0.0001 & -0.0001 &     -0.0010 & 0.831 & -0.131 & - & - & - & -0.131 & -0.218  \\
\bottomrule
\addlinespace
\multicolumn{18}{l}{1: DSHW(7, 364) ; 2: BATS(7, 365); 3: BATS(7, 91, 365); 4:     TBATS(7, 365); 5: TBATS(7, 91, 365)} \\
\multicolumn{18}{l}{6: LR+DSHW(7, 364) ; 7: LR+BATS(7, 365); 8:LR+BATS(7, 91, 365); 9: LR+TBATS(7, 365); 10: LR+TBATS(7, 91, 365)} \\
\end{tabular}
\caption{Parameters chosen for all models}\label{tab:Hparameters}
\end{sidewaystable}

\lipsum

\end{document}

在此处输入图片描述

答案1

如果您交换行和列并减少的值,则不需要横向表格。\tabcolsep以下是我的做法:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}%
 \usepackage{geometry}%
 \usepackage{array, booktabs}
\usepackage{siunitx}%
\usepackage[inline]{  enumitem} 
 \usepackage{graphicx, rotating}
\usepackage{lipsum}
\sisetup{table-number-alignment=center}

\begin{document}


\begin{table}[!ht]
\footnotesize\setlength{\tabcolsep}{4pt}%
\renewcommand\arraystretch{1.3}
\begin{tabular}{@{}l S[table-format=1.4]*{4}{S[table-format=-1.4]} S[table-format=1.4]*{4}{S[table-format=-1.4]}@{}}
\toprule
 & \multicolumn{10}{c}{\bfseries Model } \\
 & \bfseries 1 &{\bfseries 2} & {\bfseries 3} & {\bfseries 4} & {\bfseries 5} & {\bfseries 6} & {\bfseries 7} & {\bfseries 8} & {\bfseries 9} & {\bfseries 10} \\
 \midrule
 $\omega$ &0.2350 & {–} & {–} & 1 & 1 & 0 & 1 & {–} & 1 & 1 \\
 $\phi$ & 0.766 & 0.998 &0.892 & {–} & {–} & 0.42 & 0.869 & 0.944 & 0.856 & 1 \\
 $\alpha$ & 0.0114 & 0.0032 & 0.0662 & {–} & 0.0054 & 0.0093 & -0.0238 & 0.0241 & -0.115 & -0.0069\\
 $\beta$ & 0.0028 & 0.0002 & -0.0028 & {–} & {–} & 0.0012 & 0.0138 & 0.0010 & 0.0207 & 0.0002 \\
 \addlinespace
 $\gamma_1$ & 0.172 & -0.0058 & -0.0020 & 0.0003 & 0.0010 &0.0052 & -0.0055 & 0.0276 & 0.0005 & -0.0002 \\
 $\gamma_2$ & {–} & -0.1887 & -0.0452 & -0.0006 & -0.0002 & {–} & -0.1819 & -0.0508 &-0.0010 & -0.0007\\
 $\gamma_3$ & {–} & {–} & -0.2072 & -0.0005 & 0.0006 & {–} & {–} & -0.2321 &0.0037 & -0.0001\\
$\gamma_4$ & {–} & {–} & {–} & 0.0002 & -0.0020 & {–} & {–} & {–} & 0.0005 & -0.0001 \\
\llap{\smash{\rotatebox[origin=c]{90}{\bfseries Paramètres}}\quad} $\gamma_5$ & {–} & {–} & {–} & {–} & 0.0003 & {–} & {–} & {–} & {–} & -0.0001 \\
 $\gamma_6$ & {–} & {–} & {–} & {–} & -0.0007 & {–} & {–} & {–} & {–} & -0.0010 \\
 \addlinespace
$\theta_1$ & {–} & 0.593 & 0.0389 & 0.823 & 0.8524 & {–} & -0.0055 & 0.8437 & 0.893 & 0.831 \\
 $\theta_2$ & {–} & 0.232 & 0.6374 & {–} & 0.2764 & {–} & -0.1810 & -0.0006 & {–} & -0.131 \\
$\theta_3$ & {–} & {–} & {–} & {–} & -0.2393 & {–} & {–} & {–} & {–} & {–} \\
$\theta_4$ & {–} & {–} & {–} & {–} & 0.0348 & {–} & {–} & {–} & {–} & {–} \\
\addlinespace
$\varphi_1$ & {–} & 0.1476 & 0.661 & 0.0454& 0.0395 & {–} & -0.249 & -0.2746 & -0.1 & {–} \\%?
$\varphi_2$ & {–} & -0.1377 & -0.204 & -0.1384 & -0.4177 & {–} & 0.734 & -0.1223 & -0.184 & -0.131 \\
$\varphi_3$ & {–} & -0.0288 & -0.073 & {–} & {–} & {–} & {–} & 0.0077 & {–} & -0.218\\
\bottomrule
\addlinespace
\multicolumn{11}{p{\linewidth}}{
\begin{enumerate*}[label =\arabic*: , itemjoin =\enspace]
  \item DSHW(7, 364)\,;
  \item BATS(7, 365)\,;
  \item BATS(7, 91, 365)\,;
  \item TBATS(7, 365)\,;\newline
  \item TBATS(7, 91, 365)\,;
  \item LR+DSHW(7, 364)\,;
  \item LR+BATS(7, 365)\,;
  \item LR+BATS(7, 91, 365)\,;\newline
  \item LR+TBATS(7, 365)\,;
  \item LR+TBATS(7, 91, 365).
\end{enumerate*}}
\end{tabular}
\caption{Parameters chosen for all models}\label{tab:Hparameters}
\end{table}

\lipsum

\end{document} 

在此处输入图片描述

答案2

sidewaystable是一个浮动元素,它为自己保留一个单独的页面。在这种情况下,您可以tabular在正常table环境内旋转。要实现这一点,只需\usepackage{graphicx}在前言中添加并使用\rotatebox{90}{ ..<your tabular here>.. }。请注意,我已设置fontsize\tiny以查看效果,因为您的表格太高(在最终文档中,您可能不需要这样做,最好不要在该页面中添加任何文本)。

\documentclass[12pt]{report}
\usepackage{booktabs,graphicx}
\usepackage{rotating}
\usepackage{lipsum}

\begin{document}
\section*{Appendix I: Tables}
\lipsum[1-2]

\begin{table}[!tb]
\centering\sffamily
\footnotesize
\caption{Parameters chosen for all models}\label{tab:Hparameters}
\vspace{.1em}
\setlength{\tabcolsep}{0.01pt}
\rotatebox{90}{%
  \begin{tabular}{l@{\hspace{0.05pt}} *{18}{c}}
  \toprule
  \textbf{Model} & \multicolumn{18}{c}{\textbf{Parameters ($\times10^{-3}$)}} \\
  \cmidrule(l){2-18}
  & $\omega$ & $\phi$ & $\alpha$ & $\beta$ & $\gamma_1$ & $\gamma_2$ & $\gamma_3$ & $\gamma_4$ & $\gamma_5$ & $\gamma_6$ & $\theta_1$  & $\theta_2$ & $\theta_3$ & $\theta_4$ 
  & $\varphi_1$ & $\varphi_2$ & $\varphi_3$ \\
  \midrule
  \textbf{1}  & 235  &766 & 11.4& 2.8 & 172& - & - & - & - & - & -  & - & -  & - & - & -  & -  \\
  \textbf{2}  & -    &998 & 3.2 & 0.2 &  -5.8 & -188.7& - & - & - & - & 593&  232& - & - &  147.6 & -137.7 & -28.8 \\
  \textbf{3}  & -    &892 & 66.2& -2.8 &  -2.0 & -45.2 &-207.2& - & - & - &      38.9 & 637.4 & -  & -  & 661& -204& -73\\
  \textbf{4}  & 1000 & -  & -   & - & 0.3 & -0.6 &  -0.5 & 0.2  -&-& &  823& - & - & - & 45.4 & -138.4 \\
  \textbf{5}  & 1000 & -  &  5.4& - & 1.0 & -0.2 & 0.6 & -2.0 & 0.3 & -0.7     & 852.4 & 276.4 & -239.3& 34.8 & 39.5 & -417.7&- \\
  \midrule
  \textbf{6}  & 0    & 42 & 9.3 & 1.2 & 5.2 & - & - & - & - & - & -  & - & - & - & - & - & -  \\
  \textbf{7}  & 1000 &869 &-23.8& 13.8 & -5.5 & -181.9 & - & - & - & - & -5.5  & -181 & - & - & -249& 734& - \\
  \textbf{8}  & -    &944 & 24.1& 1 & 27.6 & -50.8 & -232.1 & - & - & - & 843.7  & -0.6 & - & - & -274.6 & -122.3 & 7.7 & \\
  \textbf{9}  & 1000 &856 &-115 & 20.7 & 0.5 & -1 & 3.7 & 0.5 & - & - & 893 & - & - & - & -1 &-184& - \\
  \textbf{10} & 1000 & 1  & -6.9& 0.2 & -0.2 & -0.7 & -0.1 & -0.1 & -0.1 &     -1 & 831& -131& - & - & - & -131& -218 \\
  \bottomrule
  \addlinespace
  \multicolumn{18}{l}{1: DSHW(7, 364) ; 2: BATS(7, 365); 3: BATS(7, 91, 365); 4: TBATS(7, 365)}\\
  \multicolumn{18}{l}{5: TBATS(7, 91, 365); 6: LR+DSHW(7, 364) ; 7: LR+BATS(7, 365)} \\
  \multicolumn{18}{l}{8: LR+BATS(7, 91, 365); 9: LR+TBATS(7, 365); 10: LR+TBATS(7, 91, 365)}
  \end{tabular}
}%
\end{table}
\lipsum

\end{document}

在此处输入图片描述

答案3

编辑: 您的表格实在太大了!无法将其与附录标题放在同一页上,否则其内容会变得难以阅读。在我看来,您能做的最好的事情就是使用包\afterpage{\clearpage}中的宏afterpage。有了它,表格将出现在标题后的页面上:

在此处输入图片描述

如果您不喜欢这个解决方案,那么您可以坚持 AboAmmar 的回答建议。我的 MWE:

\documentclass[12pt]{report}
\usepackage{showframe}  % <-- added
\usepackage{booktabs,tabularx}
\usepackage{rotating}
\usepackage{lipsum}

\usepackage{afterpage}  % <-- added
\usepackage{graphicx}   % <-- added
\usepackage{caption}    % <-- added
\usepackage{siunitx}    % <-- added

\begin{document}

\appendix
\section{Tables}
\afterpage{\clearpage}
    \begin{sidewaystable}[htb]
    \centering
    \scriptsize
    \setlength{\tabcolsep}{1.2pt}
\begin{tabular}{@{}
                l
          *{ 2}{S[table-format=1.3]}
          *{16}{S[table-format=-1.4]}
                @{} }
    \toprule
\textbf{M} & \multicolumn{18}{c}{\bfseries Parameters} \\
\cmidrule(lr){2-18}
    & {$\omega$}    & {$\phi$}      & {$\alpha$}    & {$\beta$}
    & {$\gamma_1$}  & {$\gamma_2$}  & {$\gamma_3$}  & {$\gamma_4$} 
    & {$\gamma_5$}  & {$\gamma_6$}  & {$\theta_1$}  & {$\theta_2$}
    & {$\theta_3$}  & {$\theta_4$}  & {$\varphi_1$} & {$\varphi_2$} 
    & {$\varphi_3$}   \\
\midrule
\bfseries 1
& 0.235 & 0.766 & 0.0114 & 0.0028 & 0.172 & {-} &  {-} &  {-} &  {-} &  {-} &  {-} & {-} &  {-} &  {-} &  {-} &  {-} & {-}  \\
\bfseries 2
& {-} &  0.998  & 0.0032 & 0.0002 &  -0.0058 & -0.1887& {-} &  {-} &  {-} &  {-} &  0.593 &
0.232 & {-} &  {-} &   0.1476 & -0.1377 & -0.0288 \\
    \addlinespace[2ex]
\bfseries 3
& {-} &  0.892 & 0.0662  & -0.0028 &  -0.0020 & -0.0452 & -0.2072 & {-} &  {-} &  {-} &       0.0389 & 0.6374 & {-} &  {-} &  0.661 & -0.204 & -0.073 \\
\bfseries 4
& 1 & {-} &  {-} &  {-} &  0.0003 & -0.0006 &  -0.0005 & 0.0002 &
{-} &  {-} &   &  0.823 & {-} &  {-} &  {-} &  0.0454 & -0.1384 \\
    \addlinespace[2ex]
\bfseries 5
& 1 & {-} &   0.0054 & {-} &  0.0010 & -0.0002 & 0.0006 & -0.0020 & 0.0003 & -0.0007     & 0.8524 & 0.2764 & -0.2393& 0.0348 & 0.0395 & -0.4177 & {-} \\
%\midrule
\bfseries 6
& 0 & 0.42 & 0.0093& 0.0012 & 0.0052 & {-} &  {-} &  {-} &  {-} &  {-} &  {-} &  {-} &  {-} &  {-} &  {-} &  {-} & {-}  \\
    \addlinespace[2ex]
\bfseries 7
& 1 & 0.869  & -0.0238 & 0.0138 & -0.0055 & -0.1819 & {-} &  {-} &  {-} &  {-} &  -0.0055
& -0.1810 & {-} &  {-} &  -0.249 & 0.734 & {-} \\
\bfseries 8
    & {-}       &  0.944    & 0.0241    & 0.0010   & 0.0276    & -0.0508   
    & -0.2321   & {-}       &  {-}      &  {-}     &  0.8437   & -0.0006   
    & {-}       &  {-}      & -0.2746   & -0.1223   & 0.0077   &    \\
    \addlinespace[2ex]
\bfseries 9
& 1 & 0.856 & -0.115 & 0.0207 & 0.0005 & -0.0010 & 0.0037 & 0.0005 & {-} &  {-} &  0.893
& {-} &  {-} &  {-} &  -0.1 & -0.184 & {-} \\
\bfseries 10
& 1 & 1 & -0.0069 & 0.0002 & -0.0002 & -0.0007 & -0.0001 & -0.0001 & -0.0001 &     -0.0010 & 0.831 & -0.131 & {-} &  {-} &  {-} &  -0.131 & -0.218  \\
\bottomrule
\addlinespace
\multicolumn{18}{p{0.8\linewidth}}{1: DSHW(7, 364) ; 2: BATS(7, 365); 3: BATS(7, 91, 365); 4:     TBATS(7, 365); 5: TBATS(7, 91, 365);
6: LR+DSHW(7, 364) ; 7: LR+BATS(7, 365); 8:LR+BATS(7, 91, 365); 9: LR+TBATS(7, 365); 10: LR+TBATS(7, 91, 365)}
\label{tab:Hparameters}
    \end{tabular}
\caption{Parameters chosen for all models. (M: Model)}
\end{sidewaystable}

    \lipsum
\end{document}

相关内容