Graphics, Figures & Tables ⇒ Insert Figure Between Text
Insert Figure Between Text
I'm trying to embed a figure (a table in this case) in between text and I'm having quite a problem with this. What ends up happening is that part of the text will run together above the picture while some will then go below it, not at the break where I actually put the image. I have these commands in the preamble
\documentclass{article}
\usepackage{epsfig}
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{2}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.7}
Then, I have
Text, text, and more text
\centering
\begin{tabular}{ | l | l | l | p{5cm} |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning.
Conditions will improve by early afternoon and continue
throughout the evening. \\
\hline
\end{tabular}
\caption{Weather Table}
\end{figure
Text, text, and still more text
I just took the table from some website so I could test all this out.
\documentclass{article}
\usepackage{epsfig}
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{2}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.7}
Then, I have
Text, text, and more text
\centering
\begin{tabular}{ | l | l | l | p{5cm} |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning.
Conditions will improve by early afternoon and continue
throughout the evening. \\
\hline
\end{tabular}
\caption{Weather Table}
\end{figure
Text, text, and still more text
I just took the table from some website so I could test all this out.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Insert Figure Between Text
You should have posted a minimal working example (MWE) to clarify the problem. Keep that in mind for the next time. I'm not sure if I understand you right, but if you want a paragraph not be interrupted by a figure, separate this figure by blank lines from the text.
Use only code from which you really know what it does (see remarks in the code).
Best regards and welcome to the board
Thorsten¹
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage{blindtext}
%%% Do you know what this lines do? %%%
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{2}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.7}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\blindtext
\begin{table}[!ht]
\centering
\caption{Weather Table}\label{tab:weather}
\begin{tabular}{lllp{5cm}}\toprule
Day & Min Temp & Max Temp & Summary \\ \midrule[0.8pt]
Monday & 11\textcelsius & 22\textcelsius & A clear day with lots of sunshine. \\
\multicolumn{4}{l}{However, the strong breeze will bring down the temperatures.} \\ \midrule
Tuesday & 9\textcelsius & 19\textcelsius & Cloudy with rain, across many northern regions. Clear spells across most of Scotland and Northern Ireland, but rain reaching the far northwest. \\ \midrule
Wednesday & 10\textcelsius & 21\textcelsius & Rain will still linger for the morning. Conditions will improve by early afternoon and continue throughout the evening. \\ \bottomrule
\end{tabular}
\end{table}
\blindtext
\end{document}
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Insert Figure Between Text
I'm sorry about my first post; reading it again I can see now that it was not clear.
What I'm trying to do is to make my text flow with my figures. I want to have text, followed by a figure, then more text. The problem is that the text is not breaking for the figure in the correct spot; my figure is not going where I tell it to go.
My first problem was trying to keep LaTeX from putting my tables at the end of the paper. Now I can't get the figure to go in the right spot in between the text. I want say something like "as shown in Figure 2 below," then have the figure, and then continue with the rest of my text.
I'm new to LaTeX and I'm not sure entirely what those commands do. I got them from this website here.
http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html
What I'm trying to do is to make my text flow with my figures. I want to have text, followed by a figure, then more text. The problem is that the text is not breaking for the figure in the correct spot; my figure is not going where I tell it to go.
My first problem was trying to keep LaTeX from putting my tables at the end of the paper. Now I can't get the figure to go in the right spot in between the text. I want say something like "as shown in Figure 2 below," then have the figure, and then continue with the rest of my text.
I'm new to LaTeX and I'm not sure entirely what those commands do. I got them from this website here.
http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Insert Figure Between Text
For the present I suggest to omit the lines I marked in the code and use some optional parameters for the float environments as I demonstrated in the code above. Refer to some introductions to LaTeX [1]. In this topic you will find some useful guides and manuals.
[1] View topic: LaTeX Resources for Beginners
[1] View topic: LaTeX Resources for Beginners
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Insert Figure Between Text
You can force latex to put the figure at a precise position with the placement specifier "H" (you need to include the "float" package)
\usepackage{float}
\begin{figure}{H}
...
\end{figure}
More detailes on:
http://en.wikibooks.org/wiki/LaTeX/Floa ... d_Captions
Regards,
Olf
\usepackage{float}
\begin{figure}{H}
...
\end{figure}
More detailes on:
http://en.wikibooks.org/wiki/LaTeX/Floa ... d_Captions
Regards,
Olf
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Insert Figure Between Text
Using the float package with this parameter should be the very last alternative. If a picture should strictly appear where it is declared in the source, it is recommendable to use the \captionof command instead of the usual \caption provided by the caption (or the capt-of) package.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Insert Figure Between Text
What I generally find very useful for placing floats right where we want them to be is an old package (1991) by David Carlisle. The package is called here.sty and it avoids tempering with
the default floating commands of LaTeX. You can find it http://www.ipipan.waw.pl/MGV/here.sty.
Best,
the default floating commands of LaTeX. You can find it http://www.ipipan.waw.pl/MGV/here.sty.
Best,
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Insert Figure Between Text
Of course an entry for the here package also can be found on CTAN. But as the caption already says it is considered obsolete. Modern versions of placing a figure absolutely have already been mentioned in this topic.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Insert Figure Between Text
Oops...didn't know. Thanks.