We have numerous packages (defined in .m
files) that we maintain and develop in WolframWorkbench (2.0), and in those packages, we use the traditional method of determining which symbols are public by assiging ::usage
messages to them. It's also nice to have at least that much documentation for every public symbol. I've been spending some time reviewing and improving the documentation for these public symbols, and one thing I'd like to be able to do is emulate the formatting that Wolfram uses for its own usage messages, for example:
It's not particularly difficult to make that sort of formatted text in the notebook interface. However, getting that formatted text into a package file in Workbench requires copying the formatted text, pasting it into an input cell, and then copying the resulting string into Workbench:
"\!\(\*RowBox[{\"Binomial\", \"[\", RowBox[{StyleBox[\"n\", \"TI\"], \
\",\", StyleBox[\"m\", \"TI\"]}], \"]\"}]\) gives the binomial \
coefficient \!\(\*RowBox[{\"(\", GridBox[{{StyleBox[\"n\", \"TI\"]}, \
{StyleBox[\"m\", \"TI\"]}}], \")\"}]\). "
The additional copy/paste step is requiried to keep some of the quotes escaped; it goes wrong if you paste directly to Workbench.
Suffice it to say, this is a pain, and editing the resulting string directly is pretty unpleasant. So far the best I've been able to figure out for editing the strings is to do something like this in a notebook file:
CellPrint[Cell[DisplayForm@Binomial::usage, Editable -> True]]
Is there a better way to do this? Just having the arguments in usage strings appear in italics is a big win from a readability standpoint.
UPDATE in respose to @István Zachar's comment: I knew about the "Show Cell Expression" menu item mentioned in the answers to your question, but I didn't realize that you could edit the displayed cell expression. That's less awkward than the CellPrint
approach, at least.
UPDATE the second: The main reason we don't just use autogenerated packages is that we have a setup where "build" an application from packages for deployment on remote machines, and all the packages are in Subversion. Using autogenerated packages with this workflow is very awkward.
Messages.m
isUsage.m
which contains the usage messages for built-in symbols, and may be useful to examine. $\endgroup$