1

I'm using MikTeX 2.9, I'm trying to add a figure from a pdf file, but it keeps getting placed on top of my regular text or partially off the page and in my footer section. I am NOT using columns. I've tried putting \frame{} about it to show the bounding box, but it doesn't appear to be inside the bounding box. Here is the pertinent code:

Preamble, much from a template:

\documentclass[11pt]{article} % use larger type; default would be 10pt

\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)

%%% Examples of Article customizations
% These packages are optional, depending whether you want the features they provide.
% See the LaTeX Companion or other references for full information.

%%% PAGE DIMENSIONS
\usepackage{geometry} % to change the page dimensions
\geometry{letterpaper} % or letterpaper (US) or a5paper or....
% \geometry{margin=2in} % for example, change the margins to 2 inches all round
% \geometry{landscape} % set up the page for landscape
%   read geometry.pdf for detailed page layout information

\usepackage{graphicx} % support the \includegraphics command and options

% \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent

%%% PACKAGES
\usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% These packages are all incorporated in the memoir class to one degree or another...

%%% HEADERS & FOOTERS
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\pagestyle{fancy} % options: empty , plain , fancy
\renewcommand{\headrulewidth}{0pt} % customise the layout...
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\thepage}\rfoot{}

%%% SECTION TITLE APPEARANCE
\usepackage{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
% (This matches ConTeXt defaults)

%%% ToC (table of contents) APPEARANCE
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
\usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!

%%% END Article customizations

\usepackage{xcolor} %for color in the text, to help with my notes to us
\usepackage{mathtools} % for definition symbol


\usepackage{longtable}

\usepackage{booktabs} % For \toprule, \midrule and \bottomrule
\usepackage{siunitx} % Formats the units and values
\usepackage{pgfplotstable} % Generates table from .csv

\usepackage{csvsimple}
\usepackage{rotating}
\usepackage{lscape}
%\usepackage{mcode} % for putting Mathlab code into the document.
\usepackage{times}
\usepackage{babel}
% should that word in brackets below be strict?  
%\usepackage[sctrict]{changepage}
\usepackage{changepage}

\usepackage{float} % for the [H] option to force placement of figures and other floats where I typed them.
\usepackage[section]{placeins} % so floats won't go beynd their own section
%
%\widowpenalty=300
%\clubpenalty=300
\usepackage[hyphens]{url}
\urlstyle{same}
\usepackage{breakurl}
\usepackage{hyperref} % for hyperlinks

\usepackage{fancyhdr}
%\pagestyle{fancy}

%\lhead{This is my name}
%\rhead{this is page \thepage}
\cfoot{C.Celice, N. Kethineni, K. Sumi}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}


\usepackage{listings} % for listing R code


\usepackage{amsmath} % For cases in math mode
\usepackage{amsmath,amsfonts,amssymb,amsthm} % For blackboard bold
\setlength\parindent{0pt}
\usepackage{pdfpages} % inserts more than one page of a pdf file

\usepackage{float} % for the [H] option to force placement of figures and other floats where I typed them.

\usepackage[normalem]{ulem} % for striking through text

\usepackage[skip=10pt]{caption}

\title{{\Huge Optimization of Airplane Landing Times}}
\author{Catherine Angela Celice\\ Wayne State University\\catherine@wayne.edu \and Nalini Kethineni\\ Wayne State University\\et5561@wayne.edu \and Kamrun Nahar Sumi\\ Wayne State University\\KamrunNaharSumi@wayne.edu}
\date{} % Activate to display a given date or no date (if empty),
         % otherwise the current date is printed 


\begin{document}
\maketitle

Here is the code surrounding the figure:

\section{The Mixed Integer Programming Method}

In this study, we consider the case where either of the plane i or j can land first. The reference paper also demonstrates all the necessary constraints for this case. All of the constraints mentioned above have one thing in common, ie. they are valid when i is not equal to j. This means that the plane cannot make pair of itself. \\

Table \ref{MIPruns} shows the analysis details of a static case single runway ALP for the number of aircraft: $10, 50, 100, 150, 250,$ and 500. The number of variables increases from 40 to 2000 with the increase of aircraft number from 10 to 500. On the other hand, the rate of increase of number of constraints are much higher compared to the number of variables with the increase of number of aircrafts. For example, the number of constraints for 10 aircrafts is 231 whereas the number of constraints for 500 aircraft is a little over than half million. As shown in the table, optimal solution is only found for plane number 10 and 50. For more than 50 aircrafts, the convergence rate is extremely slow and optimal solution was not found within the time specified in this table. For the 100 aircrafts, the simulation was run for 2 hours and 17 minutes, yet optimal solution was not found. The gap at final step for 100 aircraft was found to be 25\%. Therefore, a stopping criterion of 20 minutes and 20\% gap was applied for the rest of the aircrafts. As shown in this table \ref{MIPruns}, the gap is close to 50\% for number of aircrafts more than 100.\\




