This site is supported by donations to The OEIS Foundation.
Template:^/doc
- For mathematical typesetting, in either HTML+CSS or LaTeX, of superscripts (other than exponents), use the {{sup}} (superscript) mathematical formatting template.
The {{^}} (exponent) mathematical formatting template is used for mathematical typesetting of exponents in either HTML+CSS or LaTeX.
NOTE: Currently, the HTML+CSS exponents get smaller (0.75em
by default) for each nesting level, whereas the LaTeX exponents are \scriptstyle
(first level) and \scriptscriptstyle
(second level and higher).
Contents
Usage
- Text{{^|exponent}} (relative size defaults to
0.75em
; format defaults tohtm
)
- Text{{^|exponent|relative size}} (format defaults to
htm
)
- Text{{^|exponent|exponent|format}} (relative size defaults to
0.75em
forhtm
)
- Text{{^|exponent|exponent|relative size|format}}
where
- the first parameter (exponent) is the exponent 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 to0.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).
<sup>...</sup>
vs. {{^}}
vs. {{sup}}
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.
Typesetting with the {{math}} template: use the {{^}} template only for exponents (not for other superscripts)
The {{^}} template prepends a 1mu space, e.g.
{{math|''n''{{^|2}}, ''n''{{^|''k''}}|&}}
which yields the text style HTML+CSS
-
n 2, n k
{{math|''n''{{^|2|tex}},\, ''n''{{^|''k''|tex}}|$}}
which yields the text style LaTeX
{{math|''n''{{^|2}}, ''n''{{^|''k''}}|&&}}
which yields the display style HTML+CSS
n 2, n k
{{math|''n''{{^|2|tex}}, ''n''{{^|''k''|tex}}|$$}}
which yields the display style LaTeX
Typesetting with the {{math}} template: use the {{sup}} template only for superscripts (other than exponents)
The {{sup}} template DOES NOT prepend a 1mu space, e.g.
{{indent}}{{math|<!-- -->''A'' {{=}} {{matrix| ''a''{{sub|1,1}} && ''a''{{sub|1,2}} \\ ''a''{{sub|2,1}} && ''a''{{sub|2,2}} |( )}}{{sp|4}},{{sp|quad}}<!-- -->''A''{{sup|T}} {{=}} {{matrix| ''a''{{sub|1,1}} && ''a''{{sub|2,1}} \\ ''a''{{sub|1,2}} && ''a''{{sub|2,2}} |( )}} |&&}}
which yields the display style HTML+CSS
A =
|
{{indent}}{{math|<!-- -->''A'' {{=}} {{matrix| ''a''{{sub|1,1|tex}} && ''a''{{sub|1,2|tex}} \\ ''a''{{sub|2,1|tex}} && ''a''{{sub|2,2|tex}} |( )|tex}},{{sp|quad|tex}}<!-- -->''A''{{sup|\mathrm{T}|tex}} {{=}} {{matrix| ''a''{{sub|1,1|tex}} && ''a''{{sub|2,1|tex}} \\ ''a''{{sub|1,2|tex}} && ''a''{{sub|2,2|tex}} |( )|tex}} |$$}}
which yields the display style LaTeX
Tests: Exponents and subscripts
: before {{math|''x''<sup>''n''</sup>, ''x''<sub>''n''</sub>|&}} after
yields the text style HTML+CSS (superscripts and subscripts are too big with the <sup>...</sup>
and <sub>...</sub>
tags)
- before
afterxn, xn
: {{math|''x''<sup>''n''</sup>, ''x''<sub>''n''</sub>|&&}}
yields the display style HTML+CSS (superscripts and subscripts are too big with the <sup>...</sup>
and <sub>...</sub>
tags)
xn, xn
: before {{math|''x''{{^|''n''}}, ''x''{{sub|''n''}}|&}} after
yields the text style HTML+CSS
- before
afterx n, xn
: {{math|''x''{{^|''n''}}, ''x''{{sub|''n''}}|&&}}
yields the display style HTML+CSS
x n, xn
: before {{math|''x''<sup>2</sup>, ''x''<sub>2</sub>|&}} after
yields the text style HTML+CSS (superscripts and subscripts are too big with the <sup>...</sup>
and <sub>...</sub>
tags)
- before
afterx2, x2
: {{math|''x''<sup>2</sup>, ''x''<sub>2</sub>|&&}}
yields the display style HTML+CSS (superscripts and subscripts are too big with the <sup>...</sup>
and <sub>...</sub>
tags)
x2, x2
: before {{math|''x''{{^|2}}, ''x''{{sub|2}}|&}} after
yields the text style HTML+CSS
- before
afterx 2, x2
: {{math|''x''{{^|2}}, ''x''{{sub|2}}|&&}}
yields the display style HTML+CSS
x 2, x2
Examples
Since the {{^}} template assumes that it is preceded by an italicized variable as the base, it inserts a {{sp|1}} (1mu space) as italic correction. For this reason, when the base is a number (not italicized) we want to cancel it out with a {{sp|-1}} (-1mu space) to get appropriate spacing in HTML+CSS (as shown below).
: before {{math|3{{^|2}} + 4{{^|2}} {{=}} 5{{^|2}}|&}} after
yields the text style HTML+CSS
- before
after3 2 + 4 2 = 5 2
: before {{math|3{{sp|-1}}{{^|2}} + 4{{sp|-1}}{{^|2}} {{=}} 5{{sp|-1}}{{^|2}}|&}} after
yields the text style HTML+CSS
- before
after3 2 + 4 2 = 5 2
: before {{math|3{{^|2|tex}} + 4{{^|2|tex}} {{=}} 5{{^|2|tex}}|$}} after
yields the text style LaTeX
- before after
: {{math|3{{^|2}} + 4{{^|2}} {{=}} 5{{^|2}}|&&}}
yields the display style HTML+CSS
3 2 + 4 2 = 5 2
: {{math|3{{sp|-1}}{{^|2}} + 4{{sp|-1}}{{^|2}} {{=}} 5{{sp|-1}}{{^|2}}|&&}}
yields the display style HTML+CSS
3 2 + 4 2 = 5 2
: {{math|3{{^|2|tex}} + 4{{^|2|tex}} {{=}} 5{{^|2|tex}}|$$}}
yields the display style LaTeX
: before {{math|''x''{{^|2}} + ''y''{{^|2}} {{=}} ''r''{{^|2}}|&}} after
yields the text style HTML+CSS
- before
afterx 2 + y 2 = r 2
: before {{math|''x''{{^|2|tex}} + ''y''{{^|2|tex}} {{=}} ''r''{{^|2|tex}}|$}} after
yields the text style LaTeX
- before after
: {{math|''x''{{^|2}} + ''y''{{^|2}} {{=}} ''r''{{^|2}}|&&}}
yields the display style HTML+CSS
x 2 + y 2 = r 2
: {{math|''x''{{^|2|tex}} + ''y''{{^|2|tex}} {{=}} ''r''{{^|2|tex}}|$$}}
yields the display style LaTeX
Examples inside square root
: before {{math|{{sqrt|''x''{{^|2}} + ''y''{{^|2}}}} {{=}} ''r''|&}} after
yields the text style HTML+CSS
- before
after√ x 2 + y 2= r
: before {{math|{{sqrt|''x''{{^|2|tex}} + ''y''{{^|2|tex}}|tex}} {{=}} ''r''|$}} after
yields the text style LaTeX
- before after
: {{math|{{sqrt|''x''{{^|2}}} + ''y''{{^|2}}}}} {{=}} ''r''|&&}}
yields the display style HTML+CSS
- √ x 2 + y 2= r
: {{math|{{sqrt|''x''{{^|2|tex}} + ''y''{{^|2|tex}}|tex}} {{=}} ''r''|$$}}
yields the display style LaTeX
Examples with nested exponents
The following are examples of Knuth’s arrow notation.
NOTE: Currently, the HTML+CSS exponents get smaller (0.75em
by default) for each nesting level, whereas the LaTeX exponents are \scriptstyle
(first level) and \scriptscriptstyle
(second level and higher).
To get the nested HTML+CSS exponents to be the same size for all nesting levels:
- for second level and higher, set the second argument to 1em or 100% (corresponds to
\scriptstyle
).
To get the nested HTML+CSS exponents to behave similarly to LaTeX:
- for second level, set the second argument to 0.8em or 80% (the default 0.75em is too small) (corresponds to
\scriptscriptstyle
); - for third level and higher, set the second argument to 1em or 100% (still corresponds to
\scriptscriptstyle
).
The code
: thus {{math| ''b'' {{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''}};{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''|100%}}}};<!-- -->{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%}}|100%}}}}|&}}, etc. : thus {{math| ''b'' {{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''}};{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''|80%}}}};<!-- -->{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%}}|80%}}}}|&}}, etc.
yields the text style HTML+CSS
- thus
, etc.b ↑ n := b n; b ↑↑ n := b n n; b ↑↑↑ n := b n n n - thus
, etc.b ↑ n := b n; b ↑↑ n := b n n; b ↑↑↑ n := b n n n
The code
: thus {{math| ''b'' {{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''|tex}};{{sp|quad|tex}}''b'' {{-)|uarr|tex}}{{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''{{^|''n''|100%|tex}}|tex}};{{sp|quad|tex}}<!-- -->''b'' {{-)|uarr|tex}}{{-)|uarr|tex}}{{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%|tex}}|100%|tex}}|tex}}|$}}, etc.
yields the text style LaTeX
- thus, etc.
The code
: {{math| ''b'' {{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''}};{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''|100%}}}};<!-- -->{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%}}|100%}}}} |&&}} : {{math| ''b'' {{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''}};{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''|80%}}}};<!-- -->{{sp|quad}}''b'' {{-)|uarr}}{{-)|uarr}}{{-)|uarr}} ''n'' {{sym|def}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%}}|80%}}}} |&&}}
yields the display style HTML+CSS
b ↑ n := b n; b ↑↑ n := b n n; b ↑↑↑ n := b n n n b ↑ n := b n; b ↑↑ n := b n n; b ↑↑↑ n := b n n n
The code
: {{math| ''b'' {{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''|tex}};{{sp|quad|tex}}''b'' {{-)|uarr|tex}}{{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''{{^|''n''|100%|tex}}|tex}};{{sp|quad|tex}}<!-- -->''b'' {{-)|uarr|tex}}{{-)|uarr|tex}}{{-)|uarr|tex}} ''n'' {{sym|def|tex}} ''b''{{^|''n''{{^|''n''{{^|''n''|100%|tex}}|100%|tex}}|tex}} |$$}}
yields the displaystyle LaTeX