Template:Math/doc
The {{math}}
template is a wrapper for the <math>
tag, which is a part of the Extension:Math. The template is mainly used to change the default rendering colors (black text on white background) to custom ones that fit the color scheme of the wiki, but also brings additional functionality such as the possibility of using other templates inside of <math>
tags and support for numbered equations.
For a detailed guide to LaTeX markup see Help:Displaying a formula.
Usage
Code {{math|2+3}}
renders as:
Parameters
The following parameters are available:
Parameter | Description |
---|---|
|formula= |
Use it if the formula contains an = sign.
|
|display= |
Display attribute with possible values:
|
|nr= |
Activates numbered equations. Don't forget to use unique numbers. Use {{EquationNote}} to reference the numbered equation. |
Basic usage
Display
default The sum {{math |formula=\sum_{i=0}^\infty 2^{-i} }} converges to 2. |
The sum converges to 2. |
block The sum {{math |display=block |formula=\sum_{i=0}^\infty 2^{-i} }} converges to 2. |
The sum converges to 2. |
inline The sum {{math |display=inline |formula=\sum_{i=0}^\infty 2^{-i} }} converges to 2. |
The sum converges to 2. |
Limitations
Error with multiple braces
Problem
Placing multiple opening/closing braces together (e.g. {{
or }}
) if there are no closing/opening brackets, causes error. This happens because interpreter thinks they are a part of a template when in fact they are a part of a math markup. For example, the following code:
{{math|formula= DR(A, D_{raw}) = {A \over A + 10 \times D_{raw}} }} |
- Failed to parse (syntax error): DR(A, D_{raw}) = {A \over A + 10 \times D_{raw
}}
Solution
In order to prevent this either space braces:
{{math|formula= DR(A, D_{raw}) = {A \over A + 10 \times D_{raw} } }} |
|
{{math|formula= DR(A, D_{raw}) = {A \over A + 10 \times D_{raw{{))}} }} |
Failed to parse (syntax error): DR(A, D_{raw}) = {A \over A + 10 \times D_{raw[[:Template:))]] |
Absolute value denotation
Problem
Absolute values are usually denoted |x|. However using |
in templates will result in the following issue.
{{math|formula= |x| }} |
|
Solution
Use \vert
or {{!}}
:
{{math|formula= \vert x\vert }} |
|
{{math|formula= {{!}}x{{!}} }} |
|
Template forces new line in lists
Problem
When using the template with unordered/ordered lists the template forces a new line.
# The highest-level talisman is counted '''three''' times, {{Math|H}}. # The middle three talismans are counted '''twice''', {{Math|[M_1, M_2, M_3]}}. # The lowest-level talisman is counted '''once''', {{Math|L}}. |
.
.
. |
Solution
In order to prevent this use html lists.
<ol> <li> The highest-level talisman is counted '''three''' times, {{Math|H}}. </li> <li> The middle three talismans are counted '''twice''', {{Math|[M_1, M_2, M_3]}}. </li> <li> The lowest-level talisman is counted '''once''', {{Math|L}}. </li> </ol> |
|
Template:Documentation categories