Graphics, Figures & TablesImages not showing up

Information and discussion about graphics, figures & tables in LaTeX documents.
Epideme90
Posts: 21
Joined: Tue Apr 24, 2012 5:41 pm

Re: Images not showing up

Post by Epideme90 »

I tried my small example and i get the same - i have attempted on 2 separate computers and got the same result both times.

Just re-ran after made no edits to the image bits, and suddenly it works - I'm stumped, but at least it works... I don't know if you call that a solve or not, but the problem is gone, i just don't know why :P

They're not quite where they should be, but LaTeX never seems to listen to me when i say put an image here anyway, so close enough...

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Images not showing up

Post by Stefan Kottwitz »

Nice to see that the problem is gone.
Epideme90 wrote:They're not quite where they should be, but LaTeX never seems to listen to me when i say put an image here anyway, so close enough...
You just did not tell it LaTeX correctly. {figure} is a floating environment, which is very good for automated figure placement in big documents with best typographic results, especially for optimal page breaks and visually good placement. It can be adjusted by options. You just did not use enough options - or don't use {figure}. Have a look at this answer which explains it.

Stefan
LaTeX.org admin
Epideme90
Posts: 21
Joined: Tue Apr 24, 2012 5:41 pm

Re: Images not showing up

Post by Epideme90 »

What options can i use to pin it down - I looked at the answer, but i don't want it at the top of the page or the bottom or a separate page - I just want it where i told it to be in the text. I.e. beneath the patch of text above it, and above the one below it. And the only sensible options ofr that appear to be h and ! - both of which i've used.

What alternatives to the figure environment are there? (bare in mind i require a \listoffigures)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Images not showing up

Post by Stefan Kottwitz »

Epideme90 wrote:i don't want it at the top of the page or the bottom or a separate page ... And the only sensible options ofr that appear to be h and ! - both of which i've used.
So you forbid top and bottom placement, which might be good though. Imagine, the figure is 3 in high, but there's just 2 in left on the page. If you use [ht], the picture can float to the top of the next page, with some of the following text fillung up the current page. With just [h!], that's impossible, meaning the figure has to be on the page where's not enough space. So nevertheless the page must be ended, leaving 2 in free space, the figure goes to the next page, then comes the following text. Worse.

Why do you need captions and figure numbers? Because you refer to the figure, which is not right at the fixed place very close to the reference. Otherwise you would not need reference numbers if all would be immediately in place.

Moving figures manually, pressing them into fixed positions, reminds me of writing with text processors such as word. Cross-references are pretty meaningless then, and if there's a small change at the beginning of the document, dozens manually positioned figures may have to be repositioned since many page breaks may have changed. If LaTeX is allowed to float the figures, it will make optimal page breaks.
Epideme90 wrote:What alternatives to the figure environment are there? (bare in mind i require a \listoffigures)
Just use \includegraphics, perhaps with a {center} environment. I mean, why do you need a caption or a number if you place it in text where you can directly refer to it?

If you need captions and figure numbers without floating, you could use the caption package and the \captionof{figure}{...} command.

Or, for people who are used to the figure syntax but not to the floating, there's the float package and the [H] option.

Stefan
LaTeX.org admin
Epideme90
Posts: 21
Joined: Tue Apr 24, 2012 5:41 pm

Re: Images not showing up

Post by Epideme90 »

Well i mainly need it for my writing style: I often write things like the graph showing the reconstruction of the B+ mass follows:
PICTURE HERE
caption

Next bit of text
- Also, i got marked down last time for pictures floating around, which i had not checked back into place (which was my own dumb fault)

I see your point on what mightl ook best and the advantages - i really do, and if i was writing in latex for pleasure or my own layouts I would probably take heed, but here it seems to be best to just role with the way I've been told to set it out.

Word, whilst not quite as pretty or powerful, was user friendly, so whilst it may have been time consuming to get the images right, i knew what to do.

If i remove the figure environment i lose captions etc. i get marked down.
The last option intrigues me though - what does the [H] option do? remove the floating aspect?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Re: Images not showing up

Post by Stefan Kottwitz »

Well, I imagine texts like this:

... the graph (Fig. 1) showing the reconstruction of the B+ mass follows:
PICTURE HERE
Fig. 1: The reconstruction of the B+ mass

Extremely said, but you know what I mean. Number and caption are fine if the picture is moved to a good position somewhere else. If there's a reference Fig. 1, then it's perfect even if the picture is on the next page. Who marks that down, perhaps doesn't understand the meaning of references. It's more than counting, it's pointing to locations.

That's of course not your fault, if at all then the requirements are responsible.

Yes, [H] allows figures without floating. Of course you are free to do what you want and to fulfill requirements. It's just done a bot differently compared to the basic standard.

Stefa
LaTeX.org admin
Epideme90
Posts: 21
Joined: Tue Apr 24, 2012 5:41 pm

Re: Images not showing up

Post by Epideme90 »

Ah ok - well i'm doing a bit of a re-write, i may try and put the images more as you suggested then. The main problem I'll have with it, is something like this:

SECTION 1.1 B+ MASS PEAK:
blahblahblah, as shown in the B+ mass peak graph below:
[tell the picture to go here]
SECTION 1.2 A NEW NOT THAT RELEVANT SECTION
Otherstuffgoeshereblahblahblah...
end of page...
[picture from section 1.1 appears here]
more writing from section 1.2
SECTION 1.3
etc.

How do i use the float environment? is it the same as figure? ie.
\begin{float}[H]
\centering
\includegraphic[.6\textwidth]{parity2.jpg}
\caption{Parity Transformation}
\label{paritydiag}
\end{float}

Also will this result in a figure number? and an entry on the \listoffigures?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Images not showing up

Post by Stefan Kottwitz »

For totally fixed figures, first load the float package in your preamble

Code: Select all

\usepackage{float}
and in your document write figures as you are used to, just use H instead of h!:

Code: Select all

\begin{figure}[H]
\centering
\includegraphic[.6\textwidth]{parity2.jpg}
\caption{Parity Transformation}
\label{paritydiag}
\end{figure}
If you would like to use floating, but prevent floating across sections, use the placeins package:

Code: Select all

\usepackage[section]{placeins}
It also provides "barriers" for floating figures. Use it like

Code: Select all

\FloatBarrier
\subsection{Your next subsection}
In that case you could keep normal figure options, such as [!htbp].

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Images not showing up

Post by localghost »

For figures (or tables) placed at a fixed position I recommend to use the \captionof command provided by the caption package. In my opinion it makes no sense to put some content into a float environment and then prevent this from floating.


Thorsten
Post Reply