General ⇒ Struggling with Table and Figure floats
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am
Struggling with Table and Figure floats
The tables and figures need to appear in very specific parts of the document since a paragraph will refer to a table or figure immediately following. Also, some of the figures have their own subsection titles that they need to appear beneath. This hasn't worked out too well, thus far.
I took a look at the following thread to see if I could get some clues:
http://www.latex-community.org/viewtopic.php?f=5&t=1243
I positioned all of the figures using [!ht]. This put the figures pretty close to where they need to be (but not exactly) *BUT* pushed all of the tables to the bottom of the document. I tried to fix this by positioning the tables using [!h] but that had absolutely no impact.
I believe there's a way to position at least graphics without using a float environment, but my newness to LaTeX is showing and Googling either doesn't yield the specific troubleshooting information or it only provides the standard "this is how you position a table/graphic using a float" without addressing what happens when problems occur.
Needless to say, I'd appreciate any input you may have. Thanks.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Struggling with Table and Figure floats
Yes, there is. Don't use the figure environment. Captions are still possible using \captionof and the caption package (or capt-of), even included in the list of figures. Example:tripwire45 wrote:I believe there's a way to position at least graphics without using a float environment
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\listoffigures
\begingroup
\centering
\includegraphics{picture}
\captionof{figure}{test picture}
\endgroup
\end{document}
Re: Struggling with Table and Figure floats
You can also give a try at the insbox (plain tex) package.
B.A.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Struggling with Table and Figure floats
You won't get a complete reproduction, unless you do exactly the same page layout, font size and so on.tripwire45 wrote:I've been trying to take a document originally created in Word 2007 and convert it into LaTex...basically from scratch. I've done pretty well so far, given the fact that I have been using LaTex (using Kile) for maybe a week tops. I've come up against some of the last, big challenges. Right now, it's floats. [...]
Of course you should use the [!ht] combination also for table environments. From my experience this yields the best results in placing floats.tripwire45 wrote:[...] I positioned all of the figures using [!ht]. This put the figures pretty close to where they need to be (but not exactly) *BUT* pushed all of the tables to the bottom of the document. I tried to fix this by positioning the tables using [!h] but that had absolutely no impact. [...]
The purpose of floats is to place figures or tables without disturbing the text flow and providing references. If you are describing a figure/table directly in the text, you won't need a reference hence no float environment. Take this as an example.
Code: Select all
... as shown in the following figure.
\begin{center}
\begin{picture}
...
\end{picture}
\end{center}
The quick brown fox jumps over the lazy dog. ...
Code: Select all
... as shown in Figure~\ref{fig:figure}.
\begin{figure}[!ht]
\centering
\begin{picture}
...
\end{picture}
\caption{Figure caption}\label{fig:figure}
\end{figure}
The quick brown fox jumps over the lazy dog. ...
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am