.png)
Tengo el siguiente problema:
Quiero que el título sobre la tabla comience hacia la izquierda y no con el espacio. Aquí está el copiar y pegar MWE de mi proyecto:
\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}
Intenté agregar \captionsetup{justification=justified}
pero fue en vano.
Respuesta1
els-cas
inicializa algunas variables (en este caso la que contiene el ancho del cuadro de título) al cargar la clase, lo que sucede antes de configurar la geometría de la página, por lo que el título no sabe que el ancho del texto cambió (es otro error ).
Cuando uses tablas de dos columnas, debes decir explícitamente que el ancho se \textwidth
usa \begin{table*}[width=\textwidth]
, pero puedes configurarlo globalmente usando esto en tu preámbulo:
\AtBeginDocument{\setlength{\FullWidth}{\textwidth}}
esto arreglará els-cas
el valor de \textwidth
(gracias egreg por señalarlo). Además, no cambie la escala de una mesa. Período.
En su documento:
\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}
Respuesta2
fuera de contexto:
- No utilice el cuadro de escala para acomodar la tabla al ancho del texto. En lugar de eso, deje que LaTeX calcule el tamaño
\tabcolsep
y@{\extracolsep{\fill}}
, si es necesario, reduzca el tamaño de fuente utilizado en la tabla (en su caso no es necesario) - Dado que de MWE se deduce que tiene un documento de una columna, puede utilizar
table
un entorno simple. En él no has reportado problemas:
\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}
da el resultado deseado: