This site is supported by donations to The OEIS Foundation.

Template:Sub

From OeisWiki
Jump to: navigation, search

The {{sub}} (subscript) OEIS Wiki formatting and function template is used for mathematical typesetting of subscripts in either HTML+CSS or LaTeX.

Usage

Text{{sub|subscript}} (relative size defaults to 0.75em, format defaults to htm)
Text{{sub|subscript|relative size}} (format defaults to htm)
Text{{sub|subscript|format}} (relative size defaults to 0.75em for htm)
Text{{sub|subscript|relative size|format}}

where

  • the first parameter (subscript) is the subscript text;
  • the [optional] second parameter (relative size) is relative size in either em units (e.g. 0.75em), or percentage (e.g. 75%) which is automatically converted to em units (100% = 1em) (relative size defaults to 0.75em);

and the [optional] last parameter (format), is from

  • htm: HTML+CSS (default);
  • tex: LaTeX (relative size is ignored, since we’re using LaTeX default behavior).

<sub>...</sub> vs. {{sub}}

With the {{math}} template DO NOT use the <sup>...</sup> and/or <sub>...</sub> tags!

text<sup>superscript</sup>, text<sub>subscript</sub> which yields

textsuperscript, textsubscript

The {{^}}, {{sup}} and {{sub}} templates allow fine tweaking of the typesetting of exponents, superscripts and subscripts (mathematical typesetting with the {{math}} template).

Typesetting mathematics with the {{math}} template:

  • use the {{^}} template for exponents (not for other superscripts).
  • use the {{sup}} template for superscripts (other than exponents);
  • use the {{sub}} template for subscripts.

Subsubscripts

The code : text<sub>subscript</sub> yields

textsubscript

and the code : text<sub>subscript<sub>subsubscript</sub></sub> yields

textsubscriptsubsubscript

whereas the code : text{{sub|subscript{{sub|subsubscript}}}} yields

textsubscriptsubsubscript

and the code : text{{sub|subscript{{sub|subsubscript|1em}}}} yields

textsubscriptsubsubscript

Tests: Exponents and subscripts

The code

: before {{math|''x''<sup>''n''</sup>, ''x''<sub>''n''</sub>|&}} after

yields the text style HTML+CSS

before 
xn, xn
after

The code

: {{math|''x''<sup>''n''</sup>, ''x''<sub>''n''</sub>|&&}}

yields the display style HTML+CSS

xn, xn

The code

: before {{math|''x''{{^|''n''}}, ''x''{{sub|''n''}}|&}} after

yields the text style HTML+CSS

before 
xn, xn
after

The code

: {{math|''x''{{^|''n''}}, ''x''{{sub|''n''}}|&&}}

yields the display style HTML+CSS

xn, xn

The code

: before {{math|''x''<sup>2</sup>, ''x''<sub>2</sub>|&}} after

yields the text style HTML+CSS

before 
x2, x2
after

The code

: {{math|''x''<sup>2</sup>, ''x''<sub>2</sub>|&&}}

yields the display style HTML+CSS

x2, x2

The code

: before {{math|''x''{{^|2}}, ''x''{{sub|2}}|&}} after

yields the text style HTML+CSS

before 
x 2, x2
after

The code

: {{math|''x''{{^|2}}, ''x''{{sub|2}}|&&}}

yields the display style HTML+CSS

x 2, x2

The code

: where {{math|''{{ob|{{Gr|varphi}}}}''{{sp|-2}}{{sub|{{sub|!|80%}}}}(''n'')|tex = \overline{\varphi}_{_{!} }(n)|&}} is the co-phi-torial of {{math|''n''|tex = n|&}}

yields the text style HTML+CSS ( 
x̅φ!(n)
is too high!)
where
x̅φ!(n)
is the co-phi-torial of
n

Examples

Tests for the following templates:

: The On-Line Encyclopedia of Integer Sequences{{sup|®}} (OEIS{{sup|®}}) Wiki yields (at default 75% relative size, the ® is too small):

The On-Line Encyclopedia of Integer Sequences® (OEIS®) Wiki

: The On-Line Encyclopedia of Integer Sequences{{sup|®|100%}} (OEIS{{sup|®|100%}}) Wiki yields (at 100% relative size, the ® is too big):

The On-Line Encyclopedia of Integer Sequences® (OEIS®) Wiki

: The On-Line Encyclopedia of Integer Sequences{{sup|®|87.5%}} (OEIS{{sup|®|87.5%}}) Wiki yields (at 87.5% relative size, the ® seems to be just the right size):

The On-Line Encyclopedia of Integer Sequences® (OEIS®) Wiki

: text{{sub|subscript}} yields

textsubscript

: text{{sub|subscript|75%}} yields

textsubscript

: text{{sub|subscript|100%}} yields

textsubscript

: text{{sup|superscript}} yields

textsuperscript

: text{{sup|superscript|75%}} yields

