There is $\gcd(a,b)$, written as $\gcd(a,b)$. How I can write lcm(a,b), the command $\lcm(a,b)$ gives an error.


1 Answer 1


\operatorname{lcm} or if you use it a lot in a given answer, \DeclareMathOperator{\lcm}{lcm} will make the \lcm command available, but only for that answer.

  • 1
    $\begingroup$ I've seen also $\newcommand{\lcm}{\operatorname{lcm}}$ for the same functionality. $\endgroup$
    – Sil
    Aug 18, 2020 at 8:51
  • $\begingroup$ We can also talk about \newcommand{\lcm}{\mathop{\mathrm{lcm}}} if you want to start listing all the equivalent ways of doing that... :-) $\endgroup$
    – Asaf Karagila Mod
    Aug 18, 2020 at 9:10
  • 1
    $\begingroup$ Not really, I am sure someone has already did that somewhere (I wonder if they included \text{lcm} there? I wouldn't recommend that one) $\endgroup$
    – Sil
    Aug 18, 2020 at 9:15
  • $\begingroup$ @Sil I'm agree with you. But if you use \text in many cases it is necessary a bit of the space. $\endgroup$
    – Sebastiano
    Aug 20, 2020 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .