Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to get four figures (centered on a page in a 2x2 grid) to show up on the same page as the section heading ("Appendix").

The following puts the word "Appendix" on one page (all by itself) and then the four figures on their own page.

I've messed with \nopagebreak, \begin{samepage}...\end{samepage}, \begin{minipage}...\end{minipage} with no luck.

\bibliographystyle{plain}
\bibliography{sid}
\vfill\eject
\appendix
\label{sec:ads}
\begin{figure*}
\centering
\subfigure[]{
  \includegraphics[height=150pt]{./figs/jjj.png}
  \label{fig:jjj}
} \quad
\subfigure[]{
  \includegraphics[height=150pt]{./figs/xxx.png}
  \label{fig:xxx}
} \quad
\subfigure[]{
  \includegraphics[height=150pt]{./figs/nnn.png}
  \label{fig:nnn}
} \quad
\subfigure[]{
  \includegraphics[height=150pt]{./figs/aaaa.png}
  \label{fig:aaa}
} \quad
\caption{blah  }
\label{fig:aaaa}
\end{figure*}

The \vfill\eject business is to get the word "Appendix" to appear at the top of a new page, not right after the bibliography. BTW, \appendix has this entry in the cls file:

 \def\appendix{\par
 \section*{APPENDIX}
 \setcounter{section}{0}
 \setcounter{subsection}{0}
 \def\thesection{\Alph{section}} }
share|improve this question
1  
Rather than \vfill\eject, just use \newpage. LaTeX will only put a figure* at the top of a page. Try the H option as Ian suggested. In general, if you tell a figure to float, it will float. If you don't want that, try any of the solutions you can find by searching this site for floating graphics. –  TH. Apr 6 '11 at 0:32

2 Answers 2

up vote 3 down vote accepted

Obviously, in this case, you don't want your figures to float, so the natural approach would be not to use float environments. You can use minipages to properly align your subfigures, and using the \captionof command provided by the caption and subcaption packages you can give a caption to your subfigures and to your figure, allowing corresponding labels for cross-references. Here's a little example:

\documentclass{book}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[demo]{graphicx}

\begin{document}

\appendix
\chapter{Test Appendix}\label{sec:ads}

\noindent\begin{minipage}{\textwidth}
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[height=150pt]{./figs/jjj.png}
  \captionof{subfigure}{First subfigure.}
  \label{fig:jjj}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[height=150pt]{./figs/xxx.png}
  \captionof{subfigure}{Second subfigure.}
  \label{fig:xxx}
\end{minipage}\\
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[height=150pt]{./figs/nnn.png}
  \captionof{subfigure}{Third subfigure.}
  \label{fig:nnn}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[height=150pt]{./figs/aaaa.png}
  \captionof{subfigure}{Fourth subfigure.}
  \label{fig:aaa}
\end{minipage}
\captionof{figure}{A figure with four subfigures.}
\label{fig:aaaa}
\end{minipage}

\end{document}

I added the demo option to the graphicx package in order to make my example compilable for everyone; do not use that option in your actual code.

As a side note, you seem to be using the subfigure package; this package is obsolete and shouldn't be used anymore; you can use the subcaption package instead.

share|improve this answer

I think this has something to do with the fact that you are using figure*. Normally you can use the [H] option provided by the float package.

\begin{figure}[H]
...
\end{figure}

will force the figure to exactly where it appears in the input file. However, starred figures can only appear at the top of a page, or on their own page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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