I know there is a xml file with language for Mathematica notebook (nb or m files). The link is http://sourceforge.net/apps/mediawiki/notepad-plus/?title=User_Defined_Language_Files

Now I want a xml file to format not the code of nb file but what the user see when he opens the nb file in mathematica.

Any idea before I customize this language???


  • $\begingroup$ 1. Are you saying there is a tradition to put xml content into .nb files? (If so, this is probably offtopic here.) 2. If you want to customize the language could you please send me an email with a short description of changes? (I authored this udf for n++.) $\endgroup$
    – akater
    May 18, 2014 at 16:00
  • $\begingroup$ Actually, I want to put a notebook Mathematica code in MS Word (master degree thesis) but the format is not so good… So I think to import the text of what is showing in nb (what one can read on scree, not the file nb) and get it formatted by NotePad++. I gess the xml file above only formats the nb file content. Any other suggestion? $\endgroup$
    – LeoRon7
    May 18, 2014 at 16:19

1 Answer 1


Just to clarify: you are referring to Notepad++'s User Defined Language as to “xml file”, and your question is whether one can edit the contents of Mathematica notebook visible on screen with tools for editing notebooks themselves (tools like Notepad++ with user defined language).

Yes, it is possible. Actually, it is an important feature of Mathematica's language: what you see in notebook is the same material notebooks themselves are built with.

Two pictures are worth two thousands words:

This is notebook itself (what you don't see on screen) edited in Notepad++:

On the left is Mathematica notebook, on the right is its source inspected in Notepad++

(You may view the image above in a separate tab to enlarge it in case it's shrinked too much.)

Below is an expression from the notebook (what you see on screen) edited in Notepad++:

Editing simple Mathematica expression in Notepad++

NB: Notice, however a small drawback: “n” is printed black in Notepad++, as if it was a standard function. It's actually N that is standard fucntion but Notepad++ does not distinguish upper and lower case (or it does but I failed to find how it's done).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.