) Latex: subfigure layout: place two pictures side by side

Source: Internet
Author: User
Tags arabic numbers

Latex illustrations are always troublesome. This article describes how to insert images in latex documents, but sometimes they cannot meet certain special requirements. we have introduced the use of latex's subfigure vertical layout. This is two la s that use latex's subfigure layout side by side.

Be sure to use the macro package \ usepackage {graphicx} And \ usepackage {subfigure}

[Code]

\ Begin {figure}
\ Begin {minipage} [T] {0.5 \ linewidth}
\ Centering
\ Includegraphics [width = 2.2in] {fig1.eps}
\ Caption {fig1}
\ Label {FIG: Side:}
\ 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}

Another method is as follows:

In some cases, you sometimes want to group parallel images, and each of them maintains its independence. Paisubfigure macro package\ SubfigureCommand to make this group into a graph, each of which is used as a subgraph. For example:

[Code]

\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}
Subgraphs are marked in two forms:
  1. One is to appear below the subgraph as part of the title. This command\ @ Thesubfigure.
  2. The other is in use\ RefCommand. This command\ P @ subfigureAfter the output is processed, it is passed\ ThesubfigureCommand to generate.

Use the preceding commandsSubfigureCounter and\ ThefigureCommand. The format of the subgraph tag is controlled by the following command.

  • Command\ ThefigureThe ID of the current image.
  • CounterSubfigureNumber of the record subgraph, command\ Alph {subfigure}Change the counterSubfigureThe value is printed in lowercase letters, while the command\ Roman {subfigure}It is printed with lower-case roman numerals (for commands on printing counter values, see [1, 98th pages] and [3, 446th pages].)
  • Command\ ThesubfigureLowercase letters, such as (a) and (B) are used by default.
  • Command\ @ ThesubfigureDefault Value:\ Thesubfigure\ SpaceThat is, a blank space is added between the title tag and the text.
  • Command\ P @ subfigureDefault Value:\ Thefigure.
If you change the default values of the title tags and fonts, see [10]. Below are some simple examples:

  • If you want to mark a subgraph title with lower-case roman numerals such as (I) and (ii,\ RefCommand results such as 12i and 12ii. You can use the following command (preferably in the Introduction area)

     \renewcommand{\thesubfigure}{\roman{subfigure}} \makeatletter \renewcommand{\@thesubfigure}{(\thesubfigure)\space} \renewcommand{\p@subfigure}{\thefigure} \makeatother
  • If you want to mark the subgraph title with Arabic numbers such as 12.1:, 12.2,\ RefYou can use the following command to obtain the command result, such as 12.1 and 12.2.
     \renewcommand{\thesubfigure}% {\thefigure.\arabic{subfigure}} \makeatletter \renewcommand{\@thesubfigure}{\thesubfigure:\space} \renewcommand{\p@subfigure}{} \makeatother 
By default\ ListoffiguresCommand-generated graph directories only contain graphs, not subgraphs. To include a subgraph in the graph directory\ ListoffiguresAdd\ Setcounter {lofdepth} {2}. It must be noted thatATEX changes, resulting in the current version (3/95)SubfigureThe macro package adds ''numberline1 ''To the start part of the subgraph input item in the graphic directory ''. Add the following code to the Introduction area to solve this problem.

\makeatletter \renewcommand{\@subcaption}[2]{% \begingroup \let\label\@gobble \def\protect{\string\string\string}% \xdef\@subfigcaptionlist{% \@subfigcaptionlist,% {\numberline {\@currentlabel}% \noexpand{\ignorespaces #2}}}% \endgroup \@nameuse{@make#1caption}{\@nameuse{@the#1}}{#2}} \makeatother
Demo:
 
DEMO code:
\ Documentclass {Article}
\ Usepackage {CJK}
\ Usepackage {graphicx}
\ Usepackage [includemp, body = {398pt, 550pt}, footskip = 30pt, %
Marginparwidth = 60pt, marginparsep = 10pt] {geometry}
\ Usepackage {graphicx}
\ Usepackage {subfigure}

\ Begin {CJK *} {GBK} {SONG}
\ Renewcommand \ figurename {figure}
\ Begin {document}
\begin{figure}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=2.2in]{pic1.eps}
\caption{fig1}
\label{fig:side:a}
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=2.2in]{pic.eps}
\caption{fig2}
\label{fig:side:b}
\end{minipage}
\end{figure}
\begin{figure}
  \centering
  \subfigure[Small Box with a Long Caption]{
    \label{fig:subfig:a} %% label for first subfigure
    \includegraphics[width=1.0in]{pic1.eps}}
  \hspace{1in}
  \subfigure[Big Box]{
    \label{fig:subfig:b} %% label for second subfigure
    \includegraphics[width=1.5in]{pic.eps}}
  \caption{Two Subfigures}
  \label{fig:subfig} %% label for entire figure
\end{figure}

\paragraph{}
\clearpage
\end{CJK*}
\end{document}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.