# base/root-of-to-sqrt

Rewrite legacy root-of syntax to bracketed sqrt notation.

https://texform.dev/rules/base/root-of-to-sqrt

## Metadata

| Field | Value |
| --- | --- |
| Key | base/root-of-to-sqrt |
| Level | authoring |
| Fidelity | render |
| Enabled by packages | base |
| Profiles | Authoring, Faithful, Corpus, Equiv |

## Rewrite patterns

### degree

From:

```latex
\root #1 \of #2
```

To:

```latex
\sqrt[#1]{#2}
```

### empty-degree

From:

```latex
\root\of #1
```

To:

```latex
\sqrt[]{#1}
```

## Examples

Examples show the rule in isolation, not a complete normalization profile.

### Compound root

Before:

```latex
\root 1+2 \of {x+y}
```

After this rule:

```latex
\sqrt[1+2]{x+y}
```

Packages: base.

Rendering verified with the declared packages.

## Triggers

- [\\root](https://texform.dev/latex/commands/root)

## Eliminates

- [\\root](https://texform.dev/latex/commands/root)

## Produces

- [\\sqrt](https://texform.dev/latex/commands/sqrt)

## Same family

- [ams/cfrac-to-frac](https://texform.dev/rules/ams/cfrac-to-frac): Drop continued-fraction styling from centered AMS cfrac forms.
- [ams/dbinom-and-tbinom-to-binom](https://texform.dev/rules/ams/dbinom-and-tbinom-to-binom): Rewrite AMS display-style and text-style binomial commands to binom.
- [ams/dfrac-to-frac](https://texform.dev/rules/ams/dfrac-to-frac): Rewrite the AMS display-style fraction command to frac.
- [ams/tfrac-to-frac](https://texform.dev/rules/ams/tfrac-to-frac): Rewrite the AMS text-style fraction command to frac.
- [base/above-to-genfrac](https://texform.dev/rules/base/above-to-genfrac): Rewrite above to a thickness-preserving genfrac form.
- [base/abovewithdelims-to-genfrac](https://texform.dev/rules/base/abovewithdelims-to-genfrac): Rewrite abovewithdelims to an explicit genfrac with delimiters and thickness.
- [base/atop-to-genfrac](https://texform.dev/rules/base/atop-to-genfrac): Rewrite infix atop to an explicit no-rule genfrac form.
- [base/atopwithdelims-to-genfrac](https://texform.dev/rules/base/atopwithdelims-to-genfrac): Rewrite atopwithdelims to an explicit delimited no-rule genfrac form.
- [base/brace-to-genfrac](https://texform.dev/rules/base/brace-to-genfrac): Rewrite infix brace to an explicit genfrac with brace delimiters.
- [base/brack-to-genfrac](https://texform.dev/rules/base/brack-to-genfrac): Rewrite infix brack to an explicit genfrac with bracket delimiters.
- [base/choose-to-binom](https://texform.dev/rules/base/choose-to-binom): Rewrite infix choose to an explicit binom command.
- [base/over-to-frac](https://texform.dev/rules/base/over-to-frac): Rewrite infix over to an explicit frac command.
- [base/overwithdelims-to-genfrac](https://texform.dev/rules/base/overwithdelims-to-genfrac): Rewrite overwithdelims to an explicit genfrac with delimiters.
- [base/leftroot-drop](https://texform.dev/rules/base/leftroot-drop): Drop the leftroot index-position hint in cleanup-oriented normalization.
- [base/uproot-drop](https://texform.dev/rules/base/uproot-drop): Drop the uproot index-position hint in cleanup-oriented normalization.

## Notes

Consume the two parser-owned argument slots from root argspec u{\of} m: a mathematical degree terminated by \of, followed by one radicand argument. The degree may be empty or contain unbraced scripts and nested groups. As for a TeX delimited parameter, a degree that is exactly one braced group loses that brace layer at parse time, so \root{1+2}\of x and \root 1+2\of x are the same AST. The \of terminator is ArgumentKind::Until delimiter metadata, not a sibling Command node, so touches is empty. Preserve outer scripts and trailing radicand siblings.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["base/root-of-to-sqrt"])
```

```javascript
new TransformEngine({ profile: 'corpus', disableRules: ['base/root-of-to-sqrt'] })
```

[Open in Playground](https://play.texform.dev/?input=%5Croot+1%2B2+%5Cof+%7Bx%2By%7D)
