Formatting Math

From DPWiki
Jump to navigation Jump to search
Languages: English Français

This document describes math markup for use in formatting rounds. For proofreading rounds refer to Proofreading Math

This is a brief introduction to the most common maths markup. More information can be found in the references below.

In the sections below examples are given followed by the rendered appearance. This Wiki page uses a different method for displaying maths to the one we are using so in some cases it cannot show the result of the markup.

References

Some of these references are to Latex in general. Only the maths parts of Latex can be used here.

http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm This lists the commands which are available.

https://en.wikibooks.org/wiki/LaTeX/Mathematics

https://tobi.oetiker.ch/lshort/lshort.pdf

https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference This is a very long page which jumps around stangely when navigating within it.

http://www.maths.adelaide.edu.au/anthony.roberts/LaTeX/Others/el2emath.pdf

Subscripts and superscripts

These are similar to normal DP markup, single character subscripts need not have braces.

A prime is represented by a single quote, double prime by two single quotes etc.

Subscripts and superscripts and prime can all be applied to the same character.

\[(a_{11} + 2a_{12}q_{2}' + a_{22}q_{2}'^2)^{-\frac{3}{2}}\]

A double superscript written as \( a = b^c^d \) will give a warning MathJax error: Double exponent: use braces to clarify : a = b^c^d".

The author will most likely have intended \( a = b^{c^d} \) which will render as .

Similarly for double subscripts braces should be inserted appropriately.

Letters, Greek letters and other letter symbols

Upper and lower case letters will by italicized by default. If you want upright letters precede them by \mathrm. This will affect only the following letter (or a group in { }). Alternatively \rm will affect all subsequent letters.

When a Greek character is used in a math expression, proof it as the name of the letter preceded by a backslash (e.g., as \pi). For some Greek capital letters use the capitalized name of the letter (e.g., \Pi), for others a Roman equivalent must be used: (A, B, E, Z, H, I, K, M, N, O, P, T, X). These Roman equivalents will appear in italic by default. For an upright form precede the letter by \mathrm.

\mathrm A \mathrm B \Gamma \Delta \mathrm E \mathrm Z \mathrm H \Theta \mathrm I \mathrm K \Lambda \mathrm M
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu
\mathrm N \Xi \mathrm O \Pi \mathrm P \Sigma \mathrm T \Upsilon \Phi \mathrm X \Psi \Omega
\nu \xi \omicron \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega

Variant pi \varpi

Variant theta \vartheta

Weierstrass-p \wp


\(\delta \rho = \Sigma e / \delta a\), \(\delta \mathrm P = \Sigma e / \delta A\)

,

Fractions

Use \frac{numerator}{denominator}. To use a smaller version of fractions in display expressions (see below) use \tfrac. Conversely to use a larger version of fractions in inline expressions use \dfrac.

\[\frac{3}{4} + \tfrac{1}{2}\]

Symbols

Braces { and } have a special meaning. To use them literally use \{ and \} .

Symbol Description Code Example Example code
Integral sign \int \int_a^b Q dt
Sum \sum \sum_{i=0}^\infty
Square root \sqrt{x} \sqrt{a^2+b^2}
Square root (without top bar) \surd
Other roots \sqrt[n]{x} \sqrt[3]{8}=2
Partial Differential \partial \frac{\partial x}{\partial t}
Infinity sign \infty \infty+1=\infty
Multiplication sign \times 2\times2=4
Centre dot (multiplication) \cdot x \cdot y
plus or minus \pm a \pm b
dot above \dot \dot{x}
double dot above \ddot \ddot{x}
hat above \hat \hat{x}
breve above \breve \breve{R}
left arrow above \overleftarrow{} \overleftarrow{R}
right arrow above \overrightarrow{} \overrightarrow{R}
left-right arrow \overleftrightarrow{} \overleftrightarrow{R}
therefore \therefore
proportional to \propto
not equal to \neq
greater than or equal \geq
less than or equal \leq
greater or less than \gtrless
or \lor
and \land
assert \vdash
subset \subset
superset \supset
union \cup
intersection \cap
parallel \parallel
\(\int\sqrt{v_{r}\cdot\{q_{r}\}}dq_{r} = \sum _{r = 2}^n \frac{\ddot{q}_{r}}{\dot{q}_{1}}\frac{\partial L}{\partial \dot{q}_{r}},\)

Functions

