I'm writing an own package with Mathematica, that I would like to make available for others. In order to do that (and for my own usage of the package), I would like to write ::usage
-strings for all my public functions.
I would like to use a formated string for ::usage
in order to refer to some mathematical background in the explanations, e.g. if one of the inputs is a matrix, the ::usage
may contain $\mathbf{M}\in\mathbb Z^{d\times d}$ or something like that.
The way I'm generating these up to now is, to take a cell and change it's style to text, then write the text and copy it into the ::usage="..."
cell of the package. On saving the package, that gets transformed into the classic commands, like in the following example:
DirichletKernel::usage = "DirichletKernel[\!\(\*StyleBox[\"mM\",\nFontWeight->\"Bold\"]\)]
provides a dirichlet kernel with respect to the regular integral matrix mM
in Fourier coefficients. The same options as for the function \!\(\*
StyleBox[\"deLaValleePoussinKernel\", \"Code\"]\)\!\(\*
StyleBox[\"[\", \"Code\"]\)\!\(\*StyleBox[\"]\", \"Code\"]\) apply.";
Where the last part at least seems a little messed up.
There are two questions arising:
1) Is there an easier way to write such a usage message? because if I want to change something, I usually have to write the whole text again, because the format is quite verbose. What workflow do you use to write ::usage
messages?
2) Sometimes the copy&paste stuff generates errors (hmpf, if you want to demonstrate something, of course, it works, I'll edit this, if I can get the actual message), that occur in the message window. Since Mathematica 9 that already happens if the autocomplete-box occurs. So what has to be taken into account copying formated cells (text with math formula and e.g. bold face and code parts) into strings - in order to not get messed up (erroneous) strings?
DirichletKernel[]
at least, the reason is, that Dirichlet is a personal name, so i would always tend to write that upper case; where for example for de La Vallée Poussin it's mere chance, that that's not starting upper case...; for my other functions you're right, i should rework some. $\endgroup$IntegerSmithForm
. I don't know, which would be better Mathematica Programming Practice... $\endgroup$?
etc. $\endgroup$