Wikipedia:Manual of Style/Superscripts and subscripts: Difference between revisions

Content deleted Content added
No edit summary
Replaced html markup with standard WP templates; Copyedit;
Line 1:
{{shortcut|WP:SUPSCRIPT|WP:SUBSCRIPT}}
{{proposed}}
A '''[[Subscriptsubscript and superscript|Superscripts and subscripts]]''' appearsis smallertext thanthat is positioned slightly below or above the normal line of type and is setsometimes slightlyrendered belowin ora above it and have manysmaller usesfont. This part of the [[Wikipedia:Manual of Style|Manual of Style]] aims to achieve consistency in the use and formatting of superscripts and subscripts in Wikipedia articles.
 
Subscripts and superscripts should be wrapped in <code>&lt;<nowiki><sub></nowiki></code> and <code>&lt;<nowiki><sup></nowiki></code> [[HTML]] tags, respectively, with no other formatting info. The {{tlx|sup}} and {{tlx|sub}} templates are useful shortcuts to the HTML markup. Do not use the [[Unicode subscripts and superscripts]] <span class="bad_example" style="color: #B20000;">{{!xt|²</span>}} and <span class="bad_example" style="color: #B20000;">{{!xt|³</span>}}, or [[List of XML and HTML character entity references|XML/HTML character entity references]] ({{!xt|<code>&amp;sup2;</code>}} etc). Rather, write {{xt|<code><nowiki><sup>2</sup></nowiki></code>}} and {{xt|<code><nowiki><sup>3</sup></nowiki></code>}} to produce the superscripts <span class="example" style="color: #006F00;"><{{xt|{{sup>|2</sup></span>}}}} and <span class="example" style="color: #006F00;"><{{xt|{{sup>|3</sup></span>}}}}. The superscripted 2 and 3 are easier to read, especially on small displays, and ensure that exponents are properly aligned. Compare:
: <span class="bad_example" style="color: #B20000;">{{!xt|wⁱx²z⁽ⁿ⁺⁶⁾</span>}} (Unicode superscripts) to
: <span class="example" style="color: #006F00;">{{xt|w<sup>i</sup>x<sup>2</sup>z<sup>(n + 6)</sup></span>}} (<code><nowiki>w<sup>i</sup>x<sup>2</sup>z<sup>(n + 6)</sup></nowiki></code>) or
: {{xt|w{{sup|i}}x{{sup|2}}z{{sup|(n + 6)}}}} (<code><nowiki>w{{sup|i}}x{{sup|2}}z{{sup|(n + 6)}}</nowiki></code>)
<br />
{{br}}
: <span class="bad_example" style="color: #B20000;">1 + ''x''² + ''y''³</span> (<code>&amp;sup2;</code>) to
: <span{{!xt|1 class="example" style="color: #006F00;">1 + ''x''<sup>2</sup>² + ''xy''<sup>3</sup></span>³}} (<code>&ltamp;sup>2&ltsup2;/sup></code>) to
: {{xt|1 + ''x''<sup>2</sup> + ''x''<sup>3</sup>}} (<code><nowiki><sup>2</sup></nowiki></code>) or
: {{xt|1 + ''x''{{sup|2}} + ''x''{{sup|3}}}} (<code><nowiki>{{sup|2}}</nowiki></code>)
 
Except under extraordinary circumstances, font sizes, color, etc should be controlled with Wikipedia's stylesheets.
Font sizes and such should be entrusted to be handled with stylesheets.<!--see discussion on Talk:Template:Sup-->
 
