我已经创建了一个表格,并且固定了它的宽度,但是当我写一段长文本时,文本会换行,我想在文本应该遵守行宽的情况下添加自动换行符。我该怎么做?我使用了 springier 模板。这是我的表格:
\begin{document}
\begin{center}
%\scriptsize
\centering
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
\begin{table*}[htp]
%{|p{0.04\textwidth}|p{0.04\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.02\textwidth}|}
\centering
\begin{tabular}{|p{0.2\textwidth}|
p{0.05\textwidth}|
p{0.2\textwidth}|
p{0.2\textwidth}|
p{0.2\textwidth}|
p{0.05\textwidth}|}
\hline
\multicolumn{1}{|c|}{Players Interaction} & \multicolumn{1}{c|}{Game type} & \multicolumn{1}{c|}{Game model} & \multicolumn{1}{c|}{Strategy set} & \multicolumn{1}{c|}{Payoff} & \multicolumn{1}{c|}{Ref} \\ \hline
\multirow{4}{*}{Non-cooperative game} & \multirow{2}{*}{UvsU non coop} & m1 & s1 & p1 & r1 \\ \cline{3-6}
& & m2 & s2 & p2 & r2 \\ \cline{2-6}
& \multirow{2}{*}{NvsN non coop} & m3 & s3 & p3 & r3 \\ \cline{3-6}
& & m4 & \multirow{2}{*}{s45} & p4 & \multirow{2}{*}{r45} \\ \cline{1-3} \cline{5-5}
\multirow{4}{*}{Cooperative game} & \multirow{3}{*}{NvsN cooperative} & m5 & & p5 & \\ \cline{3-6}
& & m6 & s6 & p6 & r6 \\ \cline{3-6}
& & m7 & s7 & p7 & r7 \\ \cline{2-6}
& User vs Net & m8 & s8 & p8 & r8 \\ \hline
\end{tabular}
\end{table*}
\end{center}
\end{document}
答案1
请在问题中始终提供 MWE(最小工作示例)。正如 @leandriss 评论中提到的,对于\multirow
选项,您应该使用\multirow{4}{=}{...}
。除此之外,我建议使用tabularx
表格环境和\makecell
列标题。请参阅下面的 MWE:
\documentclass[twocolumn]{svjour3}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\newcolumntype{L}{>{\RaggedRight}X}
\begin{document}
\begin{table*}[htp]
\centering
\begin{tabularx}{\linewidth}{|L|
>{\RaggedRight}p{0.11\linewidth}|
L|L|L|
l|}
\hline
\makecell{Players\\ Interaction}
& \makecell{Game\\ type}
& \makecell{Game\\ model}
& \makecell{Strategy\\ set}
& Payoff
& Ref \\ \hline
\multirow{4}{=}{Non-cooperative game}
& \multirow{2}{=}{UvsU non coop}
& m1 & s1 & p1 & r1 \\ \cline{3-6}
& & m2 & s2 & p2 & r2 \\ \cline{2-6}
& \multirow{2}{=}{NvsN non coop}
& m3 & s3 & p3 & r3 \\ \cline{3-6}
& & m4 & \multirow{2}{*}{s45}
& p4 & \multirow{2}{*}{r45} \\ \cline{1-3} \cline{5-5}
\multirow{4}{=}{Cooperative game}
& \multirow{3}{=}{NvsN cooperative}
& m5 & & p5 & \\ \cline{3-6}
& & m6 & s6 & p6 & r6 \\ \cline{3-6}
& & m7 & s7 & p7 & r7 \\ \cline{2-6}
& User vs Net
& m8 & s8 & p8 & r8 \\ \hline
\end{tabularx}
\end{table*}
\end{document}