节、横向稳定和分页符

节、横向稳定和分页符

sidewaystable在附录中有一个,现在我想在页面上插入标题以便更清晰。 sidewaystable自动导致分页符。因此,我尝试了rotate导致显示错误的包:

表格移到标题之外。

有人可以帮我在页面上和表格下方插入标题吗?

\documentclass[a4paper]{scrbook}

\usepackage[utf8]{inputenc}             
\usepackage{textcomp}                       
\usepackage[T1]{fontenc}                    
\usepackage[english]{babel}     
\usepackage{ragged2e}                       
\usepackage{everysel}                       
\usepackage{footmisc}                           
\usepackage{multirow}
\usepackage{booktabs}                       
\usepackage{float}                                  
\usepackage{threeparttable}                     
\usepackage[referable]{threeparttablex}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{longtable}
\usepackage{afterpage}                          
\usepackage{tabu}
\usepackage{adjustbox}
\usepackage{array}
\usepackage[figuresright]{rotating}
\usepackage[section]{placeins}  
\usepackage[format=hang,
            justification=RaggedRight,              
            singlelinecheck=off,                        
            labelfont=bf,                                   
            font=footnotesize,
            textfont=footnotesize,
            twoside,
            labelsep=colon
            ]{caption}                          
\usepackage[language=autobib,
    backend=biber                               %%%% switch on/off 
    ]{biblatex}

%%% Minitab
\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}
%%%

%%% Mod ThreePartTable
\makeatletter 
\g@addto@macro\TPT@defaults{\scriptsize}
\makeatother
%%%


%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\section*{Section}
\begin{sidewaystable}
\begin{threeparttable}
\caption[xxx]
{\textbf{xxx}}
\centering
\small
\begin{tabularx}{\textwidth}
{
X
>{\raggedleft\arraybackslash}p{12ex} 
>{\raggedleft\arraybackslash}p{12ex} 
p{0.5ex} |  
>{\raggedleft\arraybackslash}p{10.5ex} 
p{0.25ex}
%
>{\raggedleft\arraybackslash}p{12ex} 
>{\raggedleft\arraybackslash}p{12ex} 
p{0.5ex} |  
>{\raggedleft\arraybackslash}p{10.5ex} 
p{0.25ex}
%
}

\toprule

& \multicolumn{4}{c}{group 1} 
&
%
& \multicolumn{4}{c}{group 2} 
&
\\

\cmidrule(lr){2-5} 
\cmidrule(lr){7-10}

& \multicolumn{3}{c}{yyy\tnote{a}}  
& \multirow[b]{2}{*}{\minitab[c]{zzz\\rrr\tnote{b}}}    
&
%
& \multicolumn{3}{c}{yyy\tnote{a}}  
& \multirow[b]{2}{*}{\minitab[c]{zzz\\rrr\tnote{c}}}    
&
%
\\
                                    
\cmidrule(lr){2-4}
\cmidrule(lr){7-9}


& n 
& \%        
& 
&
&
%
& n
& \%
& 
&
&

\\
                                            
\midrule
xxx         &   20      &   24,4\%      &&  80,0\,\%    &
                &   24      &   23,5\,\%        &&  85,7\,\%    &
                \\

\midrule
Total           &   82      &   100,0\,\%       &&  328,0\,\%   &
                &   102     &   100,0\,\%       &&  364,3\,\%   &
                \\
                
\bottomrule
\end{tabularx}
%%%%%%%%%%%%%%%%%
\begin{tablenotes}
\scriptsize
\justifying
\RaggedRight
\item[a] AAAAAAA
\end{tablenotes}
%%%%%%%%%%%%%%%%%
\end{threeparttable}
\end{sidewaystable}

\end{document}

在此处输入图片描述 在此处输入图片描述

答案1

下面我放弃使用threeparttable,将\tnotes 设置为\textsuperscript。重要的结构性内容是使用以下设置:

\begin{center}% Center table horizontally
  \rotatebox{90}{% Rotate table 90 degrees (anti-clockwise)
    % In order to rotate something, it's often best to place it inside a box-like structure,
    % like a minipage
    \begin{minipage}{\textwidth}
      % With the float package, you can turn a float into a non-float via the [H]ERE
      % float specifier. This is needed because you're placing the float inside a box (a
      % minipage), yet want float-like capabilities (like \caption).
      \begin{table}[H]
        <your table>
      \end{table}
    \end{minipage}%
  }
\end{center}

这是一个完整的工作示例:

在此处输入图片描述

\documentclass[a4paper]{scrbook}

\usepackage{ragged2e}
\usepackage{multirow}
\usepackage{booktabs,graphicx}
\usepackage{tabularx,float}
\usepackage{array}

\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}
\newcommand{\tnote}{\textsuperscript}

\begin{document}

\section*{Section}

\begin{center}
  \rotatebox{90}{%
    \begin{minipage}{\textwidth}
      \begin{table}[H]
        \centering
        \small
        \caption[xxx]{\bfseries xxx}
        \begin{tabularx}{\textwidth}{
          X
          >{\raggedleft\arraybackslash}p{12ex} 
          >{\raggedleft\arraybackslash}p{12ex} 
          p{0.5ex} |  
          >{\raggedleft\arraybackslash}p{10.5ex} 
          p{0.25ex}
          %
          >{\raggedleft\arraybackslash}p{12ex} 
          >{\raggedleft\arraybackslash}p{12ex} 
          p{0.5ex} |  
          >{\raggedleft\arraybackslash}p{10.5ex} 
          p{0.25ex}
          %
        }
          \toprule
          & \multicolumn{4}{c}{group 1} 
          &
          %
          & \multicolumn{4}{c}{group 2} 
          &
          \\

          \cmidrule(lr){2-5} 
          \cmidrule(lr){7-10}

          & \multicolumn{3}{c}{yyy\tnote{a}}
          & \multirow[b]{2}{*}{\minitab[c]{zzz\\rrr\tnote{b}}}
          &
          %
          & \multicolumn{3}{c}{yyy\tnote{a}}
          & \multirow[b]{2}{*}{\minitab[c]{zzz\\rrr\tnote{c}}}
          &
          %
          \\
                                              
          \cmidrule(lr){2-4}
          \cmidrule(lr){7-9}


          & n 
          & \%        
          & 
          &
          &
          %
          & n
          & \%
          & 
          &
          &

          \\
                                                      
          \midrule
          xxx         &   20      &   24,4\%      &&  80,0\,\%    &
                          &   24      &   23,5\,\%        &&  85,7\,\%    &
                          \\

          \midrule
          Total           &   82      &   100,0\,\%       &&  328,0\,\%   &
                          &   102     &   100,0\,\%       &&  364,3\,\%   &
                          \\
                          
          \bottomrule
        \end{tabularx}

        \scriptsize
        \RaggedRight
        \tnote{a} AAAAAAA
      \end{table}%
    \end{minipage}
  }
\end{center}

\end{document}

相关内容