Inserting Image in LaTeX: Troubleshooting Help Needed

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 3K views
Juggler123
Messages
80
Reaction score
0
I know this isn't really general math but here goes,

I need to insert an image into my text on latex, when I put this;

\begin{figure}
\begin{center}
\includegraphics[scale=0.7]{CantBeamPointLoad}
\end{center}
\caption{A cantilever beam with a point load P at the end of the beam}
\end{figure}

into my text the image goes to the top of the page! I have know idea why this is happening though, any help would be brilliant.

Thankyou.
 
Physics news on Phys.org
Sorry but I don't understand your post. I'm not very clued up when it comes to latex (as you may have realized!). How do I change my text so the image is in the part of the text I want it to be?
 
Figures, and tables, are designed to "float" in latex to a final position according to a hard-coded algorithm. you have a couple options.

1) try specifying a position for your figure:
\begin{figure}{h}

for example "asks" latex to put the float 'h'ere - where you want it. sometimes it works, sometimes the algorithm will still move it, depending on other material on the page.

2) There is a Float package that can be loaded in your preamble:
\usepackage{float}

this provides a new placement command to the figure and table environments. using
\begin{figure}[H]

will (almost always, I've had it not work on rare occasions) put your figure exactly where you want it.
Check these links for more discussion: (the first has general discussions but if you scroll down you'll find some comments about figures and tables)
http://www.math.uiuc.edu/~hildebr/tex/basics.html

The next one discusses the float package.
http://sahand.kntu.ac.ir/~hadizadeh/pdf/latex/lesson_14[1].pdf

Final comment: you haven't indicated that you'll need this, but here's one thing that is quite important: if you want both a caption, and a label, for figures or tables, you must give the label AFTER the caption, else numbering will be off.

\begin{figure}[H]
\centering
\includegraphics{really cool graphic}
\caption{Mind numbingly awesome caption}
\label{fig:aname}
\end{figure}

Good luck.
 
Last edited by a moderator: