Difference between revisions of "Template:Fraction"

From blackwiki
Jump to navigation Jump to search
imported>Pjrm
(Change that last commit from style=... to adding nowrap class. (Talk no longer necessary.))
imported>Crissov
(3/9, 6/9; no ⅟ anymore)
Line 1: Line 1:
 
<span class="frac nowrap">{{#if:{{{3|}}}
 
<span class="frac nowrap">{{#if:{{{3|}}}
    |{{{1}}}&thinsp;{{#switch:{{{3}}}
+
|{{{1}}}&thinsp;{{#switch:{{{3}}}
        |2 = {{#ifeq:{{{2}}}|1
+
  |2 = {{#ifeq:{{{2}}}|1
           
+
       
            |{{{2}}}⁄2
+
        |{{{2}}}⁄2
          }}
+
      }}
        |3 = {{#switch:{{{2}}}
+
  |3 = {{#switch:{{{2}}}
            |1=⅓
+
        |1=⅓
            |2=⅔
+
        |2=⅔
            |#default={{{2}}}⁄3
+
        |#default={{{2}}}⁄3
          }}
+
      }}
        |4 = {{#switch:{{{2}}}
+
  |4 = {{#switch:{{{2}}}
            |1=¼
+
        |1=¼
            |2=½
+
        |2=½
            |3=¾
+
        |3=¾
            |#default={{{2}}}⁄4
+
        |#default={{{2}}}⁄4
          }}
+
      }}
        |5 = {{#switch:{{{2}}}
+
  |5 = {{#switch:{{{2}}}
            |1=⅕
+
        |1=⅕
            |2=⅖
+
        |2=⅖
            |3=⅗
+
        |3=⅗
            |4=⅘
+
        |4=⅘
            |#default={{{2}}}⁄5
+
        |#default={{{2}}}⁄5
          }}
+
      }}
        |6 = {{#switch:{{{2}}}
+
  |6 = {{#switch:{{{2}}}
            |1=⅙
+
        |1=⅙
            |2=⅓
+
        |2=⅓
            |3=½
+
        |3=½
            |4=⅔
+
        |4=⅔
            |5=⅚
+
        |5=⅚
            |#default={{{2}}}⁄6
+
        |#default={{{2}}}⁄6
          }}
+
      }}
        |8 = {{#switch:{{{2}}}
+
  |8 = {{#switch:{{{2}}}
            |1=⅛
+
        |1=⅛
            |2=¼
+
        |2=¼
            |3=⅜
+
        |3=⅜
            |4=½
+
        |4=½
            |5=⅝
+
        |5=⅝
            |6=¾
+
        |6=¾
            |7=⅞
+
        |7=⅞
            |#default={{{2}}}⁄8
+
        |#default={{{2}}}⁄8
          }}
+
      }}
        |#default={{#ifeq:{{{2}}}|1||{{{2}}}}}{{{3}}}
+
  |9 = {{#switch:{{{2}}}
        }}
+
        |3=⅓
    |{{#if:{{{2|}}}
+
        |6=⅔
      |{{#switch:{{{2}}}
+
        |#default={{{2}}}⁄9
    |2 = {{#ifeq:{{{1}}}|1
+
      }}
 +
  |#default={{{2}}}{{{3}}}
 +
}}
 +
|{{#if:{{{2|}}}
 +
|{{#switch:{{{2}}}
 +
  |2 = {{#ifeq:{{{1}}}|1
 
         |½
 
         |½
 
         |{{{1}}}⁄2
 
         |{{{1}}}⁄2
 
       }}
 
       }}
    |3 = {{#switch:{{{1}}}
+
  |3 = {{#switch:{{{1}}}
 
         |1=⅓
 
         |1=⅓
 
         |2=⅔
 
         |2=⅔
 
         |#default={{{1}}}⁄3
 
         |#default={{{1}}}⁄3
 
       }}
 
       }}
    |4 = {{#switch:{{{1}}}
+
  |4 = {{#switch:{{{1}}}
 
         |1=¼
 
         |1=¼
 
         |2=½
 
         |2=½
Line 60: Line 65:
 
         |#default={{{1}}}⁄4
 
         |#default={{{1}}}⁄4
 
       }}
 
       }}
    |5 = {{#switch:{{{1}}}
+
  |5 = {{#switch:{{{1}}}
 
         |1=⅕
 
         |1=⅕
 
         |2=⅖
 
         |2=⅖
Line 67: Line 72:
 
         |#default={{{1}}}⁄5
 
         |#default={{{1}}}⁄5
 
       }}
 
       }}
    |6 = {{#switch:{{{1}}}
+
  |6 = {{#switch:{{{1}}}
 
         |1=⅙
 
         |1=⅙
 
         |2=⅓
 
         |2=⅓
Line 75: Line 80:
 
         |#default={{{1}}}⁄6
 
         |#default={{{1}}}⁄6
 
       }}
 
       }}
    |8 = {{#switch:{{{1}}}
+
  |8 = {{#switch:{{{1}}}
 
         |1=⅛
 
         |1=⅛
 
         |2=¼
 
         |2=¼
Line 85: Line 90:
 
         |#default={{{1}}}⁄8
 
         |#default={{{1}}}⁄8
 
       }}
 
       }}
    |#default={{#ifeq:{{{1}}}|1|⅟|{{{1}}}⁄}}{{{2}}}
+
  |9 = {{#switch:{{{1}}}
      }}
+
        |3=⅓
      |{{#switch:{{{1}}}
+
        |6=
    |2=½
+
        |#default={{{1}}}⁄9
    |3=⅓
 
    |4=¼
 
    |5=⅕
 
    |6=
 
    |8=⅛
 
    |#default={{{1|x}}}
 
 
       }}
 
       }}
    }}
+
  |#default={{{1}}}⁄{{{2}}}
    }}</span><noinclude>
+
}}
 +
|{{#switch:{{{1}}}
 +
  |2=½
 +
  |3=⅓
 +
  |4=¼
 +
  |5=⅕
 +
  |6=⅙
 +
  |8=⅛
 +
  |#default=1⁄{{{1|x}}}
 +
}}
 +
}}
 +
}}</span><noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 22:51, 27 November 2012

1⁄x

Template documentation[create]