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

Content deleted Content added
Replaced html markup with standard WP templates; Copyedit;
Mathematics: rm archaic use of spacing LaTeX codes from examples, now long deprecated
 
(64 intermediate revisions by 31 users not shown)
Line 1:
{{confused|MOS:ORDINAL}}
{{shortcut|WP:SUPSCRIPT|WP:SUBSCRIPT}}
{{MoS guideline|MOS:SUP|MOS:SUB}}
{{proposed}}
A '''[[subscript and superscript]]''' is text that is positioned slightly below or above the normal line of type and is sometimes rendered in a smaller font. 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.
 
{{Style}}
Subscripts and superscripts should be wrapped in <code><nowiki><sub></nowiki></code> and <code><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]] {{!xt|²}} and {{!xt|³}}, 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 {{xt|{{sup|2}}}} and {{xt|{{sup|3}}}}. The superscripted 2 and 3 are easier to read, especially on small displays, and ensure that exponents are properly aligned. Compare:
 
: {{!xt|wⁱx²z⁽ⁿ⁺⁶⁾}} (Unicode superscripts) to
A '''[[subscript and superscript]]|'''superscript''' or '''subscript''']] is text that is positioned slightly belowabove or abovebelow the normal line of type. Superscripts and issubscripts are sometimesoften rendered in a smaller font size than the adjacent normal text. 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.
 
==General guidelines==
Subscripts and superscripts should be wrapped in <code><nowiki><sub></nowiki></code> and <code><nowiki><sup></nowiki></code> [[HTML]] tags, respectively, with no other formatting info, with some exceptions (see [[#Exceptions|below]]). The {{tlx|sup}} and {{tlx|sub}} templates are useful shortcuts to the HTML markup. Do not use the [[Unicode subscripts and superscripts]] {{!xt|²}} and {{!xt|³}}, 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 {{xt|{{sup|2}}}} and {{xt|{{sup|3}}}}. The superscripted 2 and 3 are easier to read, especially on small displays, and ensure that exponents are properly aligned. Compare:
: {{!xt|wⁱx²z⁽ⁿ⁺⁶⁾z⁽ⁿ ⁺ ⁶⁾}} (Unicode superscripts) to
: {{xt|w<sup>i</sup>x<sup>2</sup>z<sup>(n + 6)</sup>}} (<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}}
: {{!xt|1 + ''x''² + ''y''³}} (<code>&amp;sup2;</code>) to
: {{xt|1 + ''x''<sup>2</sup> + ''xy''<sup>3</sup>}} (<code><nowiki><sup>2</sup></nowiki></code>) or
: {{xt|1 + ''x''{{sup|2}} + ''xy''{{sup|3}}}} (<code><nowiki>{{sup|2}}</nowiki></code>)
 
These guidelines also apply in citations and template parameters; templates are responsible for cleaning up markup if needed for external consumption, e.g. for [[COinS]].
Except under extraordinary circumstances, font sizes, color, etc should be controlled with Wikipedia's stylesheets.
 
==Exceptions==
===Phonetic transcriptions===
<!-- Discussed with participants at [[Wikipedia talk:Manual of Style/Pronunciation]] -->
Phonetic transcriptions in the [[International Phonetic Alphabet]] and [[Uralic Phonetic Alphabet]] (which are most often inside {{tl|IPA}}, {{tl|IPA link}}, {{tl|UPA}}, and related templates) should use [[Unicode subscripts and superscripts]]. This follows the recommendation of the [[International Phonetic Association]]<ref>{{cite book|last=Esling|first=John|author-link=John Esling|year=1999|chapter=Appendix 2: Computer coding of IPA symbols|editor=International Phonetic Association|title=Handbook of the International Phonetic Association: A Guide to the Use of the International Phonetic Alphabet|pages=161–185|publisher=Cambridge University Press|isbn=0-521-63751-1}}</ref> and is done by the tools, help pages, and articles referenced in [[Wikipedia:Manual of Style/Pronunciation]]. Tone should usually be marked with diacritics or IPA tone symbols, according to [[Wikipedia:Manual of Style/Pronunciation#Tone]]. Use {{tl|Needs IPA}} for any non-compliant articles.
 
===Orthographies===
Superscript and subscript symbols in [[orthographies]] of languages, such as in the [[Proto-Indo-European language]], some [[Salishan languages]], and the [[Wade–Giles]] romanization of Mandarin, should use Unicode subscripts and superscripts.
 
===Titles===
Another exception is where Unicode superscripts and subscripts are used is in the ''title'' of articles, though this is only rarely necessary. See {{section link|Wikipedia:Manual of Style/Titles|Typographic effects}}.
 
===Short descriptions===
Per [[WP:SDFORMAT]], {{tl|short description}} cannot use HTML or wikitext formatting, leaving Unicode characters as the only option for superscripts and subscripts.
 
==Dates and numbers==
{{main|Wikipedia:Manual of Style (dates and numbers)}}
* 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>}}). (Exception: Non-English languages; see [[MOS:ORDINAL]].)
* '''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 alsoper [[WikipediaMOS:Manual of Style#Numbers as figures or wordsCENTURY]]).
* '''Non-[[radix|base]]-10 notations''' in non-computer-related articles use subscript notation. For example: {{xt|137{{sub|9}}}}, {{xt|241{{sub|6}}}}, {{xt|2A9{{sub|12}}}}, {{xt|A87D{{sub|16}}}} (use <code><nowiki>{{sub|radix}}</nowiki></code> or <code><nowiki><sub>radix</sub></nowiki></code>).
 
==Music==
{{main|Wikipedia:Manual of Style (music)/Music}}
 
* In '''[[figured bass]]''', superscript and subscript may be combined by using math markup or by using the {{tlx|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]]).
*For [[diminished chord]]s and half-diminished chords: <code><nowiki>{{music|dim}}</nowiki></code> and <code><nowiki>{{music|halfdim}}</nowiki></code>.
*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 by keying {{key press|[[Alt key|Alt]]|0}}{{key press|1}}{{key press|7}}{{key press|6}} (Windows PCs). A superscript lower case "{{sup|o}}" (<code><nowiki>{{sup|o}}</nowiki></code>) may be used instead. The slashed o, "{{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 key|Alt]]|0}}{{key press|2}}{{key press|4}}{{key press|8}} (Windows PCs).
*For '''inversions'''chord and the '''degree sign''' superscriptqualities and subscript may be done thusinversions: <code><nowiki>vii{{supmusic|odim}}</nowiki></code>, <code><nowiki>I{{sub|6}}</nowiki></code>. This looks like: {{xt|vii{{supmusic|odim}}}}, {{xt|I{{sub|6}}}}.
 
==Unit symbols and abbreviations ==
{{main|Wikipedia:Manual of Style (dates and numbers)#Unit names and symbols}}
* '''SquaredPowers andof cubicunit metric-symbols''' such as squares and cubes are always expressed with a superscript exponent ({{xt|5{{nbsp}}km{{sup|2}}}}, {{xt|2{{nbsp}}cm{{sup|3}}}});. squaredUse the <code><nowiki><sup></nowiki></code> tag or <code><nowiki>{{sup}}</nowiki></code> template rather than the Unicode superscript characters such as {{!xt|²}}. 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 36 ⟶ 54:
Descriptions of:
*'''[[Chemical compound]]s'''
:{{xt|C{{subchem2|2C2H5OH}}H{{sub|5}}OH}} using <code><nowiki>C{{sub|2}}H{{subchem2|5C2H5OH}}OH</nowiki></code>
*'''[[Isotopes]]'''
:{{xt|{{Nuclide2Nuclide|He|3}}}} using <code>{{tlx|Nuclide2Nuclide|He|3}}</code>
 
===Mathematics===
Line 45 ⟶ 63:
 
* '''[[Exponentiation]]''' is indicated using a superscript:
:{{xt|2{{sup|2}} &#61;{{=}} 4}} using <code><nowiki>2{{sup|2}} = 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:
 
: <math> x_\text{this one} = y_\text{that one} \,\!</math> &emsp; (correct—typeset from <code><nowikisyntaxhighlight lang="tex" inline><math> x_\text{this one} = y_\text{that one} \,\!</math></nowiki></codesyntaxhighlight>),
and
: <math>\sum_{i=1}^n { {y_i}^2 }\!</math> &emsp; (correct—typeset from <code><nowikisyntaxhighlight lang="tex" inline><math>\sum_{i=1}^n { {y_i}^2 }\!</math></nowiki></codesyntaxhighlight>),
but not
: <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><{{tag|sup>...</sup></nowiki></code>}} depending on user preferences. Thus, instead of the image <math>x^2\,</math>, many users see ''x''{{sup|2}}. Formulae formatted without using TeX should use the same syntax to maintain the same appearance.
 
==Notes==
{{reflist}}
 
== See also ==
* This guideline was implemented per [[Special:Permalink/1297089060#Superscript and subscript typography guideline|an RfC discussion]] at [[Wikipedia:Village pump (proposals)]].
 
[[Category:Wikipedia Manual of Style (formatting)|Superscripts and subscripts]]
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}}. Formulae formatted without using TeX should use the same syntax to maintain the same appearance.