我正在写一个文档,我尝试使用 sidewaystable 来旋转表格。挑战在于需要像图片中显示的那样旋转页码。我该如何实现这一点。MWE 如下
%\usepackage{pdflscape}
%\usepackage{graphicx}
%\usepackage{subcaption}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}
\begin{sidewaystable}
\centering
%\setlength\extrarowheight{2pt}
% \centering
\small
\caption{Key aspects.}
\label{td_ra}
\begin{tabular}{l|l|l|l|l|l|l|l|l|l|l|l|}
\cline{2-12}
\multirow{2}{*}{} & \multirow{2}{*}{Aspect} & \multicolumn{10}{c|}{References} \\ \cline{3-12}
& & & & & & & && & & \\ \hline
\multicolumn{1}{|l|}{\multirow{2}{*}{\rotatebox{90}{Opt}}} & Optimal devices & & & & & & & & & & \\\cline{2-12}
\multicolumn{1}{|l|}{} & Machine optimization & & & & & && & & & \\ \hline
\end{tabular}
\end{sidewaystable}
\end{document} ````
答案1
我发现解决方案如下:
\documentclass{article}
\usepackage{everypage,graphicx}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
\begin{document}
\clearpage % Flush earlier floats (otherwise order might not be correct)
\thispagestyle{empty} % empty page style (?)
\atxy{\dimexpr\paperwidth-1in}{.5\paperheight}{\rotatebox[origin=center]{90}{\thepage}}
\begin{sidewaystable} % <-- HERE
\centering % Center table
\begin{tabular}{llll}
A & B & C & D \\
\end{tabular}
\captionof{table}{Table caption}
\end{sidewaystable} % <-- HERE
\clearpage % Flush page
\end{document}
希望这对你也有用。