如何使图形与文本对齐?

如何使图形与文本对齐?

我有以下代码

\documentclass{aastex}
\usepackage{spr-astr-addons}
\usepackage{url}\urlstyle{rm}
\usepackage{graphicx}
\usepackage{color}

\usepackage{lipsum}

\usepackage{caption}
\usepackage{subcaption}

\RequirePackage{color}
\def\imagei{\centerline{\color[gray]{.75}\rule{\hsize}{4pc}}}%
\def\imageii{\centerline{\color[gray]{.75}\rule{4pc}{4pc}}}%

\makeatletter
\newcommand{\twocolumncaption}{\@dblarg\@twocolumncaption}
\def\@twocolumncaption[#1]#2{%
  \renewcommand{\@makecaption}[2]{%
    \par\vskip\abovecaptionskip\begingroup\small\rmfamily
    \splittopskip=0pt
    \setbox\@tempboxa=\vbox{
      \@arrayparboxrestore \let \\\@normalcr
      \hsize=.5\hsize \advance\hsize-1em
      \let\\\heading@cr
      \noindent ##1\ ##2\par% this line for aastex
    }%
    \vbadness=10000
    \setbox\z@=\vsplit\@tempboxa to .55\ht\@tempboxa
    \setbox\z@=\vtop{\hrule height 0pt \unvbox\z@}
    \setbox\tw@=\vtop{\hrule height 0pt \unvbox\@tempboxa}
    \noindent\box\z@\hfill\box\tw@\par
    \endgroup\vskip \belowcaptionskip
  }%
  \setlength{\abovecaptionskip}{4ex}%
  \caption[#1]{#2}%
}
\makeatother

\begin{document}
\title{Title}
%%\shortauthors{Al-Hamzawi}

\begin{abstract}
\begin{description}
\item[PACS numbers] 04.50.Kd, 04.20.-q, 04.25.Nx
\end{description}
\end{abstract}

\keywords{Keywords}

\section{Introduction}
\lipsum[1-3]

\begin{figure*}
\centering
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}
\twocolumncaption{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate  a, magna. Donec vehicula augue eu neque.
Pellentesque habitant morbi  tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris  ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum
urna  fringilla.}
\end{figure*}

\lipsum

\begin{thebibliography}{}

\bibitem[Starobinsky (2007)]{starobinsky2007disappearing} Starobinsky, Alexei A 2007, JETP Letters, 86, 157--163

\end{thebibliography}
\end{document} 

问题是图片出现在新页面中。有没有办法让图片和文本出现在同一个页面中?

答案1

将 `[t]˙option 添加到图形环境就足够了:

\begin{figure*}[t]% <-- added option
\centering
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\hfil
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\hfil
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}

\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\hfil
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}\hfil
\subfloat[]{\includegraphics[width=0.25\textwidth]{Fig1.eps}}

\twocolumncaption{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate  a, magna. Donec vehicula augue eu neque.
Pellentesque habitant morbi  tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris  ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum
urna  fringilla.}
\end{figure*}

在此处输入图片描述

笔记:subcaption应该加载subfig包(对于子图,你使用subfloat环境)。此外,加载color包就足够了,第二次加载\RequirePackage{color}是多余的。

相关内容