Bản_mẫu:Val

Trang Mô đun:Documentation/styles.css không có nội dung.This template is used to easily present values in scientific notation, including uncertainty and/or units, as prescribed by Wikipedia's Manual of Style.Chú ý: Các tham số đầu vào phải tuân theo quy tắc tiếng Việt: |1=1.234,5678 hoặc |1=1234,5678, chứ không phải |1=1,234.5678.Val stands for the number value that is its first parameter. Val specializes in scientific notations and uncertainty notations, and in a measurement value with physical units. It formats the number (with possible unit) according to the Manual of Style and keeps the expression from wrapping across lines.Express a numeral:Express a measurement value with a unit, for example {{val|4|ul=m/s2}} → 4 m/s2. The keyboard characters m/s2 are a "unit code" that |u=m/s2 marks up, or that |ul=m/s2 additionally links to its articulation.Because the unit spacing and markup is a style issue, Val provides these for you. There are a large number of unit codes that Val understands and keeps "up to code". A unit code is usually composed of one or more abbreviated unit names and the usual math symbols on the typical keyboard. See {{Val/units}}. Some unit-code flexibility is provided by having four parameters to work the unit-code system: whether to link one or not, (see Overlinking) , and whether to form a ratio or not with a unit code.To bypass the unit code system, if |u= does not recognize your unit code, it will accept any wikitext and render it as usual.See below for § How to add units to the unit code system. Sometimes a number and unit code is not enough. A prefix or suffix are also available, |p= and |s=.See {{val/testcases}} to learn the val parameters by a example. It's comprehensive, and there's over 100 examples.{{val|1234567.1234567}} → 12345671234567
{{val|.1234}} → 1234                     (adds the zero)
{{val|+1234}} → +1234                     (passes the plus)
{{val|-1234}} → −1234                     (replaces dash with minus)
{{val|1234}} → 1234                     (four-digits pure)
{{val|11|22}} → 11±22
{{Val|11|(22)}} → 11(22){{Val|11|22|33}} → 11+22
−33{{Val|11|22|33|e=11}} → 11+22
−33×1011{{val|1234567.1234567|fmt=commas}} → 12345671234567.
{{val|1234|fmt=gaps}} → 1234.|ul= Link the unit.
|u= Don't link the unit. Also accepts wiki markup in lieu of a unit code.
{{val|11|ul=m}} → 11 m|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/mẫu Anh
{{Val|11|ul=km/s|upl=Mpc}} → 11 (km/s)/Mpc
{{Val|11|ul=kg.m|upl=s-2}} → 11 (kg⋅m)/s−2{{Val|11|22|ul=m/s|p=<Prefix>}} → <Prefix>11±22 m/s
{{Val|11|22|ul=m/s|p=<Prefix>&nbsp;}} → <Prefix> 11±22 m/s{{Val|11|22|ul=m/s|s=<Suffix>}} → 11±22 m/s<Suffix>
{{Val|11|22|ul=m/s|s=&nbsp;<Suffix>}} → 11±22 m/s <Suffix>{{val|30|end={{ndash}}50|ul=km}} → 30 – 50 km
{{val|30|end=&ndash;{{gaps|1|234|567}}|ul=km}} → 30–1234567 km
{{val|1234567|fmt=commas|end={{ndash}}1,234,567|ul=km}} → 1234567 – 1,234,567 km
{{val|11|ul=m/s|end=<END>}} → 11<END> m/s
{{val|11|22|ul=m/s|end=<END>}} → 11<END>±22 m/s
{{val|11|(22)|ul=m/s|end=<End>}} → 11<End>(22) m/s
{{val|11|22|33|ul=m/s|end=<End>}} → 11<End>+22
−33 m/s
{{val|11|ul=m/s|end=<End>}} → 11<End> m/s{{val|11|22|ul=m/s|errend=<Errend>}} → 11±22<Errend> m/s.
{{val|11|22|33|+errend=<Errend>|-errend=<Errend>}} → 11+22<Errend>
−33<Errend>.There is strict checking on the validity of arguments; any incorrect use will result in an error, which is displayed using {{FormattingError}}. Pages that contain incorrect use of this template will show up on Category:Pages with incorrect formatting templates use.{{Val}} produces formatting compliant with Wikipedia's Manual of Style. The MOS 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= (see above).A hidden sort key is added to the output for sorting in sortable tables. The sort key is based on the main value (parameter |1=) and, if used, the exponent for the power of 10 (parameter |e=) and/or units (parameters |u=, |ul=, |up= and/or |upl=). Where necessary, units are converted to base SI units for the purpose of the sort key, which is produced by {{ntsh}}. Several units are covered; see § How to add units for those which are not. To omit the sort key use |sortable=off.{{val|1234567.1234567}} → 12345671234567
{{val|.1234567}} → 1234567
{{val|+1234567}} → +1234567
{{val|-1234567}} → −1234567
{{val|1.234|0.005}} → 1234±0005
{{val|1.234|+0.005|-0.006}} → 1234+0005
−0006
{{val|1.234|(5)}} → 1234(5)
{{val|1.234|u=m}} → 1234 m
{{val|1.234|u=m2}} → 1234 m2
{{val|1.234|ul=m}} → 1234 m
{{val|123.4|ul=USgal}} → 1234 gal Mỹ
{{val|12.34|ul=mpgimp}} → 1234 mpgAnh
{{val|12.34|u=deg}} → 1234°
{{val|1.234|0.005|u='}} → 1234′±0005′
{{val|1.234|+0.005|-0.006|u="}} → 1234″+0005″
−0006″
{{val|1.234|e=5|ul=m}} → 1234×105 m
{{val|1.234|0.056|e=7}} → (1234±0056)×107
{{val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s}} → 123456+000007
−000008×10−9 m/s
{{val|1.234|0.056|e=7|ul=psi}} → (1234±0056)×107 psi
{{val|1.234|(5)|e=-2}} → 1234(5)×10−2
{{val|12.34|p=Δ&nbsp;}} → Δ 1234
{{val|12.34|u=%|p=≅}} → ≅1234%
{{val|12.34|0.25|s=%}} → 1234±025%
{{val|1.234|e=7|ul=W|up=m2}} → 1234×107 W/m2
See the testcases at {{val/testcases}}.For very long list articles with hundreds of numeric entries, load times for that page will be much much faster by using html. No templates can compete with HTML on, for example List of nuclides.Performance data is reported by MediaWiki software in the HTML page source of every page, and a very similar report is available on any preview page, below the edit box, titles "Parser profile data". For using Val inside other templates, note the performance parameter in these reports, called "Highest expansion depth". Numbers with fractional parts cost more Val-expansion depth than numbers with only integer parts.For uses in any other page besides long list articles, Template:Val will have no noticeable impact on CPU time contributions to page-load times.Add the unit to Bản mẫu:Val/units. Val defaults to looking up units at {{Convert}}, but units added here override that.Note these points about composite units before adding units:After adding a unit, you can ensure that it sorts correctly in a table, especially if there are ten or twenty variations that differ only by an SI prefix. (See § Sorting above and Bản mẫu:Val/sortkey/unit.)