...get LaTeX to put the picture/table where I want?

Just about every $latex \LaTeX$ user who has inserted a picture into their document has complained, at some point, about how the picture has ended up somewhere where it isn't wanted. If you have some idea where the picture should be placed, you can direct $latex \LaTeX$ what to do as follows

\begin{figure}[h]
\begin{center}
\includegraphics[width=1.5in]{K5me.jpeg} %controls the size of the figure
\end{center}
\end{figure}

After \begin{figure} you have several options:

  • h to put the figure here
  • t to put the figure at the top of the page
  • b to put the figure at the bottom
  • p to put the figure on a special page with other figures

By typing [h] we've instructed that the picture be put at that spot; but sometimes $\LaTex$ has found what it considers a better choice and the figure is put where you don't want it. In that case try \begin{figure}[!h], the ! tells $\LaTeX$ you really want it there.

But sometimes that isn't enough as $\LaTeX$ ignores all your pleas. Once again, there different ways to get around the problem; here we'll try the float package. All you have to do include the float package in the preamble and use [H] to force the placement of the picture. Here's some sample code:

 

\documentclass[11pt]{article}
\usepackage{float}
\usepackage{graphicx}
\begin{document}
When you want to insert a picture, you insert code that looks something like this
\begin{figure}[H]%put the figure HERE
\begin{center}
\includegraphics[width=1.5in]{K5me.jpeg} %controls the size of the figure
\end{center}
\end{figure}
\end{document}

The code won't run without a picture K5me.jpeg to insert. It's just for illustrative purposes. You can see it running below:

Float

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code