Graphics, Figures & TablesPicture jumping to new Page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jlatex
Posts: 4
Joined: Wed Aug 03, 2011 9:22 pm

Picture jumping to new Page

Post by jlatex »

I'm trying to have 2 pictures vertically above one another.

Code: Select all

\documentclass{report}

\usepackage{graphicx}	%allows the inclusion of graphics
\usepackage[labelfont=bf, font={bf,small}, aboveskip=2pt,singlelinecheck=false]{caption}
\usepackage[top = 1.25in, bottom = 1.25in, left = 1.25in, right = 1.25in]{geometry}
\usepackage{setspace}
%\usepackage{showframe}


\newcommand{\pic}[2]
{\begin{figure}[!ht]
%setting picture border
\setlength\fboxsep{0pt}	%offset from edge of picture
\setlength\fboxrule{0.75pt}	%border size
\fbox{\includegraphics[width = 5.99in,height=3.97in]{#1}}
\caption{#2}
\end{figure}}

\begin{document}
\section{Section 1}
\subsection{Subsection 1}
Text goes here

\pagebreak
%newpage
%clearpage

\pic{Pic1}{Test Picture 1}
\pic{Pic2}{Test Picture 2}
\pic{Pic3}{Test Picture 3}

\end{document}
The first picture is always the only one on the page but the rest of the pictures seem to fit vertically above each other. It works if the pictures are smaller but they have to be that exact size. Any way to get this done?
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Picture jumping to new Page

Post by Stefan Kottwitz »

Hi,

if you don't like the pictures to float, perhaps don't use a figure environment.

There are some LaTeX lengths regarding figures you could tweak, listed here.

Stefan
LaTeX.org admin
Post Reply