Rationale edit

The 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 edit

Use 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}}}}''' 1213 = 16 The triple-apostrophes were interpreted by the parser; boldface was set.
{{Math|big=1|1 + 2 {{=}} 3}} 1 + 2 = 3

Known Bugs edit

Because 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 edit

If 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 &#61; for the equality sign {{Math|1 + 2 &#61; 3}} 1 + 2 = 3 The parser ignores the HTML entity, then your browser interprets &#61; as an equality sign.

Absolute Signs edit

If 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 &#124; for the equality sign {{Math||1 + 2| {{=}} 3}} |1 + 2| = 3 Your browser interprets &#124; as the pipe character when displaying this page.

TemplateData edit

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData 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.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Large fontbig

Request if the font in a bigger (165%) size. by adding 1

Example
yes, unused
Booleanoptional
Font sizesize

Used to specify your own font size.

Example
11px, 1.2em, 120%
Numberoptional
Equation1

The HTML text to display. Note that equal signs must be inputted as {{=}} and absolute value bars as {{!}}

Example
f(x) = x<sup>2</sup> + 2x + 1
Contentsuggested