How to insert latin accents in Math environment

How could I insert accents inside a math environment?

Something like this is what I would like to work:

\begin{document}
$\frac{covariância(A,B)}{desvio-padrão(A) \times desvio-padrão(B)}$
\end{document}


Currently, it is giving me an compilation error.

• you can place all "text" in \text{} command... like : \frac{\text{covariância}(A,B)}{\text{desvio-padrão}(A) \times \text{desvio-padrão}(B)} or similar – koleygr Apr 11 '18 at 15:29

Here is the full code:

\documentclass{article}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\begin{document}
$\frac{\text{covariância}(A,B)}{\text{desvio-padrão}(A) \times \text{desvio-padrão}(B)}$
\end{document}


Output:

[utf8]inputenc is needed for the accented chars (to be typed directly)

and

amsmath offers the \text{} command

• Depending on what this is going to be used for, \textup  or \textnormal  might be better. Just to ward of the possibility of this being used in italic context, and thus not giving the result the OP was probably expecting. – daleif Apr 11 '18 at 17:34
• @daleif you may write your own answer making clear your point of view and the possible advantages. The op had compilation errors, and possibly had not used inputenc... Your answer may help other people even if the OP will not change the accepted and thus I think you should write it. – koleygr Apr 11 '18 at 17:38
• I don't think it it need to. It is højst better to leave the comment such that s someone later on homes by, uses the solution, gets something they did not expect, this was s probably why. We really need a community question+answer about \text so many people use it in the wrong way, or at least is not aware of its pitfalls – daleif Apr 11 '18 at 17:41
• @daleif... Do it. (the question-answer). You have the knowledge and the idea about it... It is just a matter of some minutes to do it. – koleygr Apr 11 '18 at 17:44