Difference between revisions of "Template:Decimal Align/doc"
(Removed SEP argument in favor of Template:dec) |
(Added one example.) |
||
| Line 28: | Line 28: | ||
| {{Decimal Align | NUM = 123}} | | {{Decimal Align | NUM = 123}} | ||
|- | |- | ||
| − | | {{Decimal Align | NUM = | + | | {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}} |
|- | |- | ||
| − | | {{Decimal Align | NUM = 33.343 | POSTFIX = % }} | + | | {{Decimal Align | NUM = 999.1111 | P = 2 }} |
| + | |- | ||
| + | | {{Decimal Align | NUM = 33.343| POSTFIX = % }} | ||
|- | |- | ||
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}} | | {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}} | ||
| Line 48: | Line 50: | ||
| {{Decimal Align | NUM = 123}} | | {{Decimal Align | NUM = 123}} | ||
|- | |- | ||
| − | | {{Decimal Align | NUM = 999. | + | | {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}} |
| + | |- | ||
| + | | {{Decimal Align | NUM = 999.1111 | P = 2 }} | ||
|- | |- | ||
| {{Decimal Align | NUM = 33.343 | POSTFIX = % }} | | {{Decimal Align | NUM = 33.343 | POSTFIX = % }} | ||
Revision as of 21:20, 1 June 2023
This template is useful for stacking values in a table, where the numbers should be aligned based on the decimal separator. This template takes three arguments:
| Argument | Meaning |
|---|---|
| NUM | Number to format |
| P | Number of places after the decimal separator, defaults to three. |
| POSTFIX | String to append to the end of the number, such as a % symbol.
|
| FORMAT | B for Bold, I for Italic, and BI or IB for Bold Italic |
| TOOLTIP | Hover tooltip for the entire number, including POSTFIX if present. |
So in example, the following table construct:
{| class="wikitable grid"
|-
! class = "header" | Numbers
|-
| {{Decimal Align | NUM = 123.456789}}
|-
| {{Decimal Align | NUM = 123.456789 | P = 0}}
|-
| {{Decimal Align | NUM = 123}}
|-
| {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}}
|-
| {{Decimal Align | NUM = 999.1111 | P = 2 }}
|-
| {{Decimal Align | NUM = 33.343| POSTFIX = % }}
|-
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
|-
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
|}
Would generate:
| Numbers | ||
|---|---|---|
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|