That does not compile under LaTeX. This compiles under LaTeX:
\documentclass{article}
\usepackage{amsmath,color,relsize}
\begin{document}
\(\left.x\right|_{x\gets\colorbox{yellow}{\(\mathsmaller{+2+h}\)}}\)
\end{document}
The relevant point is that the commands \colorbox
and \mathsmaller
come from the packages color
and relsize
, respectively.
The \colorbox
command is supported by MathJax because the color
package has been implemented for MathJax, but you must use \require{color}
, which is MathJax's method of loading a package.
The relsize
package has not (currently) been implemented for MathJax, so that even writing \require{relsize}
will not help, there is no way to use the \mathsmaller
command.
The best you can do is something like
$$ \require{color} \left.x\right|_{x\gets\colorbox{yellow}{$+2+h$}} $$
which produces
$$ \require{color} \left.x\right|_{x\gets\colorbox{yellow}{$+2+h$}} $$