最近在写文章,遇到latex表格内容换行的问题。搞了有半个小时,网上提供的方法和百度AI提供的都不好用。
一怒之下,自己动手。
修改前
\begin{table}[H]
\caption{\textbf{aaa}}%标题
\centering%把表居中
\begin{tabular}{clcl}%四个c代表该表一共四列,内容全部居中
\toprule%第一道横线
时间&GG(按时间先后顺序) \\
\midrule%第二道横线
\uppercase\expandafter{5555}&666666\\
\uppercase\expandafter{99}&77\\
\bottomrule%第三道横线
\end{tabular}
\end{table}
修改后
\begin{table}[H]
\caption{\textbf{模型压缩方法调研}}%标题
\centering%把表居中
\begin{tabular}{clclclcl}
\toprule%第一道横线
aa&bb&cc&dd\\
\midrule%第二道横线
知识蒸馏 & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} \\
参数量化 & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} \\
网络剪枝 & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa \\
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa
\end{tabular} & \begin{tabular}{p{2.5cm}}
aaaaaaaaaaaaaa
\end{tabular} \\
\bottomrule%第三道横线
\end{tabular}
\end{table}
改之后效果
记录一下我浪费的时间,菜狗哭泣