使用 springer latex 格式时,我无法使用这种格式的表格,但在 elsevier 和其他模板中,除了包含所有必需的包之外,它都能正常工作。因此,我无法换行,而是在使用cols
和pos
更多内容时出现错误。
我在 Springer Journal Latex 模板中使用了以下内容
\begin{table}[cols=4,pos=h]
\centering
%\captionsetup{justification=centering} %ok
\setlength{\tabcolsep}{3pt}
\begin{tabular*}{\textwidth}{@{}Lp{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}@{}}
当我尝试它自己提供的表格格式时,像这样
\documentclass{sn-jnl}
\begin{document}
\begin{table}[h]%[pos=h] %cols=4,pos=h
\begin{center}
%\captionsetup{justification=centering} %ok
%\setlength{\tabcolsep}{3pt}
%\begin{tabular*}{\textwidth}{@{}Lp{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}@{}}
\begin{tabular}{@{}llll@{}}
\toprule
S.No. & Drawbacks Observed & Proposed Solution Protocol when Size $< 32+40 $ & Proposed Solution protocol when Size $\ge 52+10$ \\
\midrule
1 & Affect of Area acceptance on high speed vehicles & speed in some order used high speed placement scheme and observation collected in scenarios & High Speed chase \\
2 & Affect Of color on low speed vehicles & speed in some order used high speed placement scheme and observation collected in scenarios & Low Speed chase \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\end{document}
我让表格超出页面宽度,并且文本未换行,如附图所示。如有任何帮助,我将不胜感激
答案1
您需要使用允许在第 2 列和第 3 列自动换行的表格环境。表格型环境。我还建议为标题行提供更多结构,以减少重复信息。
\documentclass{sn-jnl}
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight}X}
\begin{document}
\begin{table}[h] %[pos=h] %cols=4,pos=h
\begin{tabularx}{\textwidth}{@{} l LLl @{}}
\toprule
S.No.
& Drawbacks observed
& \multicolumn{2}{c@{}}{Proposed solution protocols} \\
\cmidrule(l){3-4}
& & when size $< 32+40 $ & when size $\ge 52+10$ \\
\midrule
1
& Affect of area acceptance on high speed vehicles
& speed in some order used high speed placement scheme
and observation collected in scenarios
& High Speed chase \\
\addlinespace
2
& Affect of color on low speed vehicles
& speed in some order used high speed placement scheme
and observation collected in scenarios
& Low Speed chase \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}