Math Equations in Latex

Learn how to write math equations in LaTeX with Overleaf

Mathematics and science students and professionals often need to write complex equations in their research papers, reports, and other documents.  n this article, we will provide a step-by-step guide on how to write math equations in LaTeX using Overleaf. We will cover various modes for writing equations, including inline and display mode, as well as how to label and reference equations. We will also cover how to use Greek letters, math operators, and symbols to write complex equations. By the end of this article, you will have a good understanding of how to write math equations in LaTeX with Overleaf and be able to produce professional-looking documents with ease. 

Watch the Video Tutorial

Enjoy a step-by-step explanation. If you find the content helpful, please don't forget to hit the like button, share it with your friends, and leave a comment below. For more exciting content, make sure to subscribe to my channel and turn on notifications to stay updated whenever I post new videos. Thank you for watching! 

Step 1: Include the "ams math" package

The first step is to include the "ams math" package in your LaTeX document. This package enables you to use more complex equations and symbols, as well as provides better alignment. To include the package, add the following line of code to the preamble of your LaTeX document:

\usepackage{amsmath}

Step 2: Inline mode

The inline mode is used for formulas that are part of the running text. To start the inline mode, type a dollar sign ($) at the beginning and end of the equation. For example, if you want to write "2+2=4" in your text, type:

$2+2=4$

After you have finished typing your equation, recompile your document, and you will see the equation displayed within the text.

Step 3: Display mode

The display mode is used for equations that are not part of the running text and are written in a separate line. It is typically used for numbering equations and for referencing them. To start the display mode, type \begin{equation} at the beginning of the equation and \end{equation} at the end. For example, to write the equation y=mx+b, type:

\begin{equation}

y=mx+b

\end{equation}

Alternatively, you can use double dollar signs ($$) to start and end the equation. For example:

$$y=mx+b$$

Or you can use the square brackets to start and end the equation. For example:

[y=mx+b]

Regardless of the method you choose, the display mode will number the equation, allowing you to reference it later.

Step 4: Label and reference equations

To label an equation, go to the equation environment, and beside \begin{equation}, type \label{label_name}, where label_name is the name you want to give the label. For example, to label the equation y=mx+b as "eq:linear", type:

\begin{equation}

y=mx+b \label{eq:linear}

\end{equation}

To reference the equation later in the text, type \ref{label_name}, where label_name is the name of the label you assigned to the equation. For example, if you want to reference equation (1) as "the linear equation," type:

the linear equation \ref{eq:linear}

Step 5: Greek letters, math operators, and symbols

In LaTeX, you can use Greek letters, math operators, and symbols to write complex equations. To write a Greek letter, type a backslash () followed by the name of the letter. For example, to write the Greek letter gamma (γ), type \gamma. Here are some examples of math operators and symbols you can use in LaTeX:

Fractions:

To write a fraction, use the \frac command, followed by the numerator and denominator in curly brackets. For example, to write 1/2 as a fraction, type \frac{1}{2}.

Subscripts and superscripts:

To write subscripts, use the underscore (_) symbol. For example, to write a subscript "x" for the variable "a," type a_x. If you want to write more than one character in the subscript, put them in curly brackets,

You can access a complete list with symbols, greek letters, and math operators by clicking here.