Difference between revisions of "Template:Decimal-align/doc"

From blackwiki
Jump to navigation Jump to search
imported>Swpb
imported>Swpb
Line 14: Line 14:
 
| left (optional) || default alignment of the decimal point if no "leftx" argument is given (defaults to 50%)
 
| left (optional) || default alignment of the decimal point if no "leftx" argument is given (defaults to 50%)
 
|}
 
|}
 +
 +
==Example==
 +
'''Default alignment:'''
 +
 +
{{demo|br=0|
 +
<nowiki>{| class="wikitable sortable"
 +
! Example # !! fl. oz. !! pints !! quarts !! gallons
 +
|-
 +
| 1 || {{decimal-align|{{convert|1|usoz|uspt usqt usgal|disp=tablecen}}}}
 +
|-
 +
| 2 || {{decimal-align|{{convert|10|usoz|uspt usqt usgal|disp=tablecen}}}}
 +
|-
 +
| 3 || {{decimal-align|{{convert|100|usoz|uspt usqt usgal|disp=tablecen}}}}
 +
|}</nowiki>}}
 +
 +
'''Explicit alignment of certain columns:'''
 +
 +
{{demo|br=0|
 +
<nowiki>{| class="wikitable sortable"
 +
! Example # !! fl. oz. !! pints !! quarts !! gallons
 +
|-
 +
| 1 || {{decimal-align|{{convert|1|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
 +
|-
 +
| 2 || {{decimal-align|{{convert|10|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
 +
|-
 +
| 3 || {{decimal-align|{{convert|100|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
 +
|}</nowiki>}}
  
 
==See also==
 
==See also==

Revision as of 20:30, 24 January 2019

Aligns numbers in multiple table cells on the decimal point. Can wrap wikitext, including multi-cell outputs of {{convert}}.

Arguments

Argument Meaning
1 (unnamed) cells to perform alignment on
leftx (optional, x = 1 to 10) alignment of the decimal point within column x
left (optional) default alignment of the decimal point if no "leftx" argument is given (defaults to 50%)

Example

Default alignment:

{| class="wikitable sortable"
! Example # !! fl. oz. !! pints !! quarts !! gallons
|-
| 1 || {{decimal-align|{{convert|1|usoz|uspt usqt usgal|disp=tablecen}}}}
|-
| 2 || {{decimal-align|{{convert|10|usoz|uspt usqt usgal|disp=tablecen}}}}
|-
| 3 || {{decimal-align|{{convert|100|usoz|uspt usqt usgal|disp=tablecen}}}}
|}
Example # fl. oz. pints quarts gallons
1 1 0.063 0.031 0.0078
2 10 0.63 0.31 0.078
3 100 6.3 3.1 0.78

Explicit alignment of certain columns:

{| class="wikitable sortable"
! Example # !! fl. oz. !! pints !! quarts !! gallons
|-
| 1 || {{decimal-align|{{convert|1|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
|-
| 2 || {{decimal-align|{{convert|10|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
|-
| 3 || {{decimal-align|{{convert|100|usoz|uspt usqt usgal|disp=tablecen}}|left1=75|left4=25}}
|}
Example # fl. oz. pints quarts gallons
1 1 0.063 0.031 0.0078
2 10 0.63 0.31 0.078
3 100 6.3 3.1 0.78

See also

  • Template:Decimal cell, similar template that operates on single table cells only and splits them into separate cells