Template:Math
Rationale
editThe Math template formats HTML- or wikimarkup-generated mathematical formulas in the same manner as HTML-based TeX formulas, which uses a serif font. The generated formula is displayed using the same-size font as the adjoining text. The template will prevent line-wrapping.
Use this template for non-complex formulas as an alternative to using the "math" tags: <math>...</math>
.
Examples
editUse this template to wrap an inline formula in wikitext. For example:
Example | Output | Notes |
---|---|---|
{{Math|''x''<sup>2</sup> + ''y''<sup>2</sup> {{=}} ''r''<sup>2</sup>}}
|
x2 + y2 = r2 | |
{{Math|{{mapply|sin <i>π</i>}} {{=}} 0}}
|
sin π = 0 | The coding "<i>" puts italic font, same as "<var>" |
'''{{math|{{Frac|1|2}} − {{Frac|1|3}} {{=}} {{Frac|1|6}}}}'''
|
1⁄2 − 1⁄3 = 1⁄6 | The triple-apostrophes were interpreted by the parser; boldface was set. |
{{Math|big=1|1 + 2 {{=}} 3}}
|
1 + 2 = 3 |
Known Bugs
editBecause of this template's simplicity, there are some bugs that arise due to the fact that the template is handled through the wiki. This means that keywords and symbols may be inadvertently processed.
Equal Signs
editIf a single equals-sign ("=") is used, some bugs may occur because the wiki interprets the equal sign as a parameter assignment. It may show up as "{{{1}}}" or as undefined behavior if this template was used inside another template. For example, you should not write {{Math|1 + 2 = 3}}
as this will prevent the parser from rendering the template at all.
To resolve this, three workarounds are known:
Workaround | Example | Output | Explanation |
---|---|---|---|
(a) Start the formula with |1=
|
{{Math|1=1 + 2 = 3}}
|
1 + 2 = 3 | You have explicitly defined the positional parameter 1 , leaving subsequent equality signs in the value to be correctly handled by the template.
|
(b) Include the equality sign in double-braces like this: {{=}}
|
{{Math|1 + 2 {{=}} 3}}
|
1 + 2 = 3 | The parser interprets {{=}} as an equality sign, not the assignment of a value for a |1 + 2= parameter.
|
(c) Use the HTML entity code = for the equality sign
|
{{Math|1 + 2 = 3}}
|
1 + 2 = 3 | The parser ignores the HTML entity, then your browser interprets = as an equality sign. |
Absolute Signs
editIf the bar |
is used, some bugs may occur because the wiki interprets the pipe character as a new parameter or as a table component. For example, you should not write {{Math||1 + 2| {{=}} 3}}
, from which the (undesired) output is only: 1 + 2.
To resolve this, there are two known workarounds:
Workaround | Example | Output | Explanation |
---|---|---|---|
(a) Write {{!}} instead
|
{{Math|{{!}}1 + 2{{!}} {{=}} 3}}
|
1 + 2| = 3 | The parser interprets {{!}} as an absolute sign in the template. |
(b) Use the HTML entity code | for the equality sign
|
{{Math||1 + 2| {{=}} 3}}
|
|1 + 2| = 3 | Your browser interprets | as the pipe character when displaying this page. |
TemplateData
editTemplateData for Math
Formats HTML - or wikimarkup generated - mathematical formulas in the same manner as HTML based TeX formulas, which uses a serif-based font. Use this template for non-complex formulas as an alternative to using the math tags.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Large font | big | Request if the font in a bigger (165%) size. by adding 1
| Boolean | optional |
Font size | size | Used to specify your own font size.
| Number | optional |
Equation | 1 | The HTML text to display. Note that equal signs must be inputted as {{=}} and absolute value bars as {{!}}
| Content | suggested |