0

When the figure is inserted in LaTeX, we will use float environment by \begin{figure}, in which the specifiers could be h, b, t and ! or their combinations. As explained in How to influence the position of float environments like figure and table in LaTeX?,

Whenever LaTeX encounters a float environment in the source, it will first look at the holding queue to check if there is already a float of the same class in the queue. If that happens to be the case, no placement is allowed and the float immediately goes into the holding queue.

If not, LaTeX looks at the float placement specifier for this float, either the explicit one in the optional argument or the default one from the float class. The default per float class is set in the document class file (e.g., article.cls) and very often resolves to tbp, but this is not guaranteed.

If the specifier contains a !, the algorithm will ignore any restrictions related either to the number of floats that can be put into an area or the max size an area can occupy. Otherwise the restrictions defined by the parameters apply. As a next step it will check if h has been specified. If so, it will try to place the float right where it was encountered. If this works, i.e., if there is enough space, then it will be placed and processing of that floats ends. If not, it will look next for t and if that has been specified it will try to place the float in the top area. If there is no restriction that prevents it then the float is placed and processing stops. If not it will finally check if b is present and, if so, it will try to place the float into the bottom area (again obeying any restrictions that apply if ! wasn't given). If that doesn't work either or is not permitted because the specifier wasn't given the float is added to the holding queue. A p specifier (if present) is not used during the above process. It will only be looked at when the holding queue is being emptied at the next page boundary. This ends the processing when encountering a float in the document.

I don't think so. Let us do an example.

\documentclass{article}
\usepackage{lipsum,graphicx}
\begin{document}
\lipsum[1]
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Test}
\end{figure}
\lipsum[2-15]
\end{document}

This will output a file, where the figure is on the top. The figure is on the top.

However, if change \begin{figure} to \begin{figure}[hbt] or \begin{figure}[bth], the figure will be on the middle of the page as the specifier of h works.

\documentclass{article}
\usepackage{lipsum,graphicx}
\begin{document}
\lipsum[1]
\begin{figure}[bth]
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Test}
\end{figure}
\lipsum[2-15]
\end{document}

The figure is on the middle of the page.

So there is difference between \begin{figure}[hbt] and \begin{figure}, and it is different from the explaination of How to influence the position of float environments like figure and table in LaTeX? . Why and what is the default rule for \begin{figure} in LaTeX?

Thanks.

Y. zeng
  • 1,885

0 Answers0