Graphics, Figures & TablesAligning figures imported from external file

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
elingeniero
Posts: 12
Joined: Mon Feb 13, 2012 12:30 pm

Aligning figures imported from external file

Post by elingeniero »

Hi

I have figures in a separate file, their size make it possible for two figures to be on the same page. However, when I import the file into my main document, the figure that appears alone (the odd number figure) goes in the middle of the next page; lots of white space above it and below it!
(e.g if I have three figures, figures 1 & 2 will fit onto one page, but figure 3 centres the second page!) I don't want this, I want it to be at the top of the second page and I can write under it.

A sample of the code:

Code: Select all

\documentclass[12pt]{article}
\usepackage{syntonly}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage[titles]{tocloft}
\usepackage{placeins}
\usepackage{fancyhdr}
\usepackage{pdflscape}
\usepackage{xfrac}
\usepackage[top=2.54cm, bottom=2.54cm, left=3.18cm, right=3.18cm]{geometry}
\usepackage{hyperref}
\usepackage[all]{hypcap}
\usepackage{amsmath}
\linespread{1.3}

\subsection{Results}
\input{./fluidresults.tex}
\FloatBarrier %i need this or else the next section will go between my graphs.
where

Code: Select all

fluidresults.tex
is

Code: Select all

\begin{figure}[ht] %this for example goes on page 1
\capstart
\centerline{\includegraphics[scale=0.8]{pipet1_15Nov}}
\caption{Pressure distribution at \emph{Subcritical} Reynolds \mbox{number}}
\label{pr1}
\end{figure}
\begin{figure}[ht]
\centerline{\includegraphics[scale=0.8]{pipet2_15Nov}}
\caption{Pressure distribution at \emph{Critical} Reynolds \mbox{number}}
\label{pr2}

\end{figure}

\begin{figure}[ht] %this goes on page 1 as well

\capstart
\centerline{\includegraphics[scale=0.8]{pipet3_15Nov}}
\caption{Pressure distribution at \emph{Supercritical} Reynolds \mbox{number}}
\label{pr3}
\end{figure}
\setcounter{figure}{0}
\addtocounter{fig}{1}
\begin{figure}[ht]
\capstart
\centerline{\includegraphics[scale=0.8]{waket1_15Nov}}
\caption{Wake velocity distribution at \emph{Subcritical} Reynolds \mbox{number}}
\label{wk1}
\end{figure}


\begin{figure}[ht] %this goes on page 2, aligned in the middle of the page!
\capstart
\centerline{\includegraphics[scale=0.8]{waket2_15Nov}}
\caption{Wake velocity distribution at \emph{Critical} Reynolds \mbox{number}}
\label{wk2}
\end{figure}
Not as important as the main question, but hypcapand hyperref are not working properly for some reason. I have Figures 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, 3.1, 4.1, 4.2, 4.3. So now if I click a link for 1.1 or 2.1 or 3.1 in the document, it jumps to 4.1 and if I click 1.2 or 2.2 it jumps to 4.2 and so on.

Recommended reading 2024:

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

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

elingeniero
Posts: 12
Joined: Mon Feb 13, 2012 12:30 pm

Aligning figures imported from external file

Post by elingeniero »

putting the \FloatBarrier before the graph the odd number graph solved the problem

Code: Select all

\begin{figure}[ht] %this for example goes on page 1
\capstart
\centerline{\includegraphics[scale=0.8]{pipet1_15Nov}}
\caption{Pressure distribution at \emph{Subcritical} Reynolds \mbox{number}}
\label{pr1}
\end{figure}
\begin{figure}[ht]
\centerline{\includegraphics[scale=0.8]{pipet2_15Nov}}
\caption{Pressure distribution at \emph{Critical} Reynolds \mbox{number}}
\label{pr2}

\end{figure}

\begin{figure}[ht] %this goes on page 1 as well

\capstart
\centerline{\includegraphics[scale=0.8]{pipet3_15Nov}}
\caption{Pressure distribution at \emph{Supercritical} Reynolds \mbox{number}}
\label{pr3}
\end{figure}
\setcounter{figure}{0}
\addtocounter{fig}{1}
\begin{figure}[ht]
\capstart
\centerline{\includegraphics[scale=0.8]{waket1_15Nov}}
\caption{Wake velocity distribution at \emph{Subcritical} Reynolds \mbox{number}}
\label{wk1}
\end{figure}

\FloatBarrier %here
\begin{figure}[ht] %this is now on top of page 2.
\capstart
\centerline{\includegraphics[scale=0.8]{waket2_15Nov}}
\caption{Wake velocity distribution at \emph{Critical} Reynolds \mbox{number}}
\label{wk2}
\end{figure}
Post Reply