==Dates and numbers==
Line 16 ⟶ 18:
* The '''ordinal suffix''' (e.g., ''th'') is not superscripted ({{xt|23rd}} and {{xt|496th}}, not {{!xt|23<sup>rd</sup>}} and {{!xt|496<sup>th</sup>}}).
* '''Centuries and millennia''' are written using ordinal numbers, without superscripts and without Roman numerals: {{xt|the second millennium}}, {{xt|the 19th century}}, {{xt|a 19th-century book}} (see also [[Wikipedia:Manual of Style#Numbers as figures or words]]).
* '''Non-[[base (mathematics)radix|base]]-10 notations''' in non-computer-related articles use subscript notation. For example: {{xt|''137<{{sub>|9</sub>''}}}}, {{xt|''241<{{sub>|6</sub>''}}}}, {{xt|''2A9<{{sub>|12</sub>''}}}}, {{xt|''A87D<{{sub>|16</sub>''}}}} (use <code>&lt;<nowiki>{{sub|radix}}</nowiki></code> andor <code>&lt;<nowiki><sub>radix</sub></nowiki></code>).
 
==Music==
{{main|Wikipedia:Manual of Style (music)}}
 
* In '''[[figured bass]]''', superscript and subscript may be combined, inby using math markup or by using the {{tltlx|su}}, template: <code><nowiki><math>C_6^4</math></nowiki></code> = <math>C_6^4</math>, <code><nowiki>''C''{{su|b=6|p=4}}</nowiki></code> = ''C''{{su|b=6|p=4}}; (see also [[Wikipedia:TeX markup]] or [[m:Help:Formula]] and [[Template:su]]).
*A '''superscript circle''', or '''degree sign''', which indicates a diminished chord, that may not display correctly for everyone, "°", can be produced by typing <code>&amp;deg;</code>, <code>&amp;#176</code>, or (onby keying {{key press|[[Alt key|Alt]]|0}}{{key press|1}}{{key press|7}}{{key press|6}} (Windows PCs) Alt+0176. A superscript lower case "<{{sup>|o</sup>}}" (<code><nowiki><{{sup>|o</sup>}}</nowiki></code>) may be used instead. The slashed o, "<{{sup>|ø</sup>}}", which may not display correctly for all readers, is produced by superscripting the character produced by typing <code>&amp;oslash;</code>, or <code>&amp;#248;</code>, or by keying {{key press|[[Alt+0248 key|Alt]]|0}}{{key press|2}}{{key press|4}}{{key press|8}} (Windows PCs).
*For '''inversions''' and the '''degree sign''' superscript and subscript may be done thus: <code><nowiki>vii<{{sup>|o</sup>}}</nowiki></code>, <code><nowiki>I<{{sub>|6</sub>}}</nowiki></code>. This looks like: {{xt|vii<{{sup>|o</sup>}}}}, {{xt|I<{{sub>|6</sub>}}}}.
 
==Unit symbols and abbreviations ==
{{main|Wikipedia:Manual of Style (dates and numbers)#Unit names and symbols}}
* '''Squared and cubic metric-symbols''' are always expressed with a superscript exponent ({{xt|5&{{nbsp;}}km<{{sup>|2</sup>}}}}, {{xt|2&{{nbsp;}}cm<{{sup>|3</sup>}}}}); squared imperial and US unit abbreviations may be rendered with {{xt|sq}}, and cubic with {{xt|cu}} ({{xt|15&{{nbsp;}}sq&{{nbsp;}}mi}}, {{xt|3&{{nbsp;}}cu&{{nbsp;}}ft}}).
 
==Science==
Line 34 ⟶ 36:
Descriptions of:
*'''[[Chemical compound]]s'''
:{{xt|C<{{sub>|2</sub>}}H<{{sub>|5</sub>}}OH}} using <code><nowiki>C<{{sub>|2</sub>}}H<{{sub>|5</sub>}}OH</nowiki></code>
*'''[[Isotopes]]'''
:{{xt|{{Nuclide2|He|3}}}} using <code>{{tlx|Nuclide2|He|3}}</code>
Line 43 ⟶ 45:
 
* '''[[Exponentiation]]''' is indicated using a superscript:
:{{xt|2<{{sup>|2</sup>}} &#61; 4}} using <code><nowiki>2<{{sup>|2</sup>}} = 4</nowiki></code>
 
Special care is needed with subscripted labels to distinguish the purpose of the subscript (as this is a common error): variables and constants in subscripts should be italic, while textual labels should be in normal text font (Roman, upright). For example:
Line 53 ⟶ 55:
: <math>r = x_{predicted} - x_{observed}</math> &emsp; (''incorrect''—typeset from <code><nowiki><math>r = x_{predicted} - x_{observed}</math></nowiki></code>).
 
Moreover, the TeX engine used on Wikipedia may format simple superscripts using <code><nowiki><sup>...</sup></nowiki></code> depending on user preferences. Thus, instead of the image <math>x^2\,</math>, many users see ''x''<{{sup>|2</sup>}}. Formulae formatted without using TeX should use the same syntax to maintain the same appearance.