1

I have the following code

\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} 

The problem is that figure appears in a new page. Is there a way to make the figure appear in the same page as the text?

  • You had some answers on that question before. So why do you delete it and start all over again? – Piet van Oostrum Dec 17 '16 at 20:27
  • @PietvanOostrum ,I didn't phrase my question correctly before and I didn't get any answers that worked. – MrDi Dec 17 '16 at 20:30
1

It should be sufficient to add `[t]˙option to figure environment:

\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*}

enter image description here

Note: Instead of subcaption you should load subfig package (for sub figures you use subfloat environments). Also it is sufficient to load color package ones, second loading by\RequirePackage{color} is surplus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.