Showing first {{hits.length}} results of {{hits_total}} for {{searchQueryText}}{{hits.length}} results for {{searchQueryText}}

No Search Results

This error appears when you have included a package or class in the main body of your document, instead of in the preamble. The preamble to the document consists of everything written before \begin{document}. In the preamble you define the type of document you are writing, the language and several other elements. For instance, a normal document preamble would look like this:

\documentclass[12pt, letterpaper]{article}
\title{First document}
\author{Hubert Farnsworth \thanks{funded by the ShareLaTeX team}}
\date{February 2014}

If you write \usepackage{...} in the main body of the document (after \begin{document}) instead of in the preamble, you will generate the error message shown below.

main.tex, line 7

LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.4 \usepackage {amsmath} Your command was ignored. Type I <command> <return> to replace it with another command, or <return> to continue without it. [1

To fix this error, make sure that all \usepackage{...} commands, as well as \documentclass[...]{...}, are written before \begin{document}. To learn more about how to structure a document in LaTeX, check out our documentation.

[edit] Overleaf guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

[edit] Advanced TeX/LaTeX