Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 17
Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu2204
Kernel: Python 2

A Brief Introduction to Typesetting Mathematics with LaTeX

Typesetting simple mathematical expressions in LaTeX is straightforward. This very brief introduction should be enough to get you started, but it is not intended to be complete. The typesetting commands usually need to be placed between dollar signs or pairs of them.

The lower case and upper case Greek letters have fairly obvious names (for example, \delta” is δ\delta and “\Delta” is Δ\Delta). You can look up other common symbols (such as \infty” is \infty and "\pm" is ±\pm) at the website given at the end of this tutorial. Subscripts and superscripts are made with “_” (underscore) and “^” as shown below.

    \alpha_i = \beta^2
αi=β2\alpha_i = \beta^2

If you want multiple characters to appear in a subscript or superscript (like "ij"), they can be grouped in curly brackets. Notice that a symbol can have both a subscript and a superscript. The subscript of B is plain text because it is preceded by “\rm”, which changes the font to Roman (unitalicized).

    A_{ij}^3 < B_{\rm max}
Aij3<BmaxA_{ij}^3 < B_{\rm max}

Common functions such as “sin” have shortcuts (“\sin” in this case) that typeset them in a Roman font. The result of the second command below is better than that of the first, because the function is in a different font than the variable and the spacing is better.

    sin\theta
sinθsin\theta
    \sin\theta
sinθ\sin\theta

The following example shows how to make a fraction.

    C=\frac{3}{4}
C=34C = \frac{3}{4}

Preceding brackets with “\left” and “\right” automatically makes them the right size for what’s inside. The result of the second command below is better than that of the first.

    (\frac{5}{3})
(53)(\frac{5}{3})
    \left( \frac{5}{3} \right)
(53)\left(\frac{5}{3}\right)

Another frequently used command is “\sqrt” for a square root symbol.

    \sqrt{xy} = 3
xy=3\sqrt{xy} = 3

Additional Documentation

You can find more information about typesetting mathematics in LaTeX at https://matplotlib.org/stable/tutorials/text/mathtext.html and http://en.wikibooks.org/wiki/LaTeX/Mathematics. For example, these pages show how to make integrals and matrices.