latex表格超出页面

发布时间: 2023-11-30 10:35 阅读: 文章来源:1MUMB100234PS

某个表格的单元格中 文字太长 需要分行显示的方法

如分成3行显示 添加命令

-------- \newcommand{\tabincell}[2]{

\begin{tabular}{@{}#1@{}}#2\end{tabular}\begin{tabular}{@{}#1@{}}#2\end{tabular}

} -------

后使用

\tabincell{c}{zy3:52 minutes\\ GF1: 26 minutes \\GF2: 21 minutes}

或者直接在文本中使用

\begin{tabular}[c]{@{}c@{}}

Difficulty of\\ construction

\end{tabular}

跨行跨列显示

\hline\multirow{3}{*}{Project}&\multicolumn{6}{c}{Job distribution /$\%$}&\multicolumn{6}{c}{VM utilization rate /$\%$}\\&\multicolumn{2}{c}{prob=0.1} &\multicolumn{2}{c}{prob=0.3} &\multicolumn{2}{c}{prob=0.5} &\multicolumn{2}{c}{prob=0.1} &\multicolumn{2}{c}{prob=0.3} &\multicolumn{2}{c}{prob=0.5}\\&H-CPU &H-I/O &H-CPU &H-I/O &H-CPU &H-I/O &H-CPU &H-I/O &H-CPU &H-I/O &H-CPU &H-I/O\\ \hline

另外一种跨行显示

\hlineSerial number &Types of &Subtype &Description\\\hline1 &\multirow{4}{*}{exchange} &swap(S.V) &Exchange complete information of two genes\\2 & &swap(S) &Only exchange virtual machine type information\\3 & &swap (V) &Only exchange information about the number of virtual machines\\4 & &replace(S,V) &replace the entire gene\\5 &\multirow{2}{*}{replace} &replace(S) &replace only the virtual machine type information\\6 & &replace (V) &Only replace the number of virtual machines\\\hline

其他方式 款行跨列

\toprule %%横线\multirow{2}{*}{

\begin{tabular}[c]{@{}c@{}}Experiment\\ No\end{tabular}\begin{tabular}[c]{@{}c@{}}Experiment\\ No\end{tabular}

}

& \multicolumn{2}{c}{GA}

& \multicolumn{2}{c}{PSO}

& \multicolumn{2}{c}{PSO-GA} \\

& \begin{tabular}[c]{@{}c@{}}

Cut off\\ algebra

\end{tabular}

& Result

&

\begin{tabular}[c]{@{}c@{}}Cut off\\ algebra\end{tabular}\begin{tabular}[c]{@{}c@{}}Cut off\\ algebra\end{tabular}

& Result &

\begin{tabular}[c]{@{}c@{}}Cut off\\ algebra\end{tabular}\begin{tabular}[c]{@{}c@{}}Cut off\\ algebra\end{tabular}

& Result \\

\midrule %%下横线

小圆圈中有数字

\textcircled{1}

当某个表格超出文字的长度时,进行表格长度限制

\resizebox{\textwidth}{15mm}{

\begin{tabular}{ccc}

\end{tabular} }

15mm表示表格的宽度

表格中的三个横线

\toprule

\midrule

\bottomrule

复杂表格

代码如下

\begin{table*}[t] \centering\caption{MAP scores of teacher model, different student models with 4 widths and three baseline models with different length of binary codes on CIFAR-10 and SUN datasets.}\label{table1}\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}\hline\multicolumn{2}{|c|}{\multirow{2}{*}{Model}} &\multirow{2}{*}{FLOPs}&\multirow{2}{*}{Params} & \multicolumn{4}{c|}{CIFAR-10}&\multicolumn{4}{c|}{SUN}\\ \cline{5-12} \multicolumn{2}{|c|}{} & & & 12bits & 24bits & 32bits & 48bits & 12bits & 24bits & 32bits & 48bits \\ \hline \multicolumn{2}{|c|}{Teacher} &4.12G&25.56M&0.87841&0.89512&0.9014&0.90601&0.83587&0.85736&0.86297&0.87103\\ \hline %0.25x-----------------\multirow{4}{*}{$0.25\times$} & Stu-1 & 0.15G & 1.03M &0.70746 & 0.73458 &0.74909 &0.75833 &0.69618 &0.76631 &0.78075 &0.78787 \\\cline{2-12} \multirow{4}{*}{} & Stu-2 &0.19G&1.08M&0.7629&0.79111&0.80039&0.80519&0.73539&0.79714&0.80753&0.81195\\ \cline{2-12} \multirow{4}{*}{} & Stu-3 &0.26G&1.43M&0.84684&0.86443&0.87384&0.88268&0.79284&0.83442&0.84350&0.84353\\ \cline{2-12} \multirow{4}{*}{} & Stu-4 & 0.29G&1.99M&0.85901&0.87269&0.8836&0.88728&0.81997&0.84620&0.85041&0.85036\\\hline\end{tabular}\label{table_MAP}\end{table*}

•••展开全文