# [IPython-dev] newcommand in Markdown cells and nbconver

Darlan Cavalcante Moreira darcamo at gmail.com
Wed Oct 30 00:12:25 EDT 2013

Hi list,

I wonder what is the best way to define newcommand in an IPython
notebook. The documentation says I should define them between dollar
signs, such as
$\newcommand{\Mt}[1]{\mathbf{#1}}$.

This is required so that they are interpreted by mathjax, which works as
expected in the notebook. However, when converting the notebook with
nbconvert to latex this is passed unchanged and latex won't compile the
generated tex.

Is there a better way for this?

In my use case, I have a single cell with many newcommands. It would
work for me if this cell could be ignored by nbconvert. Even better if
nbconvert could add a package such as \usepackage{mymathdefinitions},
since all these commands are in a mymathdefinitions.sty file in the same
folder.

Cheers,
Darlan