Template:X10^/doc: Difference between revisions

Jump to navigation Jump to search
m (1 revision imported)
imported>Gonnym
 
Line 5: Line 5:


==Usage==
==Usage==
To render {{xt|3.14{{x10^|-12}}}}, instead of writing {{xt|<nowiki>3.14&amp;nbsp;×&amp;nbsp;10<sup>&amp;minus;12</sup></nowiki>}} you can write {{xt|<nowiki>3.14{{x10^|-12}}</nowiki>}}:
To render {{mxt|3.14{{x10^|-12}}}}, instead of writing {{code|2=html|3.14&nbsp;×&nbsp;10<sup>&minus;12</sup>}} you can write {{mxt|<nowiki>3.14{{x10^|-12}}</nowiki>}}:


{{xt|<nowiki>{{x10^|b}}</nowiki>}} &rarr; {{xt|{{x10^|b}}}}
: {{mxt|<nowiki>{{x10^|b}}</nowiki>}} &rarr; {{mxt|{{x10^|b}}}}


{{xt|<nowiki>{{10^|b}}</nowiki>}} &rarr; {{xt|{{10^|b}}}}
: {{mxt|<nowiki>{{10^|b}}</nowiki>}} &rarr; {{mxt|{{10^|b}}}}


{{xt|<nowiki>{{x10^|-12}}</nowiki>}} &rarr; {{xt|{{x10^|-12}}}}
: {{mxt|<nowiki>{{x10^|-12}}</nowiki>}} &rarr; {{mxt|{{x10^|-12}}}}


{{xt|<nowiki>{{10^|-12}}</nowiki>}} &rarr; {{xt|{{10^|-12}}}}
: {{mxt|<nowiki>{{10^|-12}}</nowiki>}} &rarr; {{mxt|{{10^|-12}}}}


The first output character for {{tlf|x10^}} is a non-breaking thin-space ("{{xt|]}}" and "{{xt|[}}" are used to illustrate the effects):
The first output character for {{tlf|x10^}} is a non-breaking thin-space ("{{mxt|]}}" and "{{mxt|[}}" are used to illustrate the effects):


{{xt|<nowiki>]{{x10^|b}}[</nowiki>}} &rarr; {{xt|]{{x10^|b}}[}}
: {{mxt|<nowiki>]{{x10^|b}}[</nowiki>}} &rarr; {{mxt|]{{x10^|b}}[}}


{{xt|<nowiki>]{{10^|b}}[</nowiki>}} &rarr; {{xt|]{{10^|b}}[}}
: {{mxt|<nowiki>]{{10^|b}}[</nowiki>}} &rarr; {{mxt|]{{10^|b}}[}}


{{xt|<nowiki>]{{x10^|-12}}[</nowiki>}} &rarr; {{xt|]{{x10^|-12}}[}}
: {{mxt|<nowiki>]{{x10^|-12}}[</nowiki>}} &rarr; {{mxt|]{{x10^|-12}}[}}
 
{{xt|<nowiki>]{{10^|-12}}[</nowiki>}} &rarr; {{xt|]{{10^|-12}}[}}


: {{mxt|<nowiki>]{{10^|-12}}[</nowiki>}} &rarr; {{mxt|]{{10^|-12}}[}}
===Delimiters===
===Delimiters===


The template uses gaps or commas, per {{tl|val/delimitnum}}.<br />
The template uses gaps or commas, per {{tl|Val}}.<br />
{{xt|<nowiki>1.2{{x10^|12341}}</nowiki>}} &rarr; {{xt|1.2{{x10^|12341}}}}
: {{mxt|<nowiki>1.2{{x10^|12341}}</nowiki>}} &rarr; {{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 {{xt|<nowiki>3.14{{x10^|-12}}</nowiki>}}  will produce {{xt|3.14{{x10^|-12}}}}, with the proper [[minus sign]] ("{{xt|&minus;}}"), rather than with a [[hyphen]] ("{{xt|-}}"). However, typing {{xt|<nowiki>A{{x10^|-BC}}</nowiki>}} will produce {{xt|A{{x10^|-BC}}}} since {{xt|BC}} is not a number. In those cases, you need to write {{xt|<nowiki>A{{x10^|&amp;minus;BC}}</nowiki>}} to produce the correct {{xt|A{{x10^|&minus;BC}}}}.
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|&minus;}}"), 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^|&amp;minus;BC}}</nowiki>}} to produce the correct {{mxt|A{{x10^|&minus;BC}}}}.


A minus sign also has to be provided for cases like {{xt|1.2{{x10^|1 &minus; 2}}}} ({{xt|<nowiki>1.2{{x10^|1 &amp;minus; 2}}</nowiki>}}).
A minus sign also has to be provided for cases like {{mxt|1.2{{x10^|1 &minus; 2}}}} ({{mxt|<nowiki>1.2{{x10^|1 &amp;minus; 2}}</nowiki>}}).


===Explicit plus sign===
===Explicit plus sign===
To explicitly display the {{xt|+}} character, write {{xt|<nowiki>1.2{{x10^|4|plus}}</nowiki>}} which will produce {{xt|1.2{{x10^|4|plus}}}}.
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 {{xt|<nowiki>1.2{{x10^|&amp;minus;42342|text}}</nowiki>}}, which will display {{xt|1.2{{x10^|&minus;42342|text}}}} instead of {{xt|1.2{{x10^|-42342}}}}. This can also be used as an alternative to explicitly display the plus sign ({{xt|<nowiki>1.2{{x10^|+4|text}}</nowiki>}} gives {{xt|1.2{{x10^|+4|text}}}}), but remember that you also lose delimitation if you do it this way.
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^|&amp;minus;42342|text}}</nowiki>}}, which will display {{mxt|1.2{{x10^|&minus;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 ==