This site is supported by donations to The OEIS Foundation.

# Template:Sqrt

For root expressions with any root index (other than the invisible root index 2), use the {{root}} template.

The {{sqrt}} mathematical formatting template and/or mathematical function template is used either to typeset a square root expression (in either HTML+CSS or LaTeX) or to obtain the numerical result of a numerical square root expression which evaluates to a real number.

## Usage

or

where format is taken from:

• htm: HTML+CSS markup for text style square root expression (default);
• HTM: HTML+CSS markup for display style square root expression;
• tex or TEX: LaTeX markup for (text style or display style automatically taken care of by LaTeX) square root expression;
• #: numerical result (of a numerical square root expression which evaluates to a real number).

NOTE: You must use the {{sqrt}} template within the {{math}} template, which completes the formatting for mathematical expressions. (You cannot use the {{sqrt}} template inside $...</math> tags.) NOTE: To get rendered LaTeX, you must use the {{math}} template, since you cannot evaluate templates, parser functions or magic words inside [itex]...$ tags.

## Examples

The code

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{sqrt|169}} {{=}} {{sqrt|169|#}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}


yields the text style HTML+CSS

before
 2√  169 = 13
after

The code

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{sqrt|169|tex}} {{=}} {{sqrt|169|#}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}  yields the text style LaTeX yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda before${\displaystyle \textstyle {{\sqrt {169}}=13}}$ after yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda The code : {{math|{{sqrt|169}} {{=}} {{sqrt|169|#}}|&&}} yields the display style HTML+CSS  2√ 169 = 13. The code : {{math|{{sqrt|169|tex}} {{=}} {{sqrt|169|#}}|$$}} yields the display style LaTeX ${\displaystyle {\begin{array}{l}\displaystyle {{\sqrt {169}}=13.}\end{array}}}$ ### Root of a rational expression The code : {{math|{{sqrt|{{tfrac|''x'' {{op|+}} ''y''|''x'' {{op|-}} ''y''}}|HTM}}|&&}} yields the display style HTML+CSS 2  x + y x − y The code : {{math|{{sqrt|{{tfrac|''x'' {{op|+}} ''y''|''x'' {{op|-}} ''y''|tex}}|TEX}}|$$}} yields the display style LaTeX ${\displaystyle {\begin{array}{l}\displaystyle {\sqrt {\tfrac {x+y}{x-y}}}\end{array}}}$ ### Roots in a rational expression The code : {{math|{{frac|''x'' {{op|+}} {{sqrt|''x'' {{op|+}} ''y''}}|''x'' {{op|-}} {{sqrt|''x'' {{op|-}} ''y''}}|HTM}}|&&}} yields the display style HTML+CSS  x + 2√ x + y x − 2√ x − y The code : {{math|{{frac|''x'' {{op|+}} {{sqrt|''x'' {{op|+}} ''y''|tex}}|''x'' {{op|-}} {{sqrt|''x'' {{op|-}} ''y''|tex}}|TEX}}|$\$}} yields the display style LaTeX

${\displaystyle {\begin{array}{l}\displaystyle {\frac {x+{\sqrt {x+y}}}{x-{\sqrt {x-y}}}}\end{array}}}$

## Code

{{root|{{{1|}}}|{{{2|}}}}}