Graphics, Figures & Tables\begin{figure} removing graphic

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
stuball3d
Posts: 2
Joined: Mon Sep 21, 2009 5:10 am

\begin{figure} removing graphic

Post by stuball3d »

I am trying to insert a figure, and am using the following code:

Code: Select all

\begin{figure}
\begin{center}
\includegraphics{vijaygel}
\caption{Picture caption.\label{fig:gel1}}
\end{center}
\end{figure}
And no picture/caption/anything is being inserted. However, if I comment out the \begin{figure} and \end{figure}, then a figure is added (lacking good caption formatting and referencing).

I've tried building to pdf and dvi. And since outside of a figure framework the picture shows up, I'm guessing the target location is good. I'm using emacs w/ auctex, in case that is helpful. No errors are displayed when building (only 2 dealing with /hline in the document, none relevant to the figure).

I'm only a novice TeXer, but by everything I've read, this should do the trick. Any assistance would be appreciated.

Thanks

Steven

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

\begin{figure} removing graphic

Post by gmedina »

Hi,

your code should work. Perhaps, since you are not using any placement options, the figure is floating somewhere else in your document (maybe to the following page or even to the last page)?

What do you get if you use, for example, the following code?

Code: Select all

\begin{figure}[!ht]
  \begin{center}
  \includegraphics{vijaygel}
  \caption{Picture caption.\label{fig:gel1}}
  \end{center}
\end{figure}
If the problem presists, can you please post here a complete compilable code showing the document class that you are using and all the relevant packages involved? (this code should reproduce the problem that you mentioned).

Please also attach, if possible, the problematic image.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
stuball3d
Posts: 2
Joined: Mon Sep 21, 2009 5:10 am

Re: \begin{figure} removing graphic

Post by stuball3d »

Ahhh, I figured it out...

It was a multi-column environment giving it trouble.

I'm doing a 3-4 page scientific report. Standard {report} class. I wanted a standard abstract over a normal page width, but the remaining parts separated into two columns.

Apparently the multicols was messing it up. In order to correct it, I ended the multicols before the graphic, and restarted it afterwards. The graphic is showing up at the top of the next page.

Thank you for your quick reply gmed, and for the location pointers.

If anyone happens to have more information regarding inserting a graphic within the two column environment, please feel free to reply. If not, I am content with this solution and will play around with it more later - after the assignment's turned in!

Steven
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

\begin{figure} removing graphic

Post by gmedina »

If you are using the multicol package, the behaviour that you observed is explained in the package documentation (Section 2.4 "Floats inside a multicols environment" and Section 2.5 "Warnings" on page 4).

As the documentation mentions you can use the figure* environment inside a multicols environment, but the figure won't appear where you declared it in your code.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

\begin{figure} removing graphic

Post by Stefan Kottwitz »

Hi Steven,

I would not use te \begin{center}...\end{center} inside a figure environment, that's causing additional vertical space, see center vs. \centering. Instead of
stuball3d wrote:

Code: Select all

\begin{figure}
\begin{center}
\includegraphics{vijaygel}
\caption{Picture caption.\label{fig:gel1}}
\end{center}
\end{figure}
I'm preferring \centering:

Code: Select all

\begin{figure}
\centering
\includegraphics{vijaygel}
\caption{Picture caption.}\label{fig:gel1}
\end{figure}
Stefan
LaTeX.org admin
Post Reply