0

I am trying to use \newcommand for \mathrm{Cov} but in my output I am not getting the symbol for Covariance as I wanted.

My LaTeX code:

$\newcommand{\Cov}{\mathrm{Cov}}$
\begin{align*}
   A\Cov(X_1,Y)_{i,j} + B\Cov(X_2,Y)_{i,j} = 
\end{align*}
3
  • 1
    Welcome! Please, make a complete example from \documentclass to \end{document}. But if this is specific for MathJax or similar, you should state it explicitly (and it would be mostly off-topic). Anyway, \DeclareMathOperator{\Cov}{Cov} works also in MathJax. – egreg Nov 2 '20 at 22:27
  • 3
    Your command is inside a math group, so its definition is lost when the math group ends. Put it outside the $...$ – Phelype Oleinik Nov 2 '20 at 22:29
  • As egreg mentions your should use DeclareMathOpetator, in the preamble. Using just mathrm like this gives you the wrong spacing on Cov. We might as well build the spacing into the macro now that we can. Var and friends are defined similarly – daleif Nov 3 '20 at 5:29

Your Answer

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

Browse other questions tagged or ask your own question.