8 列侧向桌

8 列侧向桌

这是我的表格,但我不知道如何在右侧安排另外 4 列。

 \begin{sidewaystable}
 \centering
\caption{Realtime forecast RMSEs}
 \label{forecast}
 \begin{tabular}{@{}l
    c
    *{6}{S[table-format=1.6, group-digits=false]}
    S[table-format=-1.6, group-digits=false]
    S[table-format=1.6, group-digits=false]@{}}

\toprule
\multirow{2}[3]{*}{\bfseries Parameters} & \multicolumn{2}{c}{\makecell{\bfseries $S\&P$ \\ $\boldsymbol{h=2Q}$}} & 
  \multicolumn{2}{c}{\makecell{\bfseries GDP \\ $\boldsymbol{h=2Q}$}} &
  \multicolumn{2}{c}{\makecell{\bfseries Unemployment \\ \bfseries $\boldsymbol{h=2Q}$}} &
    \multicolumn{2}{c}{\makecell{\bfseries house price index \\ \bfseries $\boldsymbol{h=2Q}$}} &
  \multicolumn{2}{c}{\makecell{\bfseries Inflation \\ \bfseries $\boldsymbol{h=2Q}$}} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
& \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} \\
\midrule
$b_k = 0$ &     &       &        &       &      &       &       &        \\
\hspace{7pt} $\beta$ & 0.097  & 0.009& 0.245 & 0.009 & 0.013 & 0.089 & 0.003& 0.078 \\
\hspace{7pt} $\sigma$ & 0.003  & 0.013 & 0.077& 0.015 & 0.065 & 0.002 & 0.074& 0.000\\
\hspace{7pt} $\theta$ & 0.184  & 0.045 & 0.069 & 0.078 & 0.005 & 0.046 & 0.078 & 0.055 \\
    \hspace{7pt} $\delta$ & 0.165  & 0.036 & 0.078 & 0.004 & 0.063& 0.015 & 0.045 & 0.077\\
\addlinespace
$b_k \neq 0$ &     &       &        &       &      &       &       &        \\
\hspace{7pt} $\beta$ & 0.002  & 0.889 & 0.764 & 0.445 & 0.057 & 0.447 & 0.008 & 0.078 \\
\hspace{7pt} $\sigma$ & 0.001  & 0.446 & 0.003 & 0.096 & 0.065 & 0.047 & 0.005 & 0.054\\
\hspace{7pt} $\theta$ & 0.004  & 0.410 & 0.004 & 0.080 & 0.045 & 0.004 & 0.014& 0.036\\
    \hspace{7pt} $\delta$ & 0.005  & 0.780 & 0.002 & 0.070 & 0.052 & 0.046 & 0.051 & 0.065 \\
\bottomrule
   \end{tabular}
    \end{sidewaystable}

但是,输出结果如下:

在此处输入图片描述

答案1

你的问题不太清楚。你已经填好了 8 列,还有两列的标题,但尚未定义。这是否意味着你想再多两列?无论如何,你只需定义你想要的列数并在其中添加数据:

\documentclass{article}
\usepackage{bm}         % new
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{booktabs, makecell, multirow, threeparttable}
\usepackage{caption}

\usepackage{xparse}     % new
\NewExpandableDocumentCommand\mcc{O{1}m}
    {\multicolumn{#1}{>{\bfseries}c}{#2}}

\begin{document}
    \begin{sidewaystable}
\centering
\caption{Realtime forecast RMSEs for $\bm{h=2Q}$}
\label{forecast}
\begin{threeparttable}
\begin{tabular}{@{}
             >{$}c< {$}
           *{12}{S[table-format=1.3]}   %   <--
                @{}}
    \toprule
\multirow{2.4}{3em}{\bfseries Para- meter} 
    & \mcc[2]{$\bm{S\&P$}\tnote{a}}    
                 & \mcc[2]{GDP\tnote{b}}         
                              & \mcc[2]{Unemploy.}
                                            & \mcc[2]{HPI\tnote{c}}                  \\  
    \cmidrule(l){2-3} \cmidrule(l){4-5}     \cmidrule(l){6-7} 
    \cmidrule(l){8-9} \cmidrule(l){10-11}   \cmidrule(l){12-13}                    
    & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} 
    & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE}   \\
    \midrule
b_k = 0 & \mcc[10]{}                                                                \\
\beta   & 0.097  & 0.009 & 0.245 & 0.009 & 0.013 & 0.089 & 0.003 & 0.078 &  &  &  & \\
\sigma  & 0.003  & 0.013 & 0.077 & 0.015 & 0.065 & 0.002 & 0.074 & 0.000 &  &  &  & \\
\theta  & 0.184  & 0.045 & 0.069 & 0.078 & 0.005 & 0.046 & 0.078 & 0.055 &  &  &  & \\
\delta  & 0.165  & 0.036 & 0.078 & 0.004 & 0.063 & 0.015 & 0.045 & 0.077 &  &  &  & \\
\addlinespace
b_k\neq 0   & \mcc[12]{}                                                            \\
\beta   & 0.002  & 0.889 & 0.764 & 0.445 & 0.057 & 0.447 & 0.008 & 0.078 &  &  &  & \\
\sigma  & 0.001  & 0.446 & 0.003 & 0.096 & 0.065 & 0.047 & 0.005 & 0.054 &  &  &  & \\
\theta  & 0.004  & 0.410 & 0.004 & 0.080 & 0.045 & 0.004 & 0.014 & 0.036 &  &  &  & \\
\delta  & 0.005  & 0.780 & 0.002 & 0.070 & 0.052 & 0.046 & 0.051 & 0.065 &  &  &  & \\
    \bottomrule
\end{tabular}
\begin{tablenotes}[para, flushleft]
\item[a] S\&P ...,
\item[b] GDP ...,
\item[c] Hause Price Index.
\end{tablenotes}
\end{threeparttable}
    \end{sidewaystable}
\end{document}

这使:

在此处输入图片描述

在上面的代码中,我重新定义了S列,添加了threeparttable for use oftablenotes macro\tnote` 来解释列标题中缩短的含义。

相关内容