Skip to Main Content

LaTeX document preparation system

A Short Guide to Math and Equations

LaTeX provides powerful tools for creating mathematical content, from simple expressions to complex equations. There are different ways of working with math in LaTeX:

  • Inline Math: To include mathematical expressions within a line of text, use the dollar signs $...$
  • Display MathFor equations that need to be displayed on their own line, use double dollar signs $$...$$ or the \[...\] notation

Below, I show how inline math and display math looks like in Overleaf. Math code has light green color to easily differentiate it from the normal text.

Screenshot for inline and display math

  • Equation Environment: For numbered equations, use the equation environment.
  • Aligning Equations: For multiple equations or aligning equations, use the align environment from the amsmath package.
  • Fractions, Exponents, and Subscripts:
    • Fractions: \frac{numerator}{denominator}
    • Exponents: a^b 
    • Subscripts: a_b

Below, I present a screenshot of equation environment:

Screenshot of equation environment

When we compile, here is how this code looks like (notice that LaTeX automatically assigns numbers to our equations within equation environment):

Equation outcome after compile

 

Greek Letters and Symbols

LaTeX supports many Greek letters and mathematical symbols. For example:

  • Greek letters: \alpha, \beta, \gamma, \Delta, \Omega
  • Other symbols: \sum, \int, \prod, \sqrt, \leq, \geq

Greek letters and symbols have purple color in Overleaf interface:

Screenshot for Greek letters in Overleaf

Which creates the following output:

Output for Greek letters in Overleaf

 

Additional Tips

  • Spacing: Use \, for a small space, \: for a medium space, and \; for a large space in your equations.
  • Text in Math Mode: To include text within an equation, use the \text{} command from the amsmath package.
  • Common Functions: LaTeX automatically formats common functions such as \sin, \cos, \log, etc.

For example, in the following screenshot, I used spacing function:

Screenshot for additional tips showing spacing

This code produces the following:

Screenshot for additional tips output