There are several online guides to help new users learn LaTeX. A good place to start is The Not So Short Introduction to LaTeX 2e, and a good online searchable reference is the LaTeX Wikibook.
Below, however, we have compiled some very basic commands for those students looking only to use LaTeX to beautify type on their python plots. In this case, we need only know some of the math symbols and syntax, and not the larger syntax related to full document typesetting.
In LaTeX, we move from the normal text environment to the math environment by enclosing the relevant section by dollar signs ($). For example,
Code | Output |
If we integrate over \$x\$, we find the equation \$y = 3a + b\$ | If we integrate over $x$, we find the equation $y = 3a + b$ |
In the math environment, spacing is set automatically (e.g. between adjacent variables or between elements and operators) and Roman letters are treated as variables which are italicized. In the math environment, we can also use special symbols or constructions. For example,
Code | Output |
We find \$\int \frac{dx}{$1+x^2} = \tan^{-1}x\$ | We find $\int \frac{dx}{1+x^2} = \tan^{-1}x$ |
Here, we use the following:
\int
is the integration “S”, automatically sized to the correct height;\frac{a}{b}
builds a fraction with a
as the numerator and b
as denominator; x^2
produces the variable x
with a superscript 2
; and\tan
writes the tangent function (non-italicized, to distinguish it from the product of variables t, a and n).Note also that when making subscripts or superscripts, LaTeX will assume that only one character is being raised or lowered unless the whole argument is surrounded by curly brackets.