我想在旋转 90 度的表格旁边的左侧/右侧放置一个标题。因此,标题应位于表格旁边(例如右下角),并且标题和表格都应旋转。我使用 \begin{sidewaystable} 来实际旋转表格,但如何将其与侧标题结合使用?
此侧标题应仅为例外,所有其他表格的标题都应位于表格顶部(caption=tableheading)
\documentclass[caption=tableheading]{scrreprt}
\usepackage{rotating}
%%%%%%%%%%%%%%%
\begin{document}
\begin{sidewaystable}[htbp]
\caption{This is the Table caption that should appear next to the table}
\begin{center}
\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\end{center}
\end{sidewaystable}
\end{document}
答案1
下面我向你介绍两个选项;第一个使用hvfloat
包;第二个,将标题放在里面minipage
并\rotatebox
使用graphicx
:
\documentclass[caption=tableheading]{scrreprt}
\usepackage{hvfloat}
\usepackage{graphicx}
\begin{document}
\hvFloat[capPos=r,capWidth=0.4,capVPos=b,objectPos=c,rotAngle=90]
{table}
{\raisebox{\height}{\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}}%
}%
{This is the Table caption that appears next to the table}%
{tab:testa}
\clearpage
\vfill\begin{table}
\rotatebox{90}{%
\begin{tabular}[b]{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}\quad%
\begin{minipage}[b]{.5\textwidth}
\caption{This is the Table caption that appears next to the table}
\end{minipage}}%
\end{table}
\clearpage
\end{document}