[texhax] Can I require figures to remain under a certain section heading?

Sam Albers tonightsthenight at gmail.com
Fri Feb 3 20:27:16 CET 2012


Hello all,

I have a problem that seems like it should be easy but I can't seem to
figure it out. I want to make a LaTeX document that consists almost
entirely of figures divided into sections. The problem is that the
figures don't want to stay in their sections. I am searching for a way
to force the figures to stay in the section that they are "assigned"
in the .tex file even if it means starting a new page for only a
figure. I thought about using Beamer but I want the output to be
optimized for print not screen. The example below should illustrate my
problem:

\documentclass[12pt]{article}

\usepackage[landscape]{geometry}

\begin{document}

\section{Test1}
\begin{figure}[htp]
  \centering
\setlength{\unitlength}{5cm}
\begin{picture}(1,1)
\put(0,0){\line(0,1){1}}
\put(0,0){\line(1,0){1}}
\end{picture}
  \caption{}
\end{figure}




\section{Test2}
% I want all the figures here to stay in this section
\begin{figure}[htp]
  \centering
\setlength{\unitlength}{5cm}
\begin{picture}(1,1)
\put(0,0){\line(0,1){1}}
\put(0,0){\line(1,0){1}}
\end{picture}
  \caption{}
\end{figure}

\begin{figure}[htp]
  \centering
\setlength{\unitlength}{10cm}
\begin{picture}(1,1)
\put(0,0){\line(0,1){1}}
\put(0,0){\line(1,0){1}}
\end{picture}
  \caption{}
\end{figure}

\section{Test3}
% Nothing in this section
% And I would like a way to keep this free of figure that came previous
\end{document}

Can any one recommend a good way to do this?

Thanks so much in advance!

Sam


More information about the texhax mailing list