Many standard functions are built in: \sin, \cos, \tan, \ln etc. These are shown in equations in upright text. If you find that a function you need is not built in, (the preview will colour it red), such as cosec, include the line

\DeclareMathOperator\cosec{cosec}

inside the math markup. Then you can use it as \cosec.

Context

When expressions occur in the normal flow of text (referred to as 'inline') they should be surrounded by \( and \).

If expressions are centred on a line on their own (referred to as 'display') surround them by \[ and \]. There should not be a blank line before \[ or after \] (except at the end of a paragraph).

Since \(\pi\mathrm ~D ~t \mathrm ~E =\rm C^2 \cdot \dfrac{4 R}{\pi D^2} \times \cdot 24\), therefore
\[
\mathrm C^2 = \mathrm D^3 t\cdot\frac{\pi^2 \mathrm E}{\mathrm R \times 4 \times \cdot 24}
\]

Since , therefore

Spacing

Spaces are not significant in the markup. The resulting image will be spaced according to conventional rules. However spaces must sometimes be inserted to separate words such as between '\partial' and 'q' in the example below.

To add extra space in the display insert ~ or \quad or \qquad.

\[\frac{d}{dt}\left(\frac{\partial T}{\partial\dot{q}_{r}}\right) - \frac{\partial T}{\partial q_{r}} = -\frac{\partial V}{\partial q_{r}}, \qquad(r = 1, 2,~..., n).\]

Text within math

Mark text within math thus: \text{This is ordinary text}.

\[\lambda_{1} = \frac{\alpha\lambda + \beta}{\gamma\lambda + \delta} \quad \text{and} \quad \lambda_{1}' = \frac{\alpha\lambda' + \beta}{\gamma\lambda' + \delta}.\]

Autosizing braces and brackets

These are shown by \left\{ and \right\} or \left( and \right) in a previous example.

\[\frac{d}{dx}\left\{\frac{Y - X\frac{dy}{dx}}{\frac{d^2y}{dx^2}}\right\} - 2X = 0\]

Changing the size

\tiny \Tiny \small \large \Large \LARGE \huge \Huge can be used to change the size of following items (or items included in braces with one of these).

\[
C = {\LARGE\surd}
\left\{
\frac{\pi^2 K D^2_1}{·48 R} t × \frac{3 D_2}{10 + 3 D_2 log._e \frac{D_2}{D_1}}
\right\}
\]

This page cannot show the result.

Grouped Equations

\[
   \left\{
      \begin{array}{l}
         X = l_{1}X' + m_{1}Y' + n_{1}Z',\\
         Y = l_{2}X' + m_{2}Y' + n_{2}Z',\\
         Z = l_{3}X' + m_{3}Y' + n_{3}Z'.
      \end{array}
   \right.
\]

\left\{ gives the left brace. \right. is needed to match it. The full stop after \right. means display nothing.

{array}{l} means left-aligned columns, although in this case there is only one column so it does not make any difference if the alignment is left, right or centre.

\\ gives a new line.

The spacing is just to show the structure more clearly.

An Aligned Equation

\[ \DeclareMathOperator\cosec{cosec} \]
\[
   \begin{aligned}
      T & = \tfrac{1}{2}(\dot{y} \cot \alpha + ft)^2 + \tfrac{1}{2}\dot{y}^2,\\
      & = \tfrac{1}{2}\dot{y}^2 \cosec^2 \alpha + \dot{y} \cot \alpha \cdot ft + \tfrac{1}{2}f^2t^2,
   \end{aligned}
\]

The ampersands indicate where the aligment is required.

Numbered equations

Unfortunately \tag{n} will not produce a usable image with m2svg. So use \text{} suitably spaced for the number.

\[\lambda_{1} = \frac{\alpha\lambda + \beta}{\gamma\lambda + \delta} \qquad \text{(1)}\]

Centred equations with text at left margin on the same line

MathJax cannot do this; so interleave text and display equations.

\[T = \tfrac{1}{2}(\dot{x}^2 + \dot{y}^2),\]
where
\[x = y \cot \alpha + \tfrac{1}{2}ft^2,\]
so 
\[
   \begin{aligned}
      T &= \tfrac{1}{2}(\dot{y} \cot \alpha + ft)^2 + \tfrac{1}{2}\dot{y}^2,\\
      &= \tfrac{1}{2}\dot{y}^2 \sec^2 \alpha + \dot{y} \cot \alpha \cdot ft + \tfrac{1}{2}f^2t^2,
   \end{aligned}
\]

where
so