textsuperscript

: text{{sup|superscript|100%}} yields

textsuperscript

Subscript:

(...)

Superscript:

: before {{math|''f''{{sp|3}}{{sup|5}}{{sp|1}}(''x'') {{=}} ''f''{{sp|3}}({{sp|4}}''f''{{sp|3}}({{sp|4}}''f''{{sp|3}}({{sp|4}}''f''{{sp|3}}({{sp|4}}''f''{{sp|3}}(''x'')))))|&}} after yields the text style HTML+CSS

before 
f5 (x) = f ( f ( f ( f ( f (x)))))
after

: before {{math|f^5 (x) {{=}} f(f(f(f(f(x)))))|$}} after yields the text style LaTeX

before after

Subscript:

: before {{math|''a''{{sub|''n''}}|&}} after yields the text style HTML+CSS

before 
an
after

: before {{math|''a''{{sub|''n''|tex}}|$}} after yields the text style LaTeX

before after

: {{math|''a''{{sub|''n''}}|&&}} yields the display style HTML+CSS

an

: {{math|''a''{{sub|''n''|tex}}|$$}} yields the display style LaTeX

Subscript, then superscript:

: before {{math|''a''{{sub|''n''}}{{sup|2}}|&}} after yields the text style HTML+CSS

before 
an2
after

: before {{math|''a''{{sub|''n''|tex}}{{sup|2|tex}}|$}} after yields the text style LaTeX

before after

: {{math|''a''{{sub|''n''{{sup|2}}}}|&&}} yields the display style HTML+CSS

an2

: {{math|''a''{{sub|''n''{{sup|2|tex}}|tex}}|$$}} yields the display style LaTeX

Superscript, then subscript:

Code snippet taken from: Riemann curvature tensor.

The code

{{indent}}{{math|{{Gr|Gamma}}{{sup|''{{Gr|rho}}''}}{{sub|''{{Gr|sigma}}''{{sp|1}}''{{Gr|nu}}''}}|&&}}

yields the display style HTML+CSS

     
Γρσν

while the code

{{indent}}{{math|{{Gr|Gamma|tex}}{{sup|''{{Gr|rho|tex}}''|tex}}{{sub|''{{Gr|sigma|tex}}'' ''{{Gr|nu|tex}}''|tex}}|$$}}

yields the display style LaTeX

     

while the code

{{indent}}{{math|{ \Gamma^{\rho} }_{\sigma \nu}|$$}}

yields the display style LaTeX

     

Subscript and superscript:

before : {{math|''a''{{subsup|''n''|2}}|&}} after yields the text style HTML+CSS

before 
a2n
after

before : {{math|''a''{{subsup|''n''|2|tex}}|$}} after yields the text style LaTeX

before after

: {{math|''a''{{subsup|''n''|2}}|&&}} yields the display style HTML+CSS

a2n

: {{math|''a''{{subsup|''n''|2|tex}}|$$}} yields the display style LaTeX

Simple mathematical tests and examples

: before {{math|''x''{{sub|2}}|&}} after after yields the text style HTML+CSS

before 
x2
after

: before {{math|''x''{{sub|2|tex}}|$}} after yields the text style LaTeX

before after

: {{math|''x''{{sub|2}}|&&}} yields the display style HTML+CSS

x2

: {{math|''x''{{sub|2|tex}}|$$}} yields the display style LaTeX

: before {{math|2{{^|2}}|&}} after yields the text style HTML+CSS

before 
2 2
after

: before {{math|2{{^|2|tex}}|$}} after yields the text style LaTeX

before after

: {{math|2{{^|2}}|&&}} yields the display style HTML+CSS

2 2

: {{math|2{{^|2|tex}}|$$}} yields the display style LaTeX

: before {{math|''x''{{^|2}}|&}} after yields the text style HTML+CSS

before 
x 2
after

: before {{math|''x''{{^|2|tex}}|$}} after yields the text style LaTeX

before after

: {{math|''x''{{^|2}}|&&}} yields the display style HTML+CSS

x 2

: {{math|''x''{{^|2|tex}}|$$}} yields the display style LaTeX

More mathematical tests and examples

: before {{math|{{sqrt|''x''{{^|2}} + 1}}|&}} after yields the text style HTML+CSS

before 
2  x 2 + 1
after

: before {{math|{{sqrt|''x''{{^|2|tex}} + 1|tex}}|$}} after yields the text style LaTeX

before after

: {{math|{{sqrt|''x''{{^|2}} + 1}}|&&}} yields the display style HTML+CSS

2  x 2 + 1

: {{math|{{sqrt|''x''{{^|2|tex}} + 1|tex}}|$$}} yields the display style LaTeX

: before {{math|{{root|''x''{{^|2}} + ''{{Gr|delta}}''{{^|2}}|3}}|&}} after yields the text style HTML+CSS

before 
3  x 2 + δ 2
after

: before {{math|{{root|''x''{{^|2|tex}} + ''{{Gr|delta|tex}}''{{^|2|tex}}|3|tex}}|$}} after yields the text style LaTeX

before after

: {{math|{{root|''x''{{^|2}} + ''{{Gr|delta}}''{{^|2}}|3}}|&&}} yields the display style HTML+CSS

3  x 2 + δ 2

: {{math|{{root|''x''{{^|2|tex}} + ''{{Gr|delta|tex}}''{{^|2|tex}}|3|tex}}|$$}} yields the display style LaTeX

: before {{math|{{sqrt|2{{^|2}} + 1}}|&}} after yields the text style HTML+CSS

before 
2  2 2 + 1
after

: before {{math|{{sqrt|2{{^|2|tex}} + 1|tex}}|$}} after yields the text style LaTeX

before after

: {{math|{{sqrt|2{{^|2}} + 1}}|&&}} yields the display style HTML+CSS

2  2 2 + 1

: {{math|{{sqrt|2{{^|2|tex}} + 1|tex}}|$$}} yields the display style LaTeX

Nested {{sub}} and/or {{sup}}

: 2{{sub|2{{sub|2{{sub|2{{sub|2}}}}}}}} yields

22222

: 2{{sub|2{{sub|2{{sub|2{{sub|2|75%}}|75%}}|75%}}|75%}} yields

22222

: 2{{sub|2{{sub|2{{sub|2{{sub|2|100%}}|100%}}|100%}}|75%}} yields

22222

: 2{{sub|2{{sub|2{{sub|2{{sub|2|133%}}|75%}}|133%}}|75%}} yields

22222

: 2{{sub|2{{sub|2{{sub|2{{sub|2|100%}}|100%}}|100%}}|100%}} yields

22222

: a{{sub|b{{sub|c{{sub|d{{sub|e|100%}}|100%}}|100%}}|100%}} yields

abcde

: a{{sub|b{{sub|c{{sub|d{{sub|e{{sup|4{{sup|3{{sup|2{{sup|1|100%}}|100%}}|100%}}|100%}}|100%}}|100%}}|100%}}|100%}} yields

abcde4321

: 2{{sup|2{{sup|2{{sup|2{{sup|2}}}}}}}} yields

22222

: 2{{sup|2{{sup|2{{sup|2{{sup|2|75%}}|75%}}|75%}}|75%}} yields

22222

: 2{{sup|2{{sup|2{{sup|2{{sup|2|100%}}|100%}}|100%}}|75%}} yields

22222

: 2{{sup|2{{sup|2{{sup|2{{sup|2|133%}}|75%}}|133%}}|75%}} yields

22222

: 2{{sup|2{{sup|2{{sup|2{{sup|2|100%}}|100%}}|100%}}|100%}} yields

22222

: a{{sup|b{{sup|c{{sup|d{{sup|e|100%}}|100%}}|100%}}|100%}} yields

abcde

: a{{sup|b{{sup|c{{sup|d{{sup|e{{sub|4{{sub|3{{sub|2{{sub|1|100%}}|100%}}|100%}}|100%}}|100%}}|100%}}|100%}}|100%}} yields

abcde4321

Nested {{sub}} and/or {{sup}} and/or {{subsup}} and/or {{supsub}}

: x{{subsup|y{{supsub|b|a}}|z{{sub|c}}}} yields

x zcy b a

: x{{subsup|y{{supsub|b|a|t&t}}|z{{sub|c|100%}}}} yields

x zcy b a

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|t&t}}|''z''{{sub|''c''|100%}}}}|&}} yields

xzcyba

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|tex}}|''z''{{sub|''c''|tex}}|tex}}|$}} yields

: x{{subsup|y{{supsub|b|a}}|z{{sup|d}}}} yields

x zdy b a

: x{{subsup|y{{supsub|b|a|t&t}}|z{{sup|d|100%}}}} yields

x zdy b a

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|t&t}}|''z''{{sup|''d''|100%}}}}|&}} yields

xzdyba

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|tex}}|''z''{{sup|''d''|tex}}|tex}}|$}} yields

: x{{subsup|y{{supsub|b|a}}|z{{supsub|d|c}}}} yields

x z d cy b a

: x{{subsup|y{{supsub|b|a|t&t}}|z{{supsub|d|c|t&t}}}} yields

x z d cy b a

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|t&t}}|''z''{{supsub|''d''|''c''|t&t}}}}|&}} yields

xzdcyba

: {{math|''x''{{subsup|''y''{{supsub|''b''|''a''|tex}}|''z''{{supsub|''d''|''c''|tex}}|tex}}|$}} yields

See also

  • {{^}} (exponent)
  • {{sub}}      (textsubscript)
  • {{sup}}      (textsuperscript)
  • {{sub sup}} or {{subsup}}      (text superscriptsubscript)
  • {{sup sub}} or {{supsub}}      (text superscript subscript)