This site is supported by donations to The OEIS Foundation.
Template:Fraction/doc
From OeisWiki
- This template should not be used in mathematical articles.[1]
The {{fraction}} OEIS Wiki formatting and function template shows either mixed fractions or simple fractions (also known as a common fractions or vulgar fractions) in an alternative form. It takes one, two or three parameters: the optional integer, the optional numerator and the required denominator; in this order. Please don't substitute it.
Contents
Usage
{{fraction|A|B|C}}
- A B⁄C (integer, numerator and denominator of a mixed fraction) (integer may be signed with {{op|-}})
{{fraction|A|B}}
- A⁄B (numerator and denominator of a simple fraction) (numerator may be signed with {{op|-}})
{{fraction|A}}
- 1⁄A (denominator of an Egyptian fraction, which is a special case of a simple fraction)
Examples
Examples with valid input
Code Result {{fraction|3|1|7}} 3 1⁄7 {{fraction|− 3|1|7}} − 3 1⁄7 {{fraction|22|7}} 22⁄7 {{fraction|− 22|7}} − 22⁄7 {{fraction|2}} 1⁄2 {{fraction|3}} 1⁄3 {{fraction|2|3}} 2⁄3 {{fraction|4}} 1⁄4 {{fraction|3|4}} 3⁄4 {{fraction|5}} 1⁄5 {{fraction|2|5}} 2⁄5 {{fraction|3|5}} 3⁄5 {{fraction|4|5}} 4⁄5 {{fraction|6}} 1⁄6 {{fraction|5|6}} 5⁄6 {{fraction|7}} 1⁄7 {{fraction|2|7}} 2⁄7 {{fraction|3|7}} 3⁄7 {{fraction|4|7}} 4⁄7 {{fraction|5|7}} 5⁄7 {{fraction|6|7}} 6⁄7 {{fraction|8}} 1⁄8 {{fraction|3|8}} 3⁄8 {{fraction|5|8}} 5⁄8 {{fraction|7|8}} 7⁄8 {{fraction|16}} 1⁄16 {{fraction|3|16}} 3⁄16 {{fraction|5|16}} 5⁄16 {{fraction|7|16}} 7⁄16 {{fraction|9|16}} 9⁄16 {{fraction|11|16}} 11⁄16 {{fraction|13|16}} 13⁄16 {{fraction|15|16}} 15⁄16
Code Result Comment {{fraction|m|s}} m⁄s {{fraction|km|h}} km⁄h {{fraction|kg{{sp|3}}{{sym|middot}}{{sp|3}}m|s{{^|2}}}} kg · m⁄s 2 ({{sp|3}} gives a 3 mu space, i.e. a thin space) {{fraction|s}} 1⁄s {{fraction|Mbit|s}} Mbit⁄s
Examples with invalid input
Code Result {{fraction}} Fraction error: At least one argument (to get an Egyptian fraction) is required.
Code
<noinclude>{{Documentation}}</noinclude><includeonly><!-- Template:Fraction was previously Template:Frac Template:Fraction is not suitable for mathematical documents. ⁄ is fraction slash ⁄ {{sym|frasl}} Use Template:Frac (Template:/) for mathematical documents (typeset in either HTML+CSS or LaTeX). -->{{#if: {{{1|}}} | {{#if: {{{3|}}} | <span class="mixed fraction">{{{1}}} <sup>{{#if: {{{2|}}} |{{{2}}}|1}}</sup>⁄<sub>{{{3}}}</sub></span> | {{#if: {{{2|}}} | <span class="simple fraction"><sup>{{{1}}}</sup>⁄<sub>{{{2}}}</sub></span> | <span class="Egyptian fraction"><sup>1</sup>⁄<sub>{{{1}}}</sub></span> }} }} | {{error| Fraction error: At least one argument (to get an Egyptian fraction) is required. }} }}</includeonly>
See also
- {{frac}} and {{op|/}} (typesetting of rational expressions in either HTML+CSS or LaTeX suitable for mathematical documents)
Notes
- ↑ In mathematics articles, fractions should always be written either with a horizontal fraction bar (as in
, with {{math|{{frac|1|2}}|&}}), or with a fraction slash ⁄ ({{sym|frasl}}) with the baseline of the numbers aligned with the baseline of the surrounding text (as 1 ⁄ 2, with 1 {{sym|frasl}} 2). The use of {{fraction}} (such as 1⁄2, with {{fraction|1|2}}) is discouraged in mathematics articles. The use of Unicode symbols (such as the vulgar fraction ½, with ½) is discouraged entirely, for accessibility reasons among others. Metric units are given in decimal fractions (e.g., 5.2 cm); non-metric units can be either type of fraction, but the fraction style should be consistent throughout the article.1 2