This site is supported by donations to The OEIS Foundation.

Template:Fraction/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:Fraction. [<Edit> Template:Fraction]

[⧼Purge⧽ Template:Fraction/doc]
Note: the former {{fraction}} template is now {{frac}}.
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.

Usage

{{fraction|A|B|C}}

BC (integer, numerator and denominator of a mixed fraction) (integer may be signed with {{op|-}})

{{fraction|A|B}}

AB (numerator and denominator of a simple fraction) (numerator may be signed with {{op|-}})

{{fraction|A}}

1A (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}} 17
{{fraction|&minus; 3|1|7}} − 3 17
{{fraction|22|7}} 227
{{fraction|&minus; 22|7}} − 227
{{fraction|2}} 12
{{fraction|3}} 13
{{fraction|2|3}} 23
{{fraction|4}} 14
{{fraction|3|4}} 34
{{fraction|5}} 15
{{fraction|2|5}} 25
{{fraction|3|5}} 35
{{fraction|4|5}} 45
{{fraction|6}} 16
{{fraction|5|6}} 56
{{fraction|7}} 17
{{fraction|2|7}} 27
{{fraction|3|7}} 37
{{fraction|4|7}} 47
{{fraction|5|7}} 57
{{fraction|6|7}} 67
{{fraction|8}} 18
{{fraction|3|8}} 38
{{fraction|5|8}} 58
{{fraction|7|8}} 78
{{fraction|16}} 116
{{fraction|3|16}} 316
{{fraction|5|16}} 516
{{fraction|7|16}} 716
{{fraction|9|16}} 916
{{fraction|11|16}} 1116
{{fraction|13|16}} 1316
{{fraction|15|16}} 1516

Code Result Comment
{{fraction|m|s}} ms  
{{fraction|km|h}} kmh  
{{fraction|kg{{sp|3}}{{sym|middot}}{{sp|3}}m|s{{^|2}}}} kg · ms 2 ({{sp|3}} gives a 3 mu space, i.e. a thin space)
{{fraction|s}} 1s  
{{fraction|Mbit|s}} Mbits  

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 &#x2044; {{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

Notes

  1. In mathematics articles, fractions should always be written either with a horizontal fraction bar (as in 
    1
    2
    , 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 12, with {{fraction|1|2}}) is discouraged in mathematics articles. The use of Unicode symbols (such as the vulgar fraction ½, with &#x00BD;) 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.