Template:X10^/doc: Difference between revisions
m Unicode character is preferred to HTML entity |
imported>Gonnym |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
==Usage== | ==Usage== | ||
To render {{ | To render {{mxt|3.14{{x10^|-12}}}}, instead of writing {{code|2=html|3.14 × 10<sup>−12</sup>}} you can write {{mxt|<nowiki>3.14{{x10^|-12}}</nowiki>}}: | ||
{{ | : {{mxt|<nowiki>{{x10^|b}}</nowiki>}} → {{mxt|{{x10^|b}}}} | ||
{{ | : {{mxt|<nowiki>{{10^|b}}</nowiki>}} → {{mxt|{{10^|b}}}} | ||
{{ | : {{mxt|<nowiki>{{x10^|-12}}</nowiki>}} → {{mxt|{{x10^|-12}}}} | ||
{{ | : {{mxt|<nowiki>{{10^|-12}}</nowiki>}} → {{mxt|{{10^|-12}}}} | ||
The first output character for {{tlf|x10^}} is a non-breaking thin-space ("{{ | The first output character for {{tlf|x10^}} is a non-breaking thin-space ("{{mxt|]}}" and "{{mxt|[}}" are used to illustrate the effects): | ||
{{ | : {{mxt|<nowiki>]{{x10^|b}}[</nowiki>}} → {{mxt|]{{x10^|b}}[}} | ||
{{ | : {{mxt|<nowiki>]{{10^|b}}[</nowiki>}} → {{mxt|]{{10^|b}}[}} | ||
{{ | : {{mxt|<nowiki>]{{x10^|-12}}[</nowiki>}} → {{mxt|]{{x10^|-12}}[}} | ||
: {{mxt|<nowiki>]{{10^|-12}}[</nowiki>}} → {{mxt|]{{10^|-12}}[}} | |||
===Delimiters=== | ===Delimiters=== | ||
The template uses gaps or commas, per {{tl| | The template uses gaps or commas, per {{tl|Val}}.<br /> | ||
{{ | : {{mxt|<nowiki>1.2{{x10^|12341}}</nowiki>}} → {{mxt|1.2{{x10^|12341}}}} | ||
See ''[[#Forcing text display]]'' to turn this off. | See ''[[#Forcing text display]]'' to turn this off. | ||
===Text and number recognition=== | ===Text and number recognition=== | ||
By default, the template recognizes both text and numbers. That is, typing {{ | By default, the template recognizes both text and numbers. That is, typing {{mxt|<nowiki>3.14{{x10^|-12}}</nowiki>}} will produce {{mxt|3.14{{x10^|-12}}}}, with the proper [[minus sign]] ("{{mxt|−}}"), rather than with a [[hyphen]] ("{{mxt|-}}"). However, typing {{mxt|<nowiki>A{{x10^|-BC}}</nowiki>}} will produce {{mxt|A{{x10^|-BC}}}} since {{mxt|BC}} is not a number. In those cases, you need to write {{mxt|<nowiki>A{{x10^|&minus;BC}}</nowiki>}} to produce the correct {{mxt|A{{x10^|−BC}}}}. | ||
A minus sign also has to be provided for cases like {{ | A minus sign also has to be provided for cases like {{mxt|1.2{{x10^|1 − 2}}}} ({{mxt|<nowiki>1.2{{x10^|1 &minus; 2}}</nowiki>}}). | ||
===Explicit plus sign=== | ===Explicit plus sign=== | ||
To explicitly display the {{ | To explicitly display the {{mxt|+}} character, write {{mxt|<nowiki>1.2{{x10^|4|plus}}</nowiki>}} which will produce {{mxt|1.2{{x10^|4|plus}}}}. | ||
===Forcing text display=== | ===Forcing text display=== | ||
To force the template to display the input as text, and forgo the automatic delimitation and the recognition of the hyphen as a minus sign, write {{ | To force the template to display the input as text, and forgo the automatic delimitation and the recognition of the hyphen as a minus sign, write {{mxt|<nowiki>1.2{{x10^|&minus;42342|text}}</nowiki>}}, which will display {{mxt|1.2{{x10^|−42342|text}}}} instead of {{mxt|1.2{{x10^|-42342}}}}. This can also be used as an alternative to explicitly display the plus sign ({{mxt|<nowiki>1.2{{x10^|+4|text}}</nowiki>}} gives {{mxt|1.2{{x10^|+4|text}}}}), but remember that you also lose delimitation if you do it this way. | ||
== Tracking category == | == Tracking category == |
Latest revision as of 09:46, 10 December 2021
This is a documentation subpage for Template:X10^. It may contain usage information, categories and other content that is not part of the original template page. |
The {{10^}} and {{x10^}} templates are intended to facilitate and make uniform scientific notation numbers. The {{10^}} template works exactly as described below except that it does not generate a multiplication ("×") symbol.
Usage
To render 3.14×10−12, instead of writing 3.14 × 10<sup>−12</sup>
you can write 3.14{{x10^|-12}}:
- {{x10^|b}} → ×10b
- {{10^|b}} → 10b
- {{x10^|-12}} → ×10−12
- {{10^|-12}} → 10−12
The first output character for {{x10^}} is a non-breaking thin-space ("]" and "[" are used to illustrate the effects):
- ]{{x10^|b}}[ → ]×10b[
- ]{{10^|b}}[ → ]10b[
- ]{{x10^|-12}}[ → ]×10−12[
- ]{{10^|-12}}[ → ]10−12[
Delimiters
The template uses gaps or commas, per {{Val}}.
- 1.2{{x10^|12341}} → 1.2×1012341
See #Forcing text display to turn this off.
Text and number recognition
By default, the template recognizes both text and numbers. That is, typing 3.14{{x10^|-12}} will produce 3.14×10−12, with the proper minus sign ("−"), rather than with a hyphen ("-"). However, typing A{{x10^|-BC}} will produce A×10-BC since BC is not a number. In those cases, you need to write A{{x10^|−BC}} to produce the correct A×10−BC.
A minus sign also has to be provided for cases like 1.2×101 − 2 (1.2{{x10^|1 − 2}}).
Explicit plus sign
To explicitly display the + character, write 1.2{{x10^|4|plus}} which will produce 1.2×10+4.
Forcing text display
To force the template to display the input as text, and forgo the automatic delimitation and the recognition of the hyphen as a minus sign, write 1.2{{x10^|−42342|text}}, which will display 1.2×10−42342 instead of 1.2×10−42342. This can also be used as an alternative to explicitly display the plus sign (1.2{{x10^|+4|text}} gives 1.2×10+4), but remember that you also lose delimitation if you do it this way.
Tracking category
- Category:Articles using x10^ with no parameters (0) – a hidden category which may be added to pages using Template:E
See also
- m:Template:e
- {{e-sp}}, a more spaced version of {{x10^}}.
- {{val}}
- {{scinote}}