Latex 图片及表格排列代码
·
Latex 图片及表格排列代码
前言
论文编辑和排版中,格式是非常重要的,使用word写做的科研工作者对这个问题肯定深有体会,笔者也是在被论文中各种格式和参考文献问题折磨后,转投了Latex阵营。这是一个很好的排版工具,类似于Markdown,通过简单的命令就可以写出格式非常漂亮的论文,可谓是科研工作中的一大利器。很多新入门的小伙伴也许对这个编辑器中关于图片和表格的创建带有一丝疑惑,下面笔者把自己关于图片和表格创建的latex 代码分享给大家,希望对您的工作有所帮助。
一、图片排版
1. 双栏论文中,两张图片横放
Latex文章开通需要导入的包如下:
\usepackage{subfigure}
具体代码如下:
\begin{figure}[tp]
\subfigure[\scriptsize{}]{
\label{Fig:subfig:CatIsland}
\includegraphics[width=1.63 in]{CatIsland.eps}}
\subfigure[\scriptsize{}]{
\label{Fig:subfig:CatIsland-gt}
\includegraphics[width=1.63 in]{CatIsland-gt.eps}}
\caption{Illustration of the Cat Island dataset: (a) pseudo color (RGB: 130, 70, 15); (b) the ground-truth map.}
\label{CatIsland_dataset}
\end{figure}
具体效果如下:

红色方框中的图像就是本次插入的图像,这样就可以实现双栏排版的论文中的两个图像并列插入的效果。
2. 单栏格式论文中的两张图片并列横放
\begin{figure}[!t]
\centering
\begin{minipage}[c]{0.4\textwidth}
\centering
\includegraphics[width=2.2in]{SanDiego_RGB.eps}
\centerline{(a)}
\end{minipage}
\hspace{0.02\textwidth}
\begin{minipage}[c]{0.4\textwidth}
\centering
\includegraphics[width=2.2in]{SanDiego_RGB_GT.eps}
\centerline{(b)}
\end{minipage}
\caption{Illustration of the San Diego dataset: (a) pseudo color (RGB: 22, 13, 4); (b) the ground-truth map.}
\label{SanDiego_dataset}
\end{figure}
具体效果如下:

3. 双栏格式论文中的两张图片竖放
有时候我们的图片比较大,而双栏中每一栏都相对较小,这时候,我们可以选择两张图片的竖直排列,具体代码如下:
\begin{figure}[!t]
\centering
\begin{minipage}[c]{0.4\textwidth}
\centering
\includegraphics[width=2.8 in]{Box_LosAngeles.eps}
\centerline{(a)}
\end{minipage}
\hspace{0.02\textwidth}
\begin{minipage}[c]{0.4\textwidth}
\centering
\includegraphics[width=2.8 in]{ROC_LosAngeles.eps}
\centerline{(b)}
\end{minipage}
\caption{ROC curves of different methods in Los Angeles dataset: (a) Statistical separability analysis; (b) ROC curves.}
\label{LosAngeles_Results}
\end{figure}
下面我们来看一下效果:

二、表格排版
1. 单栏论文,表格排列
\begin{table}[!t]
\footnotesize
\caption{AUC values of different anomaly detectors using three experimental datasets.}
\label{AUC_Values}
\tabcolsep 21pt %space between two columns. ÓÃÓÚµ÷ÕûÁмä¾à
\begin{tabular*}{\textwidth}{cccccc}
\toprule
Methods & GRX & LRX & RPCA & CRD & CRDBPSW \\\hline
Gulfport & 0.95260 & 0.96940 & 0.95348 & 0.95992 & 0.97913\\
SpecTIR & 0.99138 & 0.99846 & 0.99827 & 0.99830 & 0.99909\\
San Diego & 0.88854 & 0.84557 & 0.91896 & 0.99635 & 0.99873\\
\bottomrule
\end{tabular*}
\end{table}
具体效果:

2. 双栏论文,单栏放置表格
\begin{table} % twocolumn \begin{table*}
\footnotesize
\centering
\caption{AUC values of various anomaly detectors using different datasets.}
\begin{tabular}{cccccc}
\hline
Methods & GRX & LRX & CRD & RPCA-RX & 2S-GLRT \\
\hline
Los Angeles & 0.84038 & 0.98207 & 0.96809 & 0.84737 & \bf{0.98735} \\
Cat Island & 0.98072 & 0.99936 & 0.99458 & 0.98320 & \bf{0.99968} \\
Texas Coast & 0.99065 & 0.99691 & 0.99404 & 0.99265 & \bf{0.99697} \\
Pavia Centra & 0.95380 & 0.95973 & 0.94072 & 0.95906 & \bf{0.98676} \\
Cri & 0.91342 & 0.75251 & 0.87267 & 0.91478 & \bf{0.95403} \\
\hline
\end{tabular}
\label{Tab:AUC_Values}
\end{table} % twocolumn \end{table*}
具体效果如下:

2. 双栏论文,双栏横置表格
进行双栏显示其实很简单,与上述代码一样,只有一个地方改动,具体如下:
\begin{table*}
...
\end{table*}
注意:这里只是在单栏放置的表格代码中,加入了一个* 即可。也就是说表格单栏放置还是双栏放置的区别只有一个 星号。下面来看一个例子:
\begin{table*} % onecolumn \begin{table}
\footnotesize
\centering
\caption{AUC values of various anomaly detectors using different datasets.}
\begin{tabular}{cccccc}
\hline
Methods & GRX & LRX & CRD & RPCA-RX & 2S-GLRT \\
\hline
Los Angeles & 0.84038 & 0.98207 & 0.96809 & 0.84737 & \bf{0.98735} \\
Cat Island & 0.98072 & 0.99936 & 0.99458 & 0.98320 & \bf{0.99968} \\
Texas Coast & 0.99065 & 0.99691 & 0.99404 & 0.99265 & \bf{0.99697} \\
Pavia Centra & 0.95380 & 0.95973 & 0.94072 & 0.95906 & \bf{0.98676} \\
Cri & 0.91342 & 0.75251 & 0.87267 & 0.91478 & \bf{0.95403} \\
\hline
\end{tabular}
\label{Tab:AUC_Values}
\end{table*} % onecolumn \end{table}
具体看一下单栏放置表格的效果:

3. 双栏论文,双栏横置表格的另一种形式
\begin{tabular}{|c||c|c|c|c|c|c|c|}
\hline
Algorithms& GRXD & LRXD & SRX-Segmented & RPCA-RX & \textcolor[rgb]{1.00,0.00,0.00}{LRASR} & \textcolor[rgb]{1.00,0.00,0.00}{LSMAD} & Proposed \\
\hline
SpecTIR & 0.18736 & 0.20457 & 347.92260 & 15.37072 & 249.75547 & 26.029437 & 78.66312 \\
\hline
WTC & 0.34108 & 0.36734 & 775.74485 & 43.40107 & 408.58569 & 67.354346 & 268.33214 \\
\hline
HYDICE & 0.04777 & 0.34789 & 86.36774 & 2.57969 & 18.692069 & 3.960207 & 6.85247 \\
\hline
\end{tabular}
\label{Tab:TIMES}
\end{table*}
具体效果如下:

总结
在实际使用中,作者可以根据不同的需求来选择不同的代码,进行测试,在不同期刊论文的latex模板中一般都内置了一些简单的说明,代码风格也是稍微有些差异,这些根据实际需求,自己选择和取舍。
更多推荐



所有评论(0)