No positions in optional float specifier
This is a standard LaTeX error which appears when you do not include a float specifier in the options of a float i.e. the ht
in \begin{figure}[ht]
. The float specifier parameter is an option which allows us to have a greater control over where a figure is placed. The different placement options available to us are listed below:
Specifier | Permission |
---|---|
h | Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot) |
t | Position at the top of the page. |
b | Position at the bottom of the page. |
p | Put on a special page for floats only. |
! | Override internal parameters LaTeX uses for determining "good" float positions. |
H | Places the float at precisely the location in the LaTeX code. Requires the float package (\usepackage{float}). This is somewhat equivalent to h!. |
These float specifiers can be placed inside the square brackets when we create a float, such as \begin{figure}[h]
. They can even be placed in combinations such as \begin{figure}[!htb]
, which tells LaTeX to place the figure here, or top, or bottom. If you leave the square brackets blank by writing something like \begin{table}[]
, an error message will appear such as the one shown below.
main.tex
How to resolve the error
Removing the square brackets:
The simplest way to get rid of this error is to remove the square brackets when we are not using a float specifier i.e. instead of writing \begin{figure}[]
, you could simply write \begin{figure}
.
Inserting a float specifier:
Another way to resolve this error is by inserting a float specifier telling LaTeX where you would like your float to appear. This should be included in the square brackets, such as \begin{figure}[h]
or \begin{table}[!htb]
.