Spring til indhold

This error appears when you have forgotten to load the float package. Float specifiers are written in the square brackets whenever we use a float such as a figure or a table, i.e. the H in \begin{figure}[H]. The H float specifier comes as part of the float package. It tells the compiler to place the figure at that exact location in the page, instead of moving it to somewhere else. Whenever we want to use this option, we must include \usepackage{float} in our preamble. To read more about how to use options to specify float positions, check out our documentation.

Common Causes

Forgetting to load the float package:

The float package provides us with the H option. This is a stronger version of h, and tells LaTeX that we would like the figure to appear exactly here. If we use the H option, but forget to include \usepackage{float} in our preamble, we will get an error like the one shown below


main.tex, line 12

LaTeX Error: Unknown float option `H'.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.10 \begin{figure}[H] Option `H' ignored and `p' used.

To resolve this error, we simply need to include \usepackage{float} in our preamble to our document i.e. before \begin{document}

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX