This template is used to easily present values inscientific notation, including uncertainty and/or units, as prescribed by Wikipedia'sManual of Style.
Introduction
Val specializes in numericvalues, especially those withscientific notations,uncertainty notations, and those with measurementvalues with physical units. Because these expressions are covered by the Manual of Style, Val provides the stylized output for you, and keeps them from wrapping across lines.
Express a numeral:
{{val|123456.78901}} →value, formatted with gaps:123456.78901, or with|fmt=commas →123,456.78901
Express a measurement value:{{val|4|ul=m2}} →4 m2. Them2 is a "unit code" that Val uses to look up the link to the unit's article, and the formatting of the unit symbol. Val links the units to the page it has on file for them. See{{Val/list}}.
There are a large number of unit codes that Val understands and keeps "up to code". A unit code is the just abbreviated unit name, but these can get quite involved for a compound or composite unit, with "multipliers" or "dividers". SeeModule:Val/units.
Some unit-code flexibility is provided by having four parameters to work the unit-code system: whether to link one or not, (seeOverlinking), and whether to link the numerator or denominator of a unit ratio separately.
{{val|number|ul=unit code}} →numbersymbol, such as9.8 km2
{{val|number|u=unit code}} →number symbol, such as9.8 km2
{{val|number|u=unit code|upl=unit code}} →number symbol/symbol, such as9.8 gal/min
{{val|number|ul=unit code|up=unit code}} →numbersymbol/symbol, such as9.8 pc/year
To bypass the unit code system, if|u= does not recognize your unit code, it will accept any wikitext and render it as usual.
Val takes three unnamed parameters. The first is always the numeric value. When the second and third are numbers they become the various uncertainty notations, but the second unnamed parameter can also serve togrammatically join the first and third numbers.
Val clears surrounding spaces in its unnamed parameters.
1st or|1=
A number. Can be indecimal point notation or ine notation. This number is the basis of the Val formatting.
{{val|1234567.1234567}} →1234567.1234567 {{val|.1234}} →0.1234(adds the zero) {{val|+1234}} →+1234(displays the plus) {{val|-1234}} →−1234(replaces thehyphen-minus with aminus sign) {{val|12e34}} →12×1034(E notation)
|fmt=
By default, numbers are formatted with gaps separating groups of three digits in both integer and fractional part.
However, by default, four-digit integers are not formatted; use|fmt=gaps to force gaps. Use|fmt=commas to delimit the integer part of the number with commas. Use|fmt=none for no formatting (no gaps or commas). {{val|1234567.1234567}} →1234567.1234567 {{val|1234567.1234567|fmt=commas}} →1,234,567.1234567 {{val|1234}} →1234 {{val|1234|fmt=gaps}} →1234 {{val|1234.5}} →1234.5 {{val|1234.5|fmt=none}} →1234.5
|end=
Put something at the end of the main number (before anything else that might follow).
{{val|11|22}} →11±22 {{Val|11|(22)}} →11(22) A conjunction to join two numbers. Useful for ranges, grammatical output, etc. {{val|11|-|33}} →11–33 {{val|11|–|33}} →11–33 {{val|11|,|33}} →11, 33 {{val|11|by|33|e=9}} →(11 by 33)×109 {{val|11|and|33|end=[[$]]}} →11$ and 33$ {{val|11|or|33}} →11 or 33 {{val|11|to|33}} →11 to 33 {{val|11|x|33}} →11 × 33 {{val|11|×|33}} →11 × 33 {{val|11|/|33|ul=m/s}} →11/33 m/s Note that for dashes or x's, the various kinds all obtain one properly styled output.
|ul= Link the unit. |u= Don't link the unit. Also acceptswiki markup in lieu of a unit code. {{val|11|ul=m}} →11 m
|up= or|upl=
A unit code, but instead of a space Val adds a slash and the unit, a "per" unit (the denominator), to form a ratio.
|upl= Link the per unit. |up= Don't link the per unit. The ratio can be of two unit codes, or a prefix and a unit code. Val will add parentheses to disambiguate, if a unit code has a dot or a slash. {{Val|11|ul=J/C|upl=F/m}} →11 (J/C)/(F/m) {{Val|11|upl=acre|p=$}} →$11/acre {{Val|11|ul=km/s|upl=Mpc}} →11 (km/s)/Mpc {{Val|11|ul=kg.m|upl=s-2}} →11 (kg⋅m)/s−2
|p=
Prefix the entire Val expression. Non-spaced, but accepts markup.
{{Val|11|22|ul=m/s|p=[Prefix]}} →[Prefix]11±22 m/s {{Val|11|22|ul=m/s|p=[Prefix] }} →[Prefix] 11±22 m/s
|s=
Suffix the entire Val expression. Non-spaced, but accepts markup.
{{Val|11|22|ul=m/s|s=[Suffix]}} →11±22 m/s[Suffix] {{Val|11|22|ul=m/s|s= [Suffix]}} →11±22 m/s [Suffix]
|e=
Exponent. Val alternatively accepts e notation in the first parameter; these are mutually exclusive (see "1st" argument above).
Usually a unit is the shortton andbillion means1×109. But there are long versions of these units and others. Use|long scale=on to assign your unit to the long scale instead. The unit code's link will change and it will sort differently in tables. "SeeLong and short scales".
|nocategory=
If set to any value, errors in the use of this template will not cause the page to be added to thePages with incorrect formatting templates use category. This is useful for documentation and test pages that do not need to be fixed.
Errors
There is strict checking on the validity of arguments; any incorrect use will result in an error. Pages that contain incorrect use of this template will show up onCategory:Pages with incorrect formatting templates use.
Val checks for unsupported parameters and gives a relatively subtle warning if found. Seetracking category to track any of these improper usages on existing on the wiki. Hold the mouse over "warning" to see details. Here is what warnings look like:
{{val|1.23|exp=6|u=m/s}} →1.23 m/sError in {{val}}: Val parameter "exp=6" is not supported
{{val|1.23|us=kbit/s}} →1.23Error in {{val}}: Val parameter "us=kbit/s" is not supported
{{val|1.23|.05|.04|.03|u=m/s}} →1.23+0.05 −0.04 m/sError in {{val}}: Val parameter 4 ignored
TheMOS recommends that numbers either be delimited using thin spaces either side of the decimal, or commas to the left and no delimiters to the right. Articles should be consistent with respect to the style of delimiting. The template defaults to the former style, this can be adjusted using|fmt= (seeabove).
{{val|1.234|u=m}} →1.234 m {{val|1.234|u=m2}} →1.234 m2 {{val|1.234|ul=m}} →1.234 m {{val|123.4|ul=USgal}} →123.4 US gal {{val|12.34|ul=mpgimp}} →12.34 mpg‑imp
It makes sure the value does notwrap at the end of a line, so that it can always be read as a single value on one line in the text.
It spaces the various parts of the value where they should be.
A3. Configuring Val gives you your own code for automating the markup for, and a link to, any units in the entire Encyclopedia.
A4. Val helps make Wikipedia more consistent. It adheres to theWikipedia Manual of Style for numbers. Updates to the MoS can be applied to this template and result in automatic modification on values that use it. All this makes sure all values on all pages have the samelook and feel because they will all use the samespacing,font size, positioning, etc, and makes updating and checking by the bots easier because they can recognize a value for what it is.
This template is used to easily present values in scientific notation, including uncertainty and/or units, as prescribed by Wikipedia's Manual of Style.
This template prefers inline formatting of parameters.
Parameter
Description
Type
Status
Number
1
A number in decimal point notation or in e notation. The main basis of the Val expression.
Example
-12.12345e9
String
required
Uncertainty
2
no description
String
optional
Asymmetric uncertainty -
3
no description
String
optional
Format
fmt
By default, numbers are formatted with gaps separating groups of three digits in both integer and fractional part. However, by default, four-digit integers are not formatted; use "gaps" (without quotes) to force gaps. Use the value "commas" (without quotes) to delimit the integer part of the number with commas. Use "none" (without quotes) for no formatting (no gaps or commas).
Suggested values
gapscommasnone
Example
commas
String
optional
End
end
Put something at the end of the main number (before anything else that might follow).
String
optional
Unit
u
The unit code. A space and the unit will be added after the number.
Example
m
String
optional
Unit – wikilinked
ul
The unit code that will be wikilinked to a page with information about the unit. A space and this unit will be added after the number.
Example
m
String
optional
Unit to be prefixed with a slash (/)
up
A unit code, but instead of a space, the template adds a slash and the unit, a "per" unit (the denominator), to form a ratio.
Example
s
String
optional
Unit to be prefixed with a slash (/) – wikilinked
upl
A wikilinked unit code, but instead of a space, the template adds a slash and the unit, a "per" unit (the denominator), to form a ratio.
Example
s
String
optional
Prefix
p
Prefix for the entire Val expression. Non-spaced, but accepts markup.
Content
optional
Suffix
s
Suffix for the entire Val expression. Non-spaced, but accepts markup.
Content
optional
Exponent
e
Val alternatively accepts e notation in the first parameter; these are mutually exclusive (see the Number parameter).