The picture is at the position of the header: http://dl.getdropbox.com/u/175564/%20latex1.png
Code:
\begin{figure}
\subfloat[A gull]{\label{fig:gull}\includegraphics[width=0.15\textwidth]{p1.png}}
\subfloat[A tiger]{\label{fig:tiger}\includegraphics[width=0.15\textwidth]{p2.png}}
\caption{Pictures of animals}
\label{fig:animals}
\end{figure}
Code before \begin{document}:
\documentclass[12pt,a4paper, notitlepage]{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{fancyhdr}
\usepackage{verbatim} % by \begin{comment}---\end{comment}
\usepackage{subfig}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{subfig}
\floatstyle{ruled}
\newfloat{program}{thp}{lop}
\floatname{program}{Program}
\cfoot{\ }
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\title{Applying a}
What could be the cause of the problem?
You can control the position of an image using options for the figure environment, e.g. the [h!] in the example below tells LaTeX to put the figure exactly where it appears in the text, instead of letting it 'float' to a particular place in the document.
placeins provides the command \FloatBarrier to limit the floating of figures or tables. You could place such a barrier before and after a listing. afterpage allows a more clever \clearpage , putting the effect off until the page is full: \afterpage{\clearpage}
Including images in your LaTeX document requires adding: \usepackage{graphicx} to the beginning/preamble of your document. \includegraphics{ } command tells LaTeX to insert the image. To upload an image, click the upload button, and upload your image file.
Figures float.
That is, TeX moves them around to accommodate its typesetting needs. You have the option of specifying what types of places you want TeX to try to put them using:
\begin{figure}[htpb]
...
\end{figure}
where the options mean:
h -- here
t -- top
b -- bottom
p -- page (on a page-o-floats)
H -- Absolutely right here (but requires the `float` package)
Using !
in the options will tell TeX to try hard to put it near the things it is adjacent to in the source file. The default positioning is tbp
, so "here" is not even an option unless you ask for it. Also note that the ordering of the options is irrelevant, so [p!bh]
will give the same result as [!hbp]
.
So try \begin{figure}[h!]
(or \begin{figure}[H]
if you have already done \usepackage{float}
)
The same options are available for tables and any other floats you define.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With