[latex]图片

Subfloats[edit]

A useful extension is the subcaption package which uses subfloats within a single float. The subfigure and subfig packages are deprecated however they are useful alternatives when used in-conjunction with latex templates (i.e templates for journals from Springer and IOP, IEEETran and ACM SIG) that are not compatible with subcaption(建议不要使用subfigure和subfig package.注意不是subfigure命令). These packages give the author the ability to have subfigures within figures, or subtables within table floats. Subfloats have their own caption, and an optional global caption. An example will best illustrate the usage of the subcaption package:

\usepackage{graphicx} 

\usepackage{caption} 

\usepackage{subcaption} 

\begin{figure} 

\centering 

\begin{subfigure}[b]{0.3\textwidth}

\includegraphics[width=\textwidth]{gull} 

\caption{A gull} 

\label{fig:gull} 

\end{subfigure} 

%add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc. 

%(or a blank line to force the subfigure onto a new line) (留一空行可以将图片放到下一行)

\begin{subfigure}[b]{0.3\textwidth}

\includegraphics[width=\textwidth]{tiger} 

\caption{A tiger} 

\label{fig:tiger} 

\end{subfigure} 

\begin{subfigure}[b]{0.3\textwidth}

\includegraphics[width=\textwidth]{mouse} 

\caption{A mouse} 

\label{fig:mouse} 

\end{subfigure} 

\caption{Pictures of animals}

\label{fig:animals} 

\end{figure}

Latex example subfig.png

You will notice that the figure environment is set up as usual. You may also use a table environment for subtables. For each subfloat, you need to use:

\begin{table}[<placement specifier>] \begin{subtable}[<placement specifier>]{<width>} \centering ... table 1 ... \caption{<sub caption>}\end{subtable} ~ \begin{subtable}[<placement specifier>]{<width>} \centering ... table 2 ... \caption{<sub caption>} \end{subtable}\end{table}

If you intend to cross-reference any of the subfloats, see where the label is inserted; \caption outside the subfigure-environment will provide the global caption.

subcaption will arrange the figures or tables side-by-side providing they can fit, otherwise, it will automatically shift subfloats below. This effect can be added manually, by putting the newline command (\\) before the figure you wish to move to a newline.

Horizontal spaces between figures are controlled by one of several commands, which are placed in between \begin{subfigure} and \end{subfigure}:

  • A non-breaking space (specified by ~ as in the example above) can be used to insert a space in between the subfigs.
  • Math spaces\qquad\quad\;, and \,
  • Generic space: \hspace{''length''}
  • Automatically expanding/contracting space: \hfill







\begin{figure}[!h]

  \centering
  \begin{subfigure}{.24\textwidth}
    \includegraphics[width=\textwidth]{fig/ho}
    \caption{Loads.}
  \end{subfigure} 
  \begin{subfigure}{.24\textwidth}
    \includegraphics[width=\textwidth]{fig/he}
    \caption{Volume Opt.}
  \end{subfigure}
  \caption{O.}
  \label{figure:op}
\end{figure}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值