Graphics, Figures & Tables ⇒ positioning/centring problem
positioning/centring problem
\begin{center}
\begin{figure}
% Requires \usepackage{graphicx}
\includegraphics[width=100mm]{code-1.png}\\
\caption{Periodic recurrence relation search code}\label{B}
\end{figure}
\end{center}
I have put \usepackage{graphicx} at the top of my document. I find:
1. the picture is not centred
2. the picture appears at a different place to that chosen in the source code (in fact, at the top of a page.)
I have looked for help in previous postings, but with no joy. As you can see, I am in the early stages of learning Latex, and any help would be gratefully received,
Best wishes,
Max Hikorski
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
positioning/centring problem
Code: Select all
\begin{figure}
\centering
\includegraphics[width=100mm]{code-1.png}
\caption{Periodic recurrence relation search code}\label{B}
\end{figure}
Code: Select all
\begin{figure}[!h]
\centering
\includegraphics[width=100mm]{code-1.png}
\caption{Periodic recurrence relation search code}\label{B}
\end{figure}

Welcome to the forum

EDIT: Corrected some typos.
- Stefan Kottwitz
- Site Admin
- Posts: 10359
- Joined: Mon Mar 10, 2008 9:44 pm
positioning/centring problem
welcome to the board!
don't use figure inside a center environment, the figure environment should be outside. Even better: use \centering inside figure.hikorski wrote:1. the picture is not centred
That's common, figures should be placed where they fit well, not always at the exact point where they are in the source code, perhaps leading to very bad page breaks. Have a look at epslatex.hikorski wrote:2. the picture appears at a different place to that chosen in the source code (in fact, at the top of a page.)
Stefan
Re: positioning/centring problem
All the best,
Max