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$\begingroup$ It's strange that such common operator has no built in command already, but I guess there are too many, related: tex.stackexchange.com/questions/112037/…. Anyway for these it is point 11. in math.meta.stackexchange.com/questions/5020/…. $\endgroup$ – Sil Aug 18 '20 at 8:47
-
$\begingroup$ @Sil I just missed this link because I typed $5040$ instead $5020$. Thank you! $\endgroup$ – Michael Rozenberg Aug 18 '20 at 8:50
\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 '20 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♦ Aug 18 '20 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 '20 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 '20 at 22:01