Perfect | Complete | In Progress | Ready | Searching | Missing Files

Template:frac

Boris Ginsburgs, editor.
Jump to navigation Jump to search

This is the fraction template from Wikipedia, which attempts to solve the whole fraction-writing business using superscript, subscript, and separator. You can give it one, two, or three parameters, depending on what you are building (see Use). It does not use HTML entities for the "known" fractions, and uses the ⁄ notation for the separator.

Use

-1056 = {{frac|-10|5|6}}
412 = {{frac|4|1|2}}
5x = {{frac|5|x}}
16 = {{frac|6}}

Code

{{#if:{{{3|}}}
 |{{{1}}}<sup>{{{2}}}</sup>⁄<sub>{{{3}}}</sub>
 |{{#if:{{{2|}}}
  |<sup>{{{1}}}</sup>⁄<sub>{{{2}}}</sub>
  |{{#if:{{{1|}}}
   |<sup>1</sup>⁄<sub>{{{1}}}</sub>
   |⁄
  }}
 }}
}}