兩個列表中標題邊距與文本正文不同 (cas-dc)

兩個列表中標題邊距與文本正文不同 (cas-dc)

我有以下問題:

在此輸入影像描述

我希望表格上方的標題開始向左對齊,而不是與空格對齊。這是我專案中的 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載入類別時初始化一些變數(在本例中是保存標題框寬度的變數),這發生在設定頁面幾何形狀之前,因此標題不知道文字寬度發生了變化(這是另一個錯誤)。

使用兩個清單時,您需要明確說明寬度正在\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 可以看出,您擁有一列文檔,因此您可以使用簡單的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}

給出所需的結果:

在此輸入影像描述

相關內容