横向模式和标题在同一页面上的问题

横向模式和标题在同一页面上的问题

对于附录,我尝试创建旋转表格,并使用横向模式。只有一个问题阻碍了我;当我尝试将附录的标题添加到我创建的表格中时,标题会被旋转(参见以下代码):

\begin{landscape}
\section{blabla}
    \begin{table}
     blablabla
    \end{table}
\end{landscape}

或者,当我在横向模式之外写下部分名称时,标题从空白页开始,表格从下一页开始(很丑陋)。(参见以下代码):

\section{blabla}
\begin{landscape}
     \begin{table}
     blablabla
     \end{table}
\end{landscape}

有人知道如何解决这个问题吗?

答案1

hvfloat包非常灵活,为您提供了在一页中拥有多个旋转表格的可能性;在下面的例子中,我使用该nonFloat=true选项停用了所有表格的浮动;还要注意该capWidth=w选项,因此标题宽度将与表格宽度相同:

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{booktabs}
\usepackage{hvfloat}

\begin{document}

\section{Test Section with Several Rotated Objects}

\hvFloat[%
nonFloat=true,%
capWidth=w,%
capPos=t,%
rotAngle=90,%
objectPos=c%
]{table}{%
    \begin{tabular}{ll}
    \toprule
    column1a & column2a \\
    column2b & column2b \\
    column1c & column2c \\
    column1d & column2d \\
    \bottomrule
    \end{tabular}%
}{%
A test rotated table}{tab:test1}

\vfill

\hvFloat[%
nonFloat=true,%
capWidth=w,%
capPos=t,%
rotAngle=90,%
objectPos=c%
]{table}{%
    \begin{tabular}{ll}
    \toprule
    column1a & column2a \\
    column2b & column2b \\
    column1c & column2c \\
    column1d & column2d \\
    \bottomrule
    \end{tabular}%
}{Another test rotated table}{tab:test2}

\end{document}

在此处输入图片描述

答案2

这个怎么样...

在此处输入图片描述

\documentclass{article}
\usepackage{rotating}
\begin{document}

\section{Hello}

My table is in Table~\ref{tab:hello}.
\begin{table}
  \begin{sideways}
    \begin{tabular}{lllllllll}
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello \\
    hello & hello & hello & hello & hello & hello & hello & hello & hello
    \end{tabular}
  \end{sideways}
  \centering
  \caption[Caption]{Caption.}
  \label{tab:hello}
\end{table}
\end{document}

相关内容