This site is supported by donations to The OEIS Foundation.

# Template:Tfrac

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 $...$ tags.)

NOTE: To get rendered LaTeX, you must use the {{math}} template, since you cannot evaluate templates, parser functions or magic words inside $...$ 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

### \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${\displaystyle \textstyle {\tfrac {22}{7}}}$ after

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

 22 7

: {{math|{{tfrac|22|7|tex}}|$$}} yields the display style LaTeX ${\displaystyle {\begin{array}{l}\displaystyle {\tfrac {22}{7}}\end{array}}}$ ### \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${\displaystyle \textstyle {\tfrac {1}{\sqrt {2}}}}$ 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

${\displaystyle {\begin{array}{l}\displaystyle {\tfrac {1}{\sqrt {2}}}\end{array}}}$