LaTeX Help in LaTeX- Continuing text after embedding a picture

  • Thread starter opus
  • Start date

opus

Gold Member
696
134
Summary
LaTeX embedded pictures
As you can see in my attached picture, I am trying to continue on with my text after my embedded image, but it is putting the text still before the image. I'm not sure why it's doing this because I am writing the text after the \end{figure} command.
Any ideas?
 

Attachments

fresh_42

Mentor
Insights Author
2018 Award
11,594
8,060
This is usually because the picture is too large and it requires space which is only available on the new page. Your picture isn't very detailed so you could probably scale it down to, say half the size. Maybe you also have a big white border which you first can cut.
 

opus

Gold Member
696
134
Thanks fresh. I changed the image to even a very small size and it's still doing it for some reason.
I found this resource
and have tried the commands that it has given, such as setting the image at the top of the following page etc, but it's not really doing anything. Odd....

Edit: Also trimmed the image to get rid of all excessive border whitespace.
 

opus

Gold Member
696
134
For example, using the [t!] command isn't even putting the image at the top of the page as it should. And when the image size is changed, it just changes the image and has no effect on the placement.
 

Attachments

opus

Gold Member
696
134
Also tried to get rid of the center command as maybe it put the image directly in the center of the page, not just between left and right, but this didnt help either. Just shifted it to the left.
 

opus

Gold Member
696
134
Got it. Had to use the \newpage command before embedding the image.
Thanks!
 

Orodruin

Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
2018 Award
15,951
5,920
Got it. Had to use the \newpage command before embedding the image.
Thanks!
This is a really bad solution as it will mess up your typesetting completely if you decide to write more text in front. The \newpage command should never be used unless you really mean to start a new page. It should certainly not be used for image placement.

You also should not be using the figure environment if you want to put a figure in the actual text for some reason. The figure environment should be used when you want a figure in your document that has a caption and is referred to in the main text through a \ref command. In other words you would write something like
Code:
bla bla bla, see Figure~\ref{fig:1}.
\begin{figure}
...
\caption{}\label{fig:1}
\end{figure}
bleh bleh bleh.
This will produce something like "bla bla bla, see Figure 1. bleh bleh bleh." with the figure being placed conveniently close by default (not on an earlier page than where you put the figure in the code, but on the same page or as soon as possible). This is the reason for writing the figure commands close to the reference.

In your case, you are not showing your entire document so we can only guess at what is going on. However, it is clear that you are making the figure on page 1, which likely has some sort of title. LaTeX is not going to put the figure on the same page as that title because where it would be put is occupied by the title. Placing the figure there would also mean moving the place where it occurs in the source to the next page, which is also not going to happen. Hence, LaTeX places your figure on the next page, regardless of whether it has text or not. When the figure is alone on a page, it is typically centered on that page, which seems to be what is going on in your case.

Note again that the figure environment produces a float (as does the table environment). These are objects that LaTeX is allowed to move around when typesetting and should be referred to in the text (they are not part of the main text!). If you want to place some image in the main text, you can just include it there, preferably in a centered environment or similar.

TLDR; You are not using the figure environment in the way it is intended. It produces a float that is allowed to move around when typesetting your document, not an object that should be placed in the main text.
 

opus

Gold Member
696
134
Oh awesome that is extremely helpful thank you @Orodruin. I was actually a little bit hesitant in adding the picture as I was thinking it was going to turn into a Microsoft Word nightmare where one small change turns the entire document into a mess. You've saved me a great head ache, thank you.
 

Want to reply to this thread?

"Help in LaTeX- Continuing text after embedding a picture" You must log in or register to reply here.

Related Threads for: Help in LaTeX- Continuing text after embedding a picture

  • Posted
Replies
1
Views
616
  • Posted
Replies
1
Views
2K
Replies
5
Views
33K
Replies
2
Views
2K
  • Posted
Replies
2
Views
6K
Replies
2
Views
3K
Replies
2
Views
40K
Replies
11
Views
13K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top