Skip to Main Content

Overleaf - LaTeX: Mathematics in LaTeX

Basic instruction

To include mathematical symbols in your LaTeX document, use the amsmath package.

\usepackage{amsmath}

You must enclose all mathematical content within "$" signs; i.e., all mathematical content must appear in the math environment in LaTeX. The contents written in the math environment will appear in green.

$ 2 + 3 = 5 $

To produce text in superscript, use a caret followed by the text you want in superscript in curly brackets.

 $ 5^{2} = 25 $

To write text as a subscript, use an underscore followed by the text in curly brackets.

$ X_{2} $

The symbol "&" on its own is used as part of a code in LaTeX. To enter and use this symbol as a character, simply use the \& command. Commands written in the math environment appear in red.

 $ X_{1} \& X_{2} $

Spaces in math mode can be added using these commands: \; for thick space, \: for medium space, \, for thin space, and \! for negative thin space.

Greek letters in LaTeX must also be entered in the math environment. You can add a Greek letter to your document by using the command that corresponds with the Greek letter you wish to enter. Commands for Greek letters in LaTeX are the same as the name of the letter, e.g., $\alpha$, $\beta$, $\gamma$. To capitalize the Greek letter, enter the first letter of the name in uppercase, e.g., $\Gamma$.

Refer to the page on using math mode in LaTeX for further information.