Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get LaTeX to place figures and tables in the order they are referenced in the text?

Tags:

latex

I think this question is novel. Here is the problem I have. I have a relatively short piece of text associated with a lot of figures and a table. I want floats to appear on pages just for floats but in the order I specify. I have set all of the table and figure parameters to [hp] and placed them in the order I want them to appear in the source e.g.

Figure 1

Figure 2

Figure 3

Table 1

Figure 4

Figure 5

The problem I have is that no matter what I do the document typesets like this

Table 1

Figure 1

Figure 2

etc....

I have tried trashing the Aux files before typesetting. I am aware of the endfloats package but I still want latex to place the floats in between larger sections of txts in other parts of the document. Any help is greatly appreciated.

Thanks

like image 754
user476160 Avatar asked Oct 14 '10 18:10

user476160


People also ask

What is TBP in LaTeX?

t means top: Place it at the top of a page. b means bottom: Place it at the bottom of a page. p means page: Place it on a page containing only floats, such as figures and tables.

How do you reference a table or figure in LaTeX?

It is a Latex convention to start table references by “tab:”, which no only lets you use the same name for a figure (starting with fig:) and a table, but makes it easier to distinguish between figures and tables. Use the command \ref{tab:} to reference a table in the text.


1 Answers

I'll try to explain why the fix by @user476160 (placement modifier hp instead of just p) works. A figure is a float, i.e. an element that cannot be broken across a page. The figure environment accepts a parameter list with placement hints:

\begin{figure}[placement parameters]
% ...
\end{figure}

The placement specifier h stands for here and places the figure approximately at the same point as in the source text. The placement specifier p puts the figure in a special page that contains only floats:

\begin{figure}[hp]
% ...
\end{figure}

Wikibooks has an excellent article on figure placement if you want to fine-tune your figure and table placement.

I also recommend posting LaTeX-related questions in the TeX Stack Exchange Q&A.

like image 97
Jaime Soto Avatar answered Oct 01 '22 16:10

Jaime Soto