|
|
|
For a Physics student thesis, including nice-looking equations in an easy, straightforward and powerful way is a must. LaTeX became popular mainly because of its great ability to implement math equations, whatever the level of their complexity, in a professional and extremely powerful way. We will cover some of the basic features to get you started with math in LaTeX.
|
The math environment
|
Equations can be deployed in the document in three ways:
- In-line: equations appear in normal sentences. Font sizes match text size and no numbering of equations appears.
- Plain equations: they show in separate lines. No numbering.
- Regular equations: full features, such as numbering, caption, alignment etc.
Here are some examples:
This sentence contains Einstein's equation $E=mc^2$
This equation shows up in a separate line with no numbering
$$E=mc^2$$
This is a full equation
\begin{equation}
E=mc^2
\end{equation}
Multiple equations can be included in an equation array. This is particularly useful when several steps in algebra are described. Individual equations have their own numbering.
This is a full series of equations aligned at the "=" sign:
\begin{eqnarray}
E &=& mc^2\\
m &=& \frac{E}{c^2}\\
c^2 &=& \frac{E}{m}
\end{eqnarray}
See all examples in these files: [TeX][PDF]
|
Superscripts and subscripts
|
In math environment, superscripts are declared by the special character ^. All superscript text is included in {}. Similarly, subscripts are declared by the special character _ and {}. The following examples are self-explanatory
This is a nuclear equation using superscripts:
$$
^{78}Kr + ^4He \rightarrow ^{81}Br + p
$$
This is an equation using subscripts:
$$
x_1 + x_2 + x_3 = 1
$$
And this is an equation using both superscripts and subscripts:
$$
x_1^2 + y_1^2 + z_1^2 = 1
$$
Note that if there is ONLY ONE character to appear as super- or sub-script, the {} are not necessary. Experience says this point is a common source of errors. See the previous example in this file [TeX][PDF].
|
Fractions
|
Fractions are provided by the following command:
\frac{numerator}{denominator} e.g.
\frac{x^2+y^2}{1+z^2}
|
Functions
|
Functions such as the cosine or the logarithm are provided by the following commands:
\cos \theta
\log \frac{x_2}{z}
See some examples here [TeX][PDF].
In these examples, pay attention to \left[, \left(, \right], \right). They are used to adjust the size of parentheses and square braces in math environments, which is necessary when complicated exressions are involved. Have you noticed the \theta command? This produces the greek letter θ, which is used as a variable name in the above example. See the next paragraph for more information on greek variables in a math environment.
Other operators can be the sum, Σ, and the product, Π. Their symbols have explicit commands instead of using the corresponding greek letters. In case indices are required, LaTeX has the solution.
\sum -- plain sum symbol
\sum_j -- sum symbol with lower index j
\sum_{j=1}^{N} -- sum symbol from j=1 to N
\prod -- plain product symbol
\prod_j -- product symbol with lower index j
\prod_{j=1}^{N}x_j -- product of variables xj from j=1 to N
See also common operators:
\infty -- the symbol of infinity
\int -- indefinite integral
\oint -- loop integral
\int_{-\pi/2} -- integral with lower boundary only, -π/2
\int_{-\pi/2}^{+\pi/2} -- integral with both boundaries, -π/2 to +π/2
\iint -- double integral, requires \usepackage{amsmath}
\iiint -- triple integral, requires \usepackage{amsmath}
\sqrt{x} -- square root of x
\sqrt[n]{x} -- n-power root of x
\partial -- partial derivative symbol
\nabla -- partial derivative in 3D
\langle & \rangle -- < and >, for bra and ket vectors
|
Greek variables
|
Historically, the math environment provided a set of greek letters, both capital and small, to use as variables in math equations. Before XeTeX and babel, Greek letters were also used in text, but it is quite inconvenient when writing a whole thesis in such a way (just try a sentence...). LaTeX uses the latin character for greek letters similar to latin ones, e.g. Greek "Alpha" is similar to the latin "A", greek "Mu" to the latin "M" etc. The complete set of greek characters available in LaTeX is following:
Γ: \Gamma
Δ: \Delta
Θ: \Theta
Λ: \Lambda
Ξ: \Xi
Π: \Pi
Σ: \Sigma
Υ: \Upsilon
Φ: \Phi
Ψ: \Psi
Ω: \Omega
α: \alpha
β: \beta
γ: \gamma
δ: \delta
ε: \epsilon
ζ: \zeta
η: \eta
θ: \theta
ι: \iota
κ: \kappa
λ: \lambda
μ: \mu
ν: \nu
ξ: \xi
ο: \omicron
π: \pi
ρ: \rho
σ: \sigma
ς: \varsigma
τ: \tau
υ: \upsilon
ϕ: \phi
φ: \varphi
χ: \chi
ψ: \psi
ω: \omega
Important notice: You never type normal greek letters in a math environment. You must always use the above commands instead (e.g. as variable names).
|
Accents and stresses
|
You can place a variety of symbols, such as accents and stresses over variables. For example, use \"{a}, to produce ä, or \hat{e} to produce ê etc. Try also the following:
\'{a}
\vec{abc}
\hat{abc}
\widehat{abc}
\tilde{abc}
\widetilde{abc}
\bar{abc}
\dot{a}
\ddot{a}
\overbrace{abc}
\underbrace{abc}
\overleftarrow{abc}
\overrightarrow{abc}
\underleftarrow{abc} (requires \usepackage{amsmath})
\underrightarrow{abc} (requires \usepackage{amsmath})
|
Matrices
|
A matrix can be easily typed in LaTeX, preloading the amsmath package. A simple matrix for example is generated with the following code:
\begin{equation}
\begin{bmatrix}
7 & 1 & 4\\
5 & 8 & 2\\
3 & 6 & 9
\end{bmatrix}
\end{equation}
For the determinant of the above matrix, replace bmatrix with vmatrix. See the examples here: [TeX][PDF].
|
|
|