You can define macros in MathJax. As far as I can tell, you cannot use numbers in macro names. For example, this defines a macro called \Rsq
which then types $\newcommand{\Rsq}{\mathbb R^2}\Rsq$.
$\newcommand{\Rsq}{\mathbb R^2}$ $\Rsq$
Macros can also use parameters. For example, the macro define below can be used as $\newcommand{\Map}[3]{{#1}\colon{#2}\to{#3}}$ \Map fXY
to get $\Map fXY$ or \Map\phi{[0,1]}{[0,1]}
$\Map\phi{[0,1]}{[0,1]}$.
$\newcommand{\Map}[3]{{#1}\colon{#2}\to{#3}}$
Other commands which can be used to define some "shortcut" are \renewcommand
, \DeclareMathOperator
, \def
and \let
. You can find many examples on the main site, if you search for \newcommand, \renewcommand, \DeclareMathOperator. It might be easier to find examples of \def and examples of \let using SEDE, since the built-in search might return some false positives.
It is recommended to avoid using macros in the title. If you define a macro, it will be available within the post where you defined it.
Syntax is basically the same as in LaTeX, you can find some basics in various places. For example, TeX FAQ, Overleaf, Wikibooks