同一页上有两个横向表格

同一页上有两个横向表格

我想将两个侧向表格并排放置。对于横向布局,可以通过将两个表格放在一个横向布局中来实现(如何将两个表格放在一个横向页面中)。sidewaystables 是否也可能出现类似的情况?

这两个表格都是一页宽,但是不太长,所以我想将它们水平地放在一起。

答案1

环境sidewaystable不会限制您每页只能有一个表格。只要tabular(或tabular*等)环境适合单个(旋转)页面,您就可以在构造中排版的页面上拥有多个这样的环境sidewaystable

例如,以下代码将两个简单tabular*环境放在一个页面上,一个在另一个之下(或者,如果您愿意,可以并排放置...)。请注意,它们可以像任何其他表格结构一样被赋予标题并进行交叉引用。

\documentclass{article}
\usepackage{rotating,booktabs}
\begin{document}
Cross-references to tables \ref{tab:1} and \ref{tab:2}.
\begin{sidewaystable}
\caption{First table} \label{tab:1}

\smallskip
\begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} *{9}{c}}
\toprule
a & b & c & d & e & f & g & h & i & j \\
\bottomrule
\end{tabular*}

\bigskip\bigskip  % provide some separation between the two tables
\caption{Second table} \label{tab:2}

\smallskip
\begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} *{9}{c}}
\toprule
a & b & c & d & e & f & g & h & i & j \\
\bottomrule
\end{tabular*}
\end{sidewaystable}
\end{document}

答案2

也许使用hvfloat包裹?

\documentclass{article}
\usepackage{booktabs}
\usepackage{hvfloat}

\begin{document}    

\hvFloat[rotAngle=90,nonFloat=true,capWidth=w]%
{table}%
{\begin{tabular}{cc}
\toprule
header1 & header2 \\
\midrule
text1 & text2 \\
text3 & text4 \\
\bottomrule
\end{tabular}%
}%
{A first rotated table}%
{tab:testa}

\vspace*{30pt}

\hvFloat[rotAngle=90,nonFloat=true,capWidth=w]%
{table}%
{\begin{tabular}{ccc}
\toprule
header3 & header4 & header5 \\
\midrule
text5 & text6 & text7 \\
text8 & text9 & text10 \\
\bottomrule
\end{tabular}%
}%
{Another rotated table next to the first one}%
{tab:testb}

\end{document}

在此处输入图片描述

或者,

\documentclass{article}
\usepackage{booktabs}
\usepackage{hvfloat}

\begin{document}    

\hvFloat[rotAngle=90,nonFloat=true,capWidth=w]%
{table}%
{\begin{tabular}{cc}
\toprule
header1 & header2 \\
\midrule
text1 & text2 \\
text3 & text4 \\
\bottomrule
\end{tabular}%
}%
{A first rotated table}%
{tab:testa}\qquad
\hvFloat[rotAngle=90,nonFloat=true,capWidth=w]%
{table}%
{\begin{tabular}{ccc}
\toprule
header3 & header4 & header5 \\
\midrule
text5 & text6 & text7 \\
text8 & text9 & text10 \\
\bottomrule
\end{tabular}%
}%
{Another rotated table next to the first one}%
{tab:testb}

\end{document}

在此处输入图片描述

答案3

复制于此一个答案我在 latex.org 上偶然发现的

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{rotating}

\parindent0em

\begin{document}
   \begin{sidewaystable}
     \caption{Table One}\label{tab:one}
     \centering
     \begin{tabular}{*{4}{c}} \toprule
       Table Head & Table Head & Table Head & Table Head \\ \midrule
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\ \bottomrule
     \end{tabular}

    \vspace{2\baselineskip}
    \caption{Table Two}\label{tab:two}
     \centering
     \begin{tabular}{*{4}{c}} \toprule
       Table Head & Table Head & Table Head & Table Head \\ \midrule
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\
       Some Values & Some Values & Some Values & Some Values \\ \bottomrule
     \end{tabular}
   \end{sidewaystable}
\end{document}

相关内容