# How do I write words inside a square root without the words getting italicized?

I wrote $\sqrt{n^{\frac{number of factors of n}{2}}}$ but the "number of factors of n" is getting italicized. Can someone help with this please? Thank you

• With use of the amsmath package, you can just type $\sqrt{n^{\frac{\text{number of factors of } n}{2}}}$. Commented Mar 4, 2022 at 20:37
• Welcome to TeX.SE.
– Mico
Commented Mar 4, 2022 at 21:20

I'd avoid text like that in formulas. Anyway, here are three realizations, in the order “ugly-bad-good”.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

A not very nice formula that's rather difficult to read
$\sqrt{n^{\frac{\textup{number of factors of n}}{2}}}$
Let's try to improve it by using a slashed fraction
$\sqrt{n^{(\textup{number of factors of n})/2}}$
but really you should define $d(n), ν(n), τ(n) or σ_0(n)$ to be the number of factors of $n$
$\sqrt{n^{σ_0(n)/2}}=\sqrt[4]{n^{σ_0(n)}}$

\end{document}


• What's the difference between \textup and \text ?
– MaxD
Commented Mar 5, 2022 at 15:54
• Not to mention that "where n is..." avoids putting a period inside a displayed equation. Commented Mar 5, 2022 at 17:16

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
$\sqrt{n^{\frac{\text{number of factors of } n}{2}}}$
\end{document}

• It is more semantic to use $\sqrt{ n^{ \frac{ \text{number of factors of$n$} }{2} } }$. Commented Mar 4, 2022 at 20:54
• You're right. Either way, I'd never do that kind of thing in a document, it was just to give a possible solution. Commented Mar 4, 2022 at 22:31

And without any package:

\documentclass[12pt]{article}
\begin{document}
$\sqrt{n^{\frac{\mbox{\tiny number of factors of } n}{2}}}$
\end{document}


or

\documentclass[12pt]{article}
\begin{document}
$\sqrt{n^{\frac{\mathrm{number~of~factors~of~}n}{2}}}$
\end{document}