Template:math/doc: Difference between revisions
From cppreference.com
No edit summary |
m →Helper templates: added {{sub}}, {{sub}} & examples. |
||
| (13 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
The | The wikimarkup generated mathematical formulas. The generated formula is displayed using the same-size font as the adjoining text. | ||
{{|math|''''}} ''''. | |||
{{ | |||
'''' {{math}} | |||
{{||''''}} {{||}} {{|}} | |||
{{||}} {{||}} {{}} | |||
{{ | |||
=== | ===- | ||
=== | |||
={ | |||
{{} }} | |||
{{|}} produces {{|}} | |||
{{|2=}} | |||
{{|}} in {{}} | |||
{{|1+}} {{|1+}} | |||
=== | |||
< | |||
<nowiki>{{math| | |||
</ | |||
====== | |||
<>=</> | |||
<> | |||
= | |||
''''</> | |||
<><nowiki>{{math|1|1{{=}} }}</nowiki></> | |||
{{math|=1| | |||
{{=}} | |||
3} | |||
} | |||
Latest revision as of 13:50, 4 December 2024
The following templates are used to create wikimarkup generated mathematical formulas. The generated formula is displayed using the same-size font as the adjoining text.
{{math|source}} - creates a formula from the specified source.
Helper templates
The following templates can be in the source parameter of the {{math}} template to create advanced formatting.
- {{sub|arg}} - creates subscript, e.g.
{{sub|n}}results in n
- {{sup|arg}} - creates superscript, e.g.
{{sup|n}}results in n
- {{su|p=superscript (optional)|b=subscript (optional)}} - creates superscript and/or subscript, e.g.:
{{su|p=superscript|b=subscript}}results in superscript
subscript{{su|p=superscript}}results in superscript{{su|b=subscript}}results in subscript
- {{mrad|arg}} - produces radicals, e.g.
{{mrad|69}}results in √69
- {{minteg|min |max |body }} - creates an integral, e.g.:
{{minteg|min|max|body}}results in ∫max
minbody{{minteg|-1|+1|asin(x)}}results in ∫+1
-1asin(x)
- {{mexp|power}} - creates an exponent raised to power, e.g.
{{mexp|power}}results in epower
- {{mfrac|integer |numerator |denominator }} - creates a fraction, e.g.:
{{mfrac|integer|numerator|denominator}}results in integernumerator denominator {{mfrac|3|1|4}}results in 31 4
- {{mparen|left_paren |right_paren |row1 |row2 |... |style=style (optional)|rows=row_number_override (optional)}} -
- creates inline table with invisible borders and parentheses on the sides. E.g. ⎛
⎜
⎝line1
line2
line3⎫
⎬
⎭ - left_paren and right_paren can be one of (){}[].
rowsforces parentheses to span row_number_override rows. Currently 4 rows are supported.styledenotes additional style for the content (row#elements).
- creates inline table with invisible borders and parentheses on the sides. E.g. ⎛
Examples
| Source | Result | ||||||
|---|---|---|---|---|---|---|---|
| {{math|({{mrad|2}}){{su|p=2}} {{=}} 2}} | (√2)2 = 2 | ||||||
| {{math|A{{su|p=12|b=3}}}} | A12 3 | ||||||
| {{math|{{minteg|0|+∞|{{mexp|−''x''}} d''x''}} {{=}} 1}} | ∫+∞ 0e−x dx = 1 | ||||||
| {{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}} |
| ||||||
| {{mparen|(|}|line1|line2|line3}} | ⎛ ⎜ ⎝line1 line2 line3⎫ ⎬ ⎭ | ||||||
| {{mparen|{|]|line1|line2|style=font-style: italic;|rows=3}} | ⎧ ⎨ ⎩line1 line2⎤ ⎥ ⎦ |