This site is supported by donations to The OEIS Foundation.

Template:Tfrac

From OeisWiki
Jump to: navigation, search
Note: The {{tfrac}} template is meant to be used within e.g. {{dfrac}}, {{root}}, {{sqrt}}, etc. to get a text style fraction.


The {{tfrac}} (text style fraction) mathematical formatting template and/or mathematical function template gives an HTML+CSS or a LaTeX formatted rational expression and/or the numerical result of the rational expression. The {{tfrac}} template gives a text style fraction, which displays it's numerator and denominator in script style. Compare with the {{dfrac}} template which gives a display style fraction whose numerator and denominator are shown in text style. Finally, the {{frac}} template gives either {{dfrac}} or {{tfrac}} (default).

Usage

{{tfrac|numerator|denominator}}

or

{{tfrac|numerator|denominator|format}}

where format is taken from

  • htm: text style HTML+CSS tiny rational expression (default);
  • HTM: display style HTML+CSS tiny rational expression;
  • tex: text style LaTeX tiny rational expression;
  • TEX: display style LaTeX tiny rational expression;
  • #: numerical result.

As an alternative to using LaTeX rendered as PNG images (with either tex or TEX options), the html or HTML options will render the rational expression as HTML+CSS. You must use the {{tfrac}} template within the {{math}} template, which completes the formatting for mathematical expressions. (Do not use this option inside <math>...</math> tags.)

NOTE: To get rendered LaTeX, you must use the {{math}} template, since you cannot evaluate templates, parser functions or magic words inside <math>...</math> tags.

Minus sign issue

  • Use {{op|-}} for minus sign (instead of -, the hyphen, hyphus or hyphen minus sign {{dash|hyphus}}) in the provided mathematical expression (because the border-top used to make the vinculum of radicals in the {{root}} template turns out to be made out of hyphens -, and we need to convert the {{dash|hyphus}} into proper {{dash|minus}} − signs for the HTML+CSS renderings).
  • The {{op|-}} is replaced by a proper minus sign {{sym|-}} (i.e. {{dash|minus}}) in the {{math}} template for the HTML+CSS renderings (for LaTeX renderings, the {{dash|hyphus}} is properly turned into {{dash|minus}} by the LaTeX software).

Examples

See also: \frac{\pi + 1}{ \tfrac{22}{7} + 1 } on {{frac/doc}}.

\tfrac{22}{7}

: before {{math|{{tfrac|22|7}}|&}} after yields the text style HTML+CSS

before 
22
7
after

: before {{math|{{tfrac|22|7|tex}}|$}} after yields the text style LaTeX

before after

: {{math|{{tfrac|22|7}}|&&}} yields the display style HTML+CSS

22
7

: {{math|{{tfrac|22|7|tex}}|$$}} yields the display style LaTeX

\tfrac{1}{ \sqrt{2} }

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

before 
1
2  2
after

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

before after

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

1
2  2

: {{math|{{tfrac|1|\sqrt{2}|tex}}|$$}} yields the display style LaTeX

See also

  • {{op|/}} (for a simple fraction shown on a single line)
  • {{dfrac}} (display style fraction, with numerator and denominator in text style)
  • {{tfrac}} (text style fraction, with numerator and denominator in script style)
  • {{frac}} (gives either {{dfrac}} or {{tfrac}}; defaults to text style fraction)


  • {{fraction}} (Displays either mixed fractions or simple fractions, though the presentation style is not suitable for mathematics documents!)