latex图片排版

来源:互联网 发布:德约科维奇 知乎 编辑:程序博客网 时间:2024/05/10 17:25

 LaTeX插图始终是件麻烦的事情, 这里介绍了如何 在LaTeX文档中插入图片, 但有时还是不能满足某些特殊要求. 前面介绍了使用Latex的subfigure竖排图形, 这是介绍使用latex的subfigure排版并排放置的两张图.

注意要使用宏包\usepackage{graphicx}和\usepackage{subfigure}

\begin{figure}\begin{minipage}[t]{0.5\linewidth}\centering\includegraphics[width=2.2in]{fig1.eps}\caption{fig1}\label{fig:side:a}\end{minipage}%\begin{minipage}[t]{0.5\linewidth}\centering\includegraphics[width=2.2in]{fig2.eps}\caption{fig2}\label{fig:side:b}\end{minipage}\end{figure}


还有一种方法:

在某些情况下,有时会希望将并列的图形组成一组,而其中的每一幅图 都保持其独立性。 paisubfigure 宏包的 \subfigure 命令将这一 组做为一幅图形,其中的每一幅图做为子图形。例如:

\begin{figure}  \centering  \subfigure[Small Box with a Long Caption]{    \label{fig:subfig:a} %% label for first subfigure    \includegraphics[width=1.0in]{graphic.eps}}  \hspace{1in}  \subfigure[Big Box]{    \label{fig:subfig:b} %% label for second subfigure    \includegraphics[width=1.5in]{graphic.eps}}  \caption{Two Subfigures}  \label{fig:subfig} %% label for entire figure\end{figure}

详细还可以参见这里.



图片的多行标题显示
从没有想到原来多行显示图片标题居然会是个问题。在默认环境下,使用caption包,短于一行的标题会居中显示,长于一行的标题将会沾满整行然后在行尾断行。这都没有问题。不过,要是想在某个地方人为断行,这个就难了。比如说下面:

Assuming
this
is a Figure

Fig. The figure
caption

人为在figure后加上\\断行后,单行标题变成多行标题,所有行都会顶在行左,就出现了这种难看的样子。到现在我也没有发现有什么办法告诉Latex去居中显示整个标题块,好象是因为latex并不知道标题块有多宽。
这种的办法是配置caption包。我最终的配置:

\usepackage{caption}
\captionsetup{margin=20pt,format=hang,justification=justified}

其中margin告诉latex在标题块的两边都留20pt的空白,如果标题超长,至少多行不会直接顶在最左边。现在是有了20pt的整体缩进。后面的hang是告诉caption允许多行标题,如果出现多行,按照正常的多段文本处理(默认标题只有一段文字,禁止多段文字)。然后justified确定使用默认的问题对齐方式(两端对齐加短行靠左)。不过,这些特性仅仅在新的caption包中才支持。Fedora自带的texlive-2007不支持,需要单独安装最新的caption。后面再说这个问题。


多幅图片的时候,如六幅图片需要分两行,这个时候需要注意的是剧中不可以使用\centerling,这个参数会限定到一行里面去。要使用\centering,然后调整好宽度,就会自动分两行显示

例如

%\begin{comment}\begin{figure}[ht]\centering{\subfigure[] {\includegraphics[width=2.5cm,clip]{./figure9/1.eps}  }\subfigure [] {\includegraphics[width=2.5cm,clip]{./figure9/2.eps} }\subfigure [] {\includegraphics[width=2.5cm,clip]{./figure9/3.eps} }\subfigure[] {\includegraphics[width=2.5cm,clip]{./figure9/4.eps}  }\subfigure [] {\includegraphics[width=2.5cm,clip]{./figure9/5.eps} }\subfigure [] {\includegraphics[width=2.5cm,clip]{./figure9/6.eps} }}\label{fig_sim}\caption{The course of monitoring an object. (a)Firstly the range of detecting region is initial range (b)The size is adjusted to length of object (c)Size recovers when the object passed the line}\end{figure}



原创粉丝点击