Template:Val/doc: Difference between revisions

m
remove { from templates
(Created page with '<noinclude>{{documentation subpage}}</noinclude> <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> ==Purpose== This template is used to easily present values in {{wpd|scienti…')
 
m (remove { from templates)
Line 9: Line 9:
* <code><nowiki>{{</nowiki>val|''number''<nowiki>}}</nowiki></code> - for displaying values without uncertainty/significance.
* <code><nowiki>{{</nowiki>val|''number''<nowiki>}}</nowiki></code> - for displaying values without uncertainty/significance.
* <code><nowiki>{{</nowiki>val|''number''|''uncertainty''<nowiki>}}</nowiki></code> - for displaying values with uncertainty like so {{val|1234|56}}.
* <code><nowiki>{{</nowiki>val|''number''|''uncertainty''<nowiki>}}</nowiki></code> - for displaying values with uncertainty like so {{val|1234|56}}.
* <code><nowiki>{{</nowiki>val|''number''|''upper uncertainty''|''lower uncertainty''<nowiki>}}</nowiki></code> - for displaying values with uncertainty like so {{val|1234|+56|-78}}.
* <code><nowiki>{{</nowiki>val|''number''|''upper uncertainty''|''lower uncertainty''<nowiki>}}</nowiki></code> - for displaying values with uncertainty like so val|1234|+56|-78.
* <code><nowiki>{{</nowiki>val|''number''|(''significance'')<nowiki>}}</nowiki></code> - for displaying values with significance like so {{val|1234|(56)}}.
* <code><nowiki>{{</nowiki>val|''number''|(''significance'')<nowiki>}}</nowiki></code> - for displaying values with significance like so val 1234 (56).
They all take roughly the same arguments
They all take roughly the same arguments
{|
{|
Line 19: Line 19:
|valign=top| '''3'''  || The lower limit of uncertainty (must be a valid negative number)
|valign=top| '''3'''  || The lower limit of uncertainty (must be a valid negative number)
|-
|-
|valign=top| '''e'''  || The exponent for the power of 10 (optional). This will show up in the result as "&nbsp;×&nbsp;10{{su|p=e}}".
|valign=top| '''e'''  || The exponent for the power of 10 (optional). This will show up in the result as "&nbsp;×&nbsp;10 su p=e".
:Values (arguments '''1'''-'''3''' and '''e''') are run through code copied from {{tl|delimitnum}} for readability, except for argument '''2''' when it is surrounded by parenthesis. '''This currently causes an error for large numbers, numbers that require high precision and numbers that have zeros after the decimal point. This last issue is being addressed, the other issues require changes to the Wikipedia software.'''
:Values (arguments '''1'''-'''3''' and '''e''') are run through code copied from {{tl|delimitnum}} for readability, except for argument '''2''' when it is surrounded by parenthesis. '''This currently causes an error for large numbers, numbers that require high precision and numbers that have zeros after the decimal point. This last issue is being addressed, the other issues require changes to the Wikipedia software.'''
|-
|-
Line 37: Line 37:
|valign=top| '''errend''' || Appends something after the uncertainty. For example, <nowiki>{{val|123.23|end=...|2.34|errend=...}}</nowiki> gives {{val|123.23|end=...|2.34|errend=...}}
|valign=top| '''errend''' || Appends something after the uncertainty. For example, <nowiki>{{val|123.23|end=...|2.34|errend=...}}</nowiki> gives {{val|123.23|end=...|2.34|errend=...}}
|-
|-
|align=top| {{nobr|'''+errend'''}} & {{nobr|'''-errend'''}} || Appends something after the positive/negative uncertainties. For example, <nowiki>{{val|123.23|end=...|+2.34|+errend=...|-1.23|-errend=...}}</nowiki> gives {{val|123.23|end=...|+2.34|+errend=...|-1.23|-errend=...}}
|align=top| {{nobr|'''+errend'''}} & {{nobr|'''-errend'''}} || Appends something after the positive/negative uncertainties. For example, <nowiki>{{val|123.23|end=...|+2.34|+errend=...|-1.23|-errend=...}}</nowiki> gives val 123.23|end=...|+2.34|+errend=...|-1.23|-errend=
|-
|-
|valign=top| '''nocategory'''  || If set to any value, errors in the use of this template will not cause the page to be added to the [[:Category:Pages with incorrect formatting templates use|Pages with incorrect formatting templates use]] category. This is useful for documentation and test pages that do not need to be fixed.
|valign=top| '''nocategory'''  || If set to any value, errors in the use of this template will not cause the page to be added to the [[:Category:Pages with incorrect formatting templates use|Pages with incorrect formatting templates use]] category. This is useful for documentation and test pages that do not need to be fixed.
Line 59: Line 59:
|<code><nowiki>{{val|1.23456789}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.23456789}}
|<code><nowiki>{{val|1.23456789}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.23456789}}
|-
|-
|{{xpdop3c|gives={{!}}{{!}}&nbsp;→&nbsp;{{!}}{{!}}|d=|val|21563.252564425}}
|xpdop3c gives={{!}}{{!}}&nbsp;→&nbsp;{{!}}{{!}}|d=|val|21563.252564425
|-
|-
|colspan=3|'''Uncertainty/significance'''
|colspan=3|'''Uncertainty/significance'''
|-
|-
|<code><nowiki>{{val|1.234|0.005}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|0.005}}
|<code><nowiki>{{val|1.234|0.005}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|0.005
|-
|-
|<code><nowiki>{{val|1.234|+0.005|-0.006}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|+0.005|-0.006}}
|<code><nowiki>{{val|1.234|+0.005|-0.006}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|+0.005|-0.006
|-
|-
|<code><nowiki>{{val|1.234|(5)}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|(5)}}
|<code><nowiki>{{val|1.234|(5)}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|(5)
|-
|-
|colspan=3|'''Exponents/units'''
|colspan=3|'''Exponents/units'''
|-
|-
|<code><nowiki>{{val|1.234|e=5|u=m}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|e=5|u=m}}
|<code><nowiki>{{val|1.234|e=5|u=m}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|e=5|u=m
|-
|-
|<code><nowiki>{{val|1.234|e=5|u=m2}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|e=5|u=m2}}
|<code><nowiki>{{val|1.234|e=5|u=m2}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|e=5|u=m2
|-
|-
|<code><nowiki>{{val|1.234|e=5|ul=m}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|e=5|ul=m}}
|<code><nowiki>{{val|1.234|e=5|ul=m}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|e=5|ul=m
|-
|-
|<code><nowiki>{{val|1.234|0.056|e=7}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|0.056|e=7}}
|<code><nowiki>{{val|1.234|0.056|e=7}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|0.056|e=7
|-
|-
|<code><nowiki>{{val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s}}
|<code><nowiki>{{val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s}}</nowiki></code>||&nbsp;→&nbsp;||val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s
|-
|-
|<code><nowiki>{{val|1.234|0.056|e=7|ul=psi}}</nowiki></code>||&nbsp;→&nbsp;||{{val|1.234|0.056|e=7|ul=psi}}
|<code><nowiki>{{val|1.234|0.056|e=7|ul=psi}}</nowiki></code>||&nbsp;→&nbsp;||val|1.234|0.056|e=7|ul=psi
|-
|-
|<code><nowiki>{{val|123.4|ul=USgal}}</nowiki></code>||&nbsp;→&nbsp;||{{val|123.4|ul=USgal}}
|<code><nowiki>{{val|123.4|ul=USgal}}</nowiki></code>||&nbsp;→&nbsp;||val|123.4|ul=USgal
|-
|-
|<code><nowiki>{{val|12.34|ul=mpgimp}}</nowiki></code>||&nbsp;→&nbsp;||{{val|12.34|ul=mpgimp}}
|<code><nowiki>{{val|12.34|ul=mpgimp}}</nowiki></code>||&nbsp;→&nbsp;||val|12.34|ul=mpgimp
|-
|-
|colspan=3|'''Prefix/suffix'''
|colspan=3|'''Prefix/suffix'''
Line 96: Line 96:
* {{tl|FormattingError}} : for reporting inconsistent parameters
* {{tl|FormattingError}} : for reporting inconsistent parameters
* {{tl|Val/delimitnum}} : for formatting a decimal number with delimiters between groups of digits
* {{tl|Val/delimitnum}} : for formatting a decimal number with delimiters between groups of digits
* {{tl|Su}} : for formatting exponents, or two-values incertainty one below the other (monospaced : currently not printable to PDF)
* tl Su : for formatting exponents, or two-values incertainty one below the other (monospaced : currently not printable to PDF)
* {{tl|Val/units}} : for formatting unit names (contents of parameters <tt>u<tt> or <tt>up</tt>)
* {{tl|Val/units}} : for formatting unit names (contents of parameters <tt>u<tt> or <tt>up</tt>)
* {{tl|Val/unitswithlink}} : for formatting unit names with links (contents of parameters <tt>ul<tt> or <tt>upl</tt>)
* {{tl|Val/unitswithlink}} : for formatting unit names with links (contents of parameters <tt>ul<tt> or <tt>upl</tt>)
42,316

edits