User:JeffConrad/SubSup
This template provides a simple means of coding inline mathematical material that has subscripts and superscripts, for display in the same typeface as the surrounding text. The rendering is always done in HTML; this offers an alternative to using the TeX preprocessor via the <math>...</math> tags, which display the material in a serif typeface regardless of the typeface of the running text. Unlike with TeX/HTML rendering, the type size of the subscripts and superscripts is always reduced, in keeping with common practice in mathematics.
Usage
{{User:JeffConrad/SubSup|[<symbol>]|<subscript>[|s=0]}}
{{User:JeffConrad/SubSup|[<symbol>]||<superscript>[|s=0]}}
{{User:JeffConrad/SubSup|[<symbol>]|<subscript>|<superscript>[|s=0]}}
The first argument is assumed to be a quantity symbol, and is set in the oblique (“italic”)[1] font of the typeface for the surrounding text. To have the base symbol in upright font, give the symbol before the template and give a blank first argument.
The subscripts and superscripts are set in upright font, in keeping with normal practice for numerals and descriptive subscripts. To set the superscript or subscript in oblique font, as for a subscript that itself is a variable, use the HTML <var>...</var> or <i>...</i> tags, or the Wikipedia idiom of two apostrophes (''...'').
Note that to get only a superscript, a blank second argument must be given.
By default, a space of approximately 1/6 em is added after the symbol to prevent the oblique symbol from overlapping the upright superscript or subscript. To suppress this spacing, give the optional s=0 parameter (any value other than zero is ignored); the s parameter is ignored if the first argument (for the base symbol) is blank. The s parameter may be given at any point in the argument list; the other arguments must be given in the order shown.
Examples
Subscript only:
{{User:JeffConrad/SubSup|x|a}}gives x a
Subscript only without spacing:
{{User:JeffConrad/SubSup|x|s=0|a}}gives xa
Superscript only:
{{User:JeffConrad/SubSup|x||3}}gives x 3
Subscript and superscript:
{{User:JeffConrad/SubSup|x|a|3}}gives x 3
a
Subscript and superscript with base symbol in upright font:
X{{User:JeffConrad/SubSup||a|3}}gives X3
a
Superscript with variables:
{{User:JeffConrad/SubSup|e||''u'' ln ''a''}}gives e u ln a
Compatibility
The template has been tested under Windows XP SP3 using Firefox 3, Internet Explorer 7, Opera 9.5, and Safari 3.1. Combined subscripts and superscripts do not display properly when zooming the text with Internet Explorer 7.
Notes
- ^ A true italic font is both oblique and cursive, i.e., the type is slanted and the glyphs are different from the upright font, resembling handwriting. This is the case with most serif typefaces. But most sans-serif typefaces simply slant the upright font, so that its “italic” font is properly just oblique. The distinction between oblique and true italic type is commonly ignored, so that “italic” is usually taken to mean simply the oblique font of the primary typeface. This template follows that convention.
See also
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.