507. LaTeX技巧151:subfigure排版并排放置两图 您所在的位置:网站首页 两张图的排版海报怎么弄的 507. LaTeX技巧151:subfigure排版并排放置两图

507. LaTeX技巧151:subfigure排版并排放置两图

2024-06-17 06:56| 来源: 网络整理| 查看: 265

QQ群:91940767/145316219/141877998/80300084/194770436 淘宝店:http://latexstudio.taobao.com 技巧续篇:http://latexstudio.net/ 常见数学公式问题集下载

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

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

[CODE]

\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 命令将这一组做为一幅图形,其中的每一幅图做为子图形。例如:

[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} 子图的标记有两种形式: 一种是出现在子图的下面作为标题的一部分。这通过命令 \@thesubfigure 来生成。 另一种是在使用 \ref 命令的时候出现。这通过将命令 \p@subfigure 的输出处理后传递给 \thesubfigure 命令来生成。 上面的这些命令使用 subfigure 计数器和 \thefigure 命令。子图的标记的格式由下面的命令来控制。 命令 \thefigure 印出当前图形的编号。 计数器 subfigure 记录子图的编号,命令 \alph{subfigure} 将计数器 subfigure 的值用小写字母印出,而命令 \roman{subfigure} 则是用小写罗马数字印出(有关印出计数器值的命令可参见文献 [1, 第 98 页] 和 [3, 第 446 页]。)。 命令 \thesubfigure 缺省使用小写字母,如 (a),(b) 等。 命令 \@thesubfigure 缺省为 \thesubfigure\space,即在标题标记和文本之间加上一个空白。 命令 \p@subfigure 缺省为 \thefigure。 如果改变子图标题的标记,字体等的缺省值,可参见文献 [10]。下面给出几个简单的例子: 若想让子图标题标记使用小写罗马数字如 (i), (ii)等, \ref 命令的结果如 12i, 12ii 等,可使用下面的命令(最好放在导言区中) \renewcommand{\thesubfigure}{\roman{subfigure}} \makeatletter \renewcommand{\@thesubfigure}{(\thesubfigure)\space} \renewcommand{\p@subfigure}{\thefigure} \makeatother 若想让子图标题标记使用阿拉伯数字如 12.1:, 12.2: 等, \ref 命令的结果如 12.1, 12.2 等,可使用下面的命令 \renewcommand{\thesubfigure}% {\thefigure.\arabic{subfigure}} \makeatletter \renewcommand{\@thesubfigure}{\thesubfigure:\space} \renewcommand{\p@subfigure}{} \makeatother 缺省情况下,用 \listoffigures 命令生成的图形目录中只包括图形,而不包括子图。要想在图形目录中包括子图,要在 \listoffigures 命令前加上 \setcounter{lofdepth}{2}。需要说明的是,由于 LATEX 的变化,导致目前版本(3/95)的 subfigure 宏包在图形目录的子图输入项开始部分都加上 ``numberline1''。将下面的代码加到导言区中就可以解决这一问题。 \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 演示效果图: 演示代码: \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{图} \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}


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有