Message Boards Message Boards

0
|
7520 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How can I implement SyntaxInformation and Option defaults in my packages?

Posted 10 years ago

I have a couple of questions related to usage messages and syntax styling in developed packages. Mathematica has a powerful Code Assist functionality, and the fundamental question is how you should code your packages so your packages behave like native Mathematica functions. To examplify my question:

Plot[Sin[x], {x, 0, 2 \[Pi]}, LabelStyle -> Directive[Bold, Medium]]

When typing the functions, Mathematica automatically provides feedback and help:

Code Assistant

The options displayed are those that are only valid for the Plot function. Similarly, when you have selected a valid options, valid alternatives are suggested by Mathematica:

Valid optional arguments

How can I implement this functionality in my own packages? And the second question, how can I prettify my usage messages to be displayed with mathematical typesetting? Mathematica provides nicely typeset usage messages: Typesetting usage messages

2 Replies

Hi,

I would suggest to have a look at chapter 13.4 of the book Programming with Mathematica by Paul Wellin. It is an excellent book and you will learn how to achieve what you want to do.

You will also find some information here. David Reiss who is a very experienced member of this Community and who produces fantastic posts, has an excellent Tutorial on building packages.

There is also lots of stuff on the auto completion feature on StackExchange.

Hope this helps.

Cheers,

Marco

POSTED BY: Marco Thiel

Thanks Marco. I am already reading Paul Wellin's book and have found some useful tips there. The other links were also very informative, especially the blog on Stackowerflow. Thanks again!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract