1

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
0

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:

enter image description here

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

and

amsmath offers the \text{} command

  • 1
    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
  • 1
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.