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

Content deleted Content added
Mathematics: rm archaic use of spacing LaTeX codes from examples, now long deprecated
 
(70 intermediate revisions by 35 users not shown)
Line 1:
{{confused|MOS:ORDINAL}}
{{proposed}}
{{MoS guideline|MOS:SUP|MOS:SUB}}
'''[[Subscript and superscript|Superscripts and subscripts]]''' appears smaller than the normal line of type and is set slightly below or above it and have many uses. 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>&lt;sub></code> and <code>&lt;sup></code> tags, respectively, with no other formatting info. 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]] (<code>&amp;sup2;</code>). Rather write <code><nowiki><sup>2</sup></nowiki></code> and <code><nowiki><sup>3</sup></nowiki></code> to produce the superscripts {{xt|<sup>2</sup>}} and {{xt|<sup>3</sup>}}. The superscripted 2 and 3 are easier to read, especially on small displays, and ensure that exponents are properly aligned. Compare:
: {{!xt|wⁱx²y³z⁽ⁿ⁺⁶⁾}} to
: {{xt|w<sup>i</sup>x<sup>2</sup>y<sup>3</sup>z<sup>(n + 6)</sup>}} (<code><nowiki>w<sup>i</sup>x<sup>2</sup>y<sup>3</sup>z<sup>(n + 6)</sup></nowiki></code>)
<br />
: {{!xt|1 + ''x'' + ''x''² + ''x''<sup>3</sup> + ''x''<sup>4</sup>}} (<code>&amp;sup2;</code>) to
: {{xt|1 + ''x'' + ''x''<sup>2</sup> + ''x''<sup>3</sup> + ''x''<sup>4</sup>}} (<code>&lt;sup>2&lt;/sup></code>)
 
'''A [[Subscriptsubscript and superscript|Superscripts'''superscript''' andor subscripts]]'''subscript''']] appearsis smallertext thanthat is positioned slightly above or below the normal line of type. Superscripts and issubscripts setare slightlyoften belowrendered orin abovea itsmaller andfont havesize manythan the adjacent normal usestext. 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.
Font sizes and such should be entrusted to be handled with stylesheets.<!--see discussion on Talk:Template:Sup-->
 
==General guidelines==
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, 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</sup>}}}} and {{xt|<{{sup>|3</sup>}}}}. 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
: {{xt|w<sup>i</sup>x<sup>2</sup>y<sup>3</sup>z<sup>(n + 6)</sup>}} (<code><nowiki>w<sup>i</sup>x<sup>2</sup>y<sup>3</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'' + ''x''² + ''x''<sup>3</sup> + ''xy''<sup>4</sup>³}} (<code>&amp;sup2;</code>) to
: {{xt|1 + ''x'' + ''x''<sup>2</sup> + ''xy''<sup>3</sup> + ''x''<sup>4</sup>}} (<code>&lt;<nowiki><sup>2&lt;</sup></nowiki></code>) or
: {{xt|1 + ''x''{{sup|2}} + ''y''{{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]].
 
==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-[[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)/Music}}
 
* In '''[[figured bass]]''', superscript and subscript may be combined, inby 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 (on 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 Alt+0248.
*For '''inversions'''chord and the '''degree sign''' superscriptqualities and subscript may be done thusinversions: <code><nowiki>vii<sup>o</sup>{{music|dim}}</nowiki></code>, <code><nowiki>I<{{sub>|6</sub>}}</nowiki></code>. This looks like: {{xt|vii<sup>o</sup>{{music|dim}}}}, {{xt|I<{{sub>|6</sub>}}}}.
 
==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</sup>}}}}, {{xt|2&{{nbsp;}}cm{{sup|3}}}}). Use the <code><nowiki><sup>3</nowiki></code> tag or <code><nowiki>{{sup}}</nowiki></code> template rather than the Unicode superscript characters such as {{!xt|²}});. squaredSquared 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 33 ⟶ 54:
Descriptions of:
*'''[[Chemical compound]]s'''
:{{xt|C<sub>2</sub>H<sub>5</sub>OH{{chem2|C2H5OH}}}} using <code><nowiki>C<sub>2</sub>H<sub>5</sub>OH{{chem2|C2H5OH}}</nowiki></code>
*'''[[Isotopes]]'''
:{{xt|{{Nuclide2Nuclide|He|3}}}} using <code>{{tlx|Nuclide2Nuclide|He|3}}</code>
 
===Mathematics===
Line 42 ⟶ 63:
 
* '''[[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:
 
: <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</sup>}}. 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</sup>. Formulae formatted without using TeX should use the same syntax to maintain the same appearance.