adjustmentbox 在 \ref 有錯誤的引用

adjustmentbox 在 \ref 有錯誤的引用

為了旋轉桌子,我使用了\begin{adjustbox}.但是當我引用它時, \ref{} 顯示了錯誤的 ID,並且 \centering 不起作用。如何修復它?謝謝!

在此輸入影像描述

以下是tex檔案中使用的環境:

\documentclass{sokendai_thesis} % https://github.com/koikezlemma/phd_thesis_template/blob/master/sokendai_thesis.cls

\usepackage{adjustbox, booktabs}

\begin{document}

\section{AA }


Table \ref{tab:testtable}

% https://tex.stackexchange.com/questions/566793/rotate-two-tables-including-caption-on-the-same-page
\begin{adjustbox}{angle=90, caption={Summary of XXX.}, float=table}\label{tab:testtable}
\centering\small
\begin{tabular}{llll}
\toprule
& A       &  B    & C \\
\midrule
& 1       &  2   & 3 \\
& 1       &  2    &3  \\
\bottomrule
\end{tabular}
\end{adjustbox}


\end{document}

答案1

您必須包含\label作為caption鍵值選項的一部分:

\begin{adjustbox}{..., caption={Summary of XXX.\label{tab:testtable}}, ...}
  %...
\end{adjustbox}

相關內容