How to define a macro in a Jupyter cell?

Hi!

I want to define a macro in a Markdown text cell of a Jupyter notebook. But it seems that we cannot define it.

For example, I want to define a macro which formats vectors. The code in the cell is:

\newcommand{\vect}[1]{{\mathbf{\boldsymbol{{#1}}}}}

This is the vector $\vect{x}$.

The rendering is shows the “newcommand” statement, and I do not want that.

A possible way to define a macro in a Jupyter cell is to put a dollar in front of and after the macro.

$\newcommand{\vect}[1]{{\mathbf{\boldsymbol{{#1}}}}}$
This is the vector $\vect{x}$.

and the rendering is:

image

This is the trick used at Latex macros in Jupyter (iPython) notebook not rendered by github, but the topic is slightly different.

Is this a correct way to solve this?

Best regards,

Michaël

PS