转载自:https://blog.csdn.net/liuchang0001/article/details/83705459
众所周知,LaTeX里 面处理图形和表格的浮动体历来是最麻烦的问题之一,原因是即使使用了[h]选项,浮动体还是会乱跑,但如果去掉
egin{figure}
end{figure}
来一个裸的includegraphics又不能结合caption命令加标题。这个问题其实在著名的"LaTeX2e及常 用宏包使用指南"里的8.7节有介绍,但我也是今天才偶然看到这一节,想必还有很多同仁还在为处理浮动体而奋斗,因此贴出来共享一下:
figure和table之所以能够使用caption命令是因为定义了@captype命令,也就是说,如果我们自己定义一下的话也是可以起到同样的效果的。要想做到这一点,首先在引言中加入如下的命令:
makeatletter
ewcommand{figcaption}{def@captype{figure}caption}
ewcommand{ abcaption}{def@captype{table}caption}
makeatother
其中加入makeatletter;makeatother的原因是命令中有@符号。
加入这四行后,再要插入图片时,可以
egin{center}
includegraphics{xxx.eps}
figcaption{xxxx}label{fig:xxx}
end{center}
而表格则是
egin{center}
egin{tabular}{}
end{tabular}
end{center}
举例如下(下面的操作可以在连续插入多个图片时做到图片不浮动,连续呈现)
egin{center}
scriptsize
setlength{elowcaptionskip}{0pt}
setlength{elowcaptionskip}{0pt}
abcaption{$test$}
% 下面的 c 主要是需要说明 列的个数
egin{tabular}{ccccccccccc}
oprule
multirow{1}{*}{} &multicolumn{2}{c}{$A$} &multicolumn{2}{c}{$B$} &multicolumn{2}{c}{$C$} &multicolumn{2}{c}{$D$} &multicolumn{2}{c}{$E$}\
cline{2-11}
& $C=$ & 0 & $C=$ & 0 & $C=$ & 0 & $C=$ & 0 & $C=$ & 0 \
cmidrule(r){2-3} cmidrule(r){4-5} cmidrule(r){6-7} cmidrule(r){8-9} cmidrule(r){10-11}
& $C1$ & $C2$
& $C1$ & $C2$
& $C1$ & $C2$
& $C1$ & $C2$
& $C1$ & $C2$ \
midrule
A & 0.01 & 0(0) & 0.0091 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.01 & 0(0) & 0.01 & 0(0) & 0 & 0(0) & 1 & 1(0) & 0 & 0(0) \
A & 0.04& 0(0) & 0.02 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.0 & 0(0) & 0.03 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.0 & 0(0) & 0.04 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.0 & 0(0) & 0.05 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.1 & 0(0) & 0.6 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.0 & 0(0) & 0.6 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.1 & 0(0) & 0.6 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
A & 0.2 & 0(0) & 0.6 & 0(0) & 0 & 0(0) & 0 & 1(0) & 0 & 0(0) \
ottomrule
end{tabular}
end{center}