\begin{table}[h]
\centering
\caption{Analysis Results of a Static Case and Single Runway ALP}
\label{MIPruns}
\begin{tabular}{|p{8mm}|p{14mm}|p{18mm}|p{11mm}|p{14mm}|p{14mm}|c|p{14mm}|}
\hline 
No. of planes & No. of variables & No. of constraints & Optimal solution found & Optimal value at final step & Stopping Criteria & Gap (\%) & Run time (s)\\
\hline
10 & 40 & 231 & Yes & 700 & Not applied & 0 & 3 sec\\  
\hline
50 & 200 & 5152 & Yes & 1775 & Not applied & 0 & 5 sec\\
\hline
100 & 400 &20301 & No & 5274 & 2 hr s 17 mins & 25 & $>$2hrs 17 min\\
\hline
150 & 600 & 45452 & No & 12310 & 20 minutes & 54 & $>$20 mins\\
\hline
250 & 1000 & 125752 & No & 16130 & 20 minutes & 45 & $>$20 mins\\
\hline
500 & 2000 & 501502 & No & 34378 & 21 minutes & 40 & $>$20 mins\\
\hline
\end{tabular}
%\end{adjustwidth*}
\end{table}


Figure \ref{MIPoptvsplanes} shows the optimal solution at final step against the number of aircrafts. As shown in the figure, the optimal solution increases with the increase of number of aircrafts since penalty cost is higher for higher number of aircrafts. The trend between aircraft number 250 and 500 seems linear in the above graph because there is no data point between them. If there were more data points between them, the line might have been nonlinear between these two points. This graph shows that more runways are mandatory in order to reduce the cost when the number of landing aircrafts are high.\\
%

%%\vspace{1cm}
\begin{figure}
\hspace*{-1cm}
%\begin{center}

\frame{\includegraphics[scale=0.8,  trim = 2cm 25cm 1.5cm 2cm]{"Kamrun Figure 1".pdf}}

\caption{Optimal Value at Final Step Versus the Number of Aircraft.}
\label{MIPoptvsplanes}
%\end{center}
\end{figure}

\vspace{15cm}

%\vspace{5cm}

Table \ref{MIPruns} suggests us to investigate the convergence rate, i.e. change of optimal solution value over time, for large number of aircraft where optimal solution was found within 20 minutes. Figure \ref{MIPconvergence} shows the convergence rate for the aircraft number 100, 150, 250, and 500. In these graphs, the x axis represents the simulation time and y axis represent the objective function value. For all the cases, it is observed that the objective function value remains either constant or significantly low which can be assumed as constant. This means that even if the simulation is run for longer time, it is highly unlikely to get the optimal solution with 0\% gap at reasonable timeframe. For example, the simulation was run for 2 hours and 17 minutes for the 100 aircrafts, but the objective function value was not changing over time. This proves that it is extremely difficult to get exact solution for the aircraft number greater than 50 which matched with the research findings in the research articles. Therefore, a different approach must be taken, i.e. a metaheuristic approach will be a better method to solve this problem faster with the compromise of solution accuracy.\\

I've tried adding vspace in various places. That hasn't worked. I've tried using figure* instead of figure. I tried using [h], [t], and no placement suggestions. I still have the same problem. I've deleted my aux files and everything, but the tex file. The problem remains. I've never encountered this before.

By the way, I also tried importing the table from a pdf file, but the same thing happened, so I typed it in manually. The second figure I've imported works just fine, but it does take up a whole page.

Any hints, or even alternate ways to include this graph would be greatly appreciated. Thank you.

  • Welcome to TeX.SX! I'm not sure that I understand the problem. Is the image simply too big so it overlaps on the text? Also, possibly not related to this problem, but you should consider rewriting your preamble. A lot of packages are loaded twice (at least booktabs, amsmath, float and fancyhdr) and some options are defined some place and then overwritten after. – Vincent Dec 16 '19 at 18:08
  • Thank you Vincent. I tend to add packages as I need them, ignoring what he template already has. I'll look into fixing that. Actually, my figure is relatively small. Maybe 2 and a half inches high. It is as if the text is ignoring the fact that there is a figure there and so the figure lies on top of the text. – Catherine Dec 16 '19 at 20:00
  • Actually, looking at it more carefully, not only is the figure lying on top of the text, but the caption is lying on top of the figure instead of being above it as it normally would be. – Catherine Dec 16 '19 at 20:07
  • Looking at the bounding box, which is way too small, IT is positioned correctly between paragraphs of text. However, the figure itself is completely outside of the bounding box. I didn't know such a thing is possible. – Catherine Dec 16 '19 at 20:12
  • Then the problem is that the image has a faulty bounding box and you need to ideally correct it in the PDF. Failing that, you can override the information when you include it (see graphicx manual for details), but correcting the image would be better. – cfr Dec 16 '19 at 20:35
0

A TA fixed the problem by typing:

\begin{figure}[!htbp]

instead of any of these:

\begin{figure}
\begin{figure*}
\begin{figure}[h]
\begin{figure}[t]
\begin{figure}[b]

I don't know why it worked, but it did. Thank you to all who tried to help me.

|improve this answer|||||

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.