.png)
次のような問題があります:
表の上のキャプションをスペースではなく左揃えで表示したいです。以下は私のプロジェクトからの MWE のコピー ペーストです。
\documentclass[a4paper,fleqn]{cas-dc}
\usepackage[numbers]{natbib}
\usepackage{graphicx}
\begin{document}
\maketitle
\begin{table*}[pos=t]
\caption{Observed results of the user study.}
\label{tab:Result_time}
\resizebox{\textwidth}{!}{%
\begin{tabular}{lllllllllllll}
\toprule
& & \textbf{P1} & \textbf{P2} & \textbf{P3} & \textbf{P4} & \textbf{P5} & \textbf{P6} & \textbf{P7} & \textbf{P8} & \textbf{P9} & \textbf{P10} & \textbf{P11} \\ \midrule
\multicolumn{1}{c}{\multirow{3}{*}{\textbf{Scenario 1}}} & Accuracy & 100\% & 50\% & 100\% & 0\% & 100\% & 100\% & 100\% & 0\% & 100\% & 50\% & 100\% \\
\multicolumn{1}{c}{} & Time Taken & 18:13 & 15:40 & 16:26 & 20:32 & 17:10 & 18:08 & 16:22 & 18:50 & 12:18 & 16:27 & 15:41 \\
\multicolumn{1}{c}{} & Number of queries & 18 & 10 & 11 & 15 & 7 & 12 & 16 & 22 & 12 & 10 & 15 \\ \midrule
\textbf{Scenario 2} & Time Taken & 7:35 & 8:39 & 10:20 & 10:41 & 9:47 & 14:28 & 12:24 & 18:28 & 8:29 & 9:11 & 8:24 \\ \midrule
\textbf{Scenario 3} & Time Taken & 6:21 & 4:50 & 5:42 & 7:18 & 4:30 & 4:52 & 4:27 & 5:15 & 5:04 & 6:12 & 5:48
\\
\bottomrule
\end{tabular}
}
\end{table*}
\end{document}
追加しようとしました\captionsetup{justification=justified}
が、うまくいきませんでした。
答え1
els-cas
クラスをロードするときに、いくつかの変数 (この場合はキャプション ボックスの幅を保持する変数) を初期化します。これはページ ジオメトリを設定する前に行われるため、キャプションはテキストの幅が変更されたことを認識しません (これは別のバグです)。
2 列のテーブルを使用する場合は、幅が を\textwidth
使用していることを明示的に指定する必要があります\begin{table*}[width=\textwidth]
が、プリアンブルでこれを使用してこれをグローバルに設定できます。
\AtBeginDocument{\setlength{\FullWidth}{\textwidth}}
els-cas
これにより、 の値が修正されます\textwidth
(指摘してくれた egreg に感謝します)。また、テーブルを再スケールしないでください。以上。
ドキュメント内:
\documentclass[a4paper,fleqn]{cas-dc}
\usepackage[numbers]{natbib}
\usepackage{graphicx}
\AtBeginDocument{\setlength{\FullWidth}{\textwidth}}
\begin{document}
\maketitle
\begin{table*}[pos=t,width=\textwidth]
\caption{Observed results of the user study.}
\label{tab:Result_time}
\begin{tabular}{@{}*{13}{l}@{}}
\toprule
& & \textbf{P1} & \textbf{P2} & \textbf{P3} & \textbf{P4} & \textbf{P5} & \textbf{P6} & \textbf{P7} & \textbf{P8} & \textbf{P9} & \textbf{P10} & \textbf{P11} \\ \midrule
\multicolumn{1}{@{}c}{\multirow{3}{*}{\textbf{Scenario 1}}} & Accuracy & 100\% & 50\% & 100\% & 0\% & 100\% & 100\% & 100\% & 0\% & 100\% & 50\% & 100\% \\
\multicolumn{1}{@{}c}{} & Time Taken & 18:13 & 15:40 & 16:26 & 20:32 & 17:10 & 18:08 & 16:22 & 18:50 & 12:18 & 16:27 & 15:41 \\
\multicolumn{1}{@{}c}{} & Number of queries & 18 & 10 & 11 & 15 & 7 & 12 & 16 & 22 & 12 & 10 & 15 \\ \midrule
\textbf{Scenario 2} & Time Taken & 7:35 & 8:39 & 10:20 & 10:41 & 9:47 & 14:28 & 12:24 & 18:28 & 8:29 & 9:11 & 8:24 \\ \midrule
\textbf{Scenario 3} & Time Taken & 6:21 & 4:50 & 5:42 & 7:18 & 4:30 & 4:52 & 4:27 & 5:15 & 5:04 & 6:12 & 5:48
\\
\bottomrule
\end{tabular}
\end{table*}
\end{document}
答え2
オフトピック:
- 表をテキスト幅に合わせるためにスケールボックスを使用しないでください。代わりに、LaTeX にサイズを計算してもらい
\tabcolsep
、@{\extracolsep{\fill}}
必要に応じて表で使用されるフォントサイズを縮小します (この場合は必要ありません)。 - MWE から、1 列のドキュメントがあることが分かるので、シンプルな環境を使用できます
table
。その時点では、問題は報告されていません。
\documentclass[a4paper,fleqn]{cas-dc}
\usepackage[numbers]{natbib}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\lipsum[11]
\begin{table}[pos=ht]
\caption{Observed results of the user study. \lipsum[66]}
\label{tab:Result_time}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} lllllllllllll }
\toprule
& & \textbf{P1} & \textbf{P2} & \textbf{P3} & \textbf{P4} & \textbf{P5}
& \textbf{P6} & \textbf{P7} & \textbf{P8} & \textbf{P9} & \textbf{P10}
& \textbf{P11} \\ \midrule
\multicolumn{1}{c}{\multirow{3}{*}{\textbf{Scenario 1}}}
& Accuracy
& 100\% & 50\% & 100\% & 0\% & 100\%
& 100\% & 100\% & 0\% & 100\% & 50\%
& 100\% \\
& Time Taken
& 18:13 & 15:40 & 16:26 & 20:32 & 17:10
& 18:08 & 16:22 & 18:50 & 12:18 & 16:27
& 15:41 \\
& Number of queries
& 18 & 10 & 11 & 15 & 7
& 12 & 16 & 22 & 12 & 10
& 15 \\ \midrule
\textbf{Scenario 2}
& Time Taken
& 7:35 & 8:39 & 10:20 & 10:41 & 9:47
& 14:28 & 12:24 & 18:28 & 8:29 & 9:11
& 8:24 \\ \midrule
\textbf{Scenario 3}
& Time Taken
& 6:21 & 4:50 & 5:42 & 7:18 & 4:30
& 4:52 & 4:27 & 5:15 & 5:04 & 6:12
& 5:48 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
望ましい結果が得られます: