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

Darlan Cavalcante Moreira darcamo at gmail.com
Wed Oct 30 16:51:34 EDT 2013

Thanks Matthias,

I'll have a look on custom templates and the preprocessor. Although it
would be nice to have the ability to tag cells for various purposes
(such as "ignore during export", "only/not on Latex/HTML export", etc).

Darlan

bussonniermatthias at gmail.com writes:

> You can use a raw cell that will be passed untouched by nbconvert to tex. The ability to exclude can be done using custom templates and preprocessor right now, but is still a little involved.
>
> Envoyé de mon iPhone
>
>> Le 30 oct. 2013 à 05:12, Darlan Cavalcante Moreira <darcamo at gmail.com> a écrit :
>>
>>
>> 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
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

--
Darlan Cavalcante Moreira
darcamo at gmail.com