Namespaces
Variants

Template:math/doc: Difference between revisions

From cppreference.com
fmt
Space Mission (talk | contribs)
m Helper templates: added {{sub}}, {{sub}} & examples.
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:


===Helper templates===
===Helper templates===


The following templates can be in the ''source'' parameter of the {{tl|math}} template to create advanced formatting.
''''
 
{{tl|}} .


*{{tl|su|p{{=}}''superscript''{{mark optional}}|b{{=}}''subscript''{{mark optional}}}} - creates superscript and/or subscript, e.g. {{su|p=superscript|b=subscript}}
*{{tl |su|p=superscriptb=subscript}} - creates superscript and/or subscript, e.g.
{{su|p=superscript
|b=subscript}}


*{{tl|mrad}} - produces radicals
*{{tl|mrad}} - produces radicals


*{{tl|minteg|''min''|''max''|''body''}} - creates an integral, e.g. {{minteg|min|max|body}}.
*{{tl |minteg|minmaxbody}} - creates an integral, e.g.
{{minteg|min|max|body}}


*{{tl|mexp|''power''}} - creates an exponent raised to ''power'', e.g. {{mexp|power}}
*{{tl|mexp|''power''}} - creates an exponent raised to ''power'', e.g. {{mexp|power}}


*{{tl|mfrac|''integer''|''numerator''|''denominator''}} - creates a fraction, e.g. {{mfrac|integer|numerator|denominator}}.
*{{tl |mfrac|integernumeratordenominator}} - creates a fraction, e.g.
{{mfrac|integer|numerator|denominator}}


*{{tl|mparen|''left_parenthesis''|''right_parenthesis''|''row1''|''row2''|...|style{{=}}''style''{{mark optional}}|rows{{=}}''row_number_override''{{mark optional}}}} -
*{{tl |mparen|row1row2...style
*:creates inline table with invisible borders and parentheses on the sides.
{{}}
' ''' {{|rows}} ''row_number_override'' {{}} }} .


===Examples===
===Examples===
Line 37: Line 48:
|<tt><nowiki>{{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}}</nowiki></tt>
|<tt><nowiki>{{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}}</nowiki></tt>
|{{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}}
|{{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}}
|}
|}

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
      min
      body
    • {{minteg|-1|+1|asin(x)}} results in +1
      -1
      asin(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 integer
      numerator
      denominator
    • {{mfrac|3|1|4}} results in 3
      1
      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 (){}[]. rows forces parentheses to span row_number_override rows. Currently 4 rows are supported. style denotes additional style for the content (row# elements).

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}} +∞
0
ex dx = 1
{{math|{{mfrac|1|2}} − {{mfrac|1|3}} {{=}} {{mfrac|1|6}}}}
1
2
1
3
=
1
6
{{mparen|(|}|line1|line2|line3}}

line1
line2
line3


{{mparen|{|]|line1|line2|style=font-style: italic;|rows=3}}

line1
line2