In Mathematica 9, the following usage definition generates the corresponding template (obtained by ctrl+shift+K after typing out myfunction in the front end):

myfunction::usage = "myfunction[{a,b,c},PackageObject[d,e,f]] returns the result of processing {a,b,c} with packageobject[d,e,f].";

version 9.0.1 template

In Mathematica 8, 10, and 11, the same usage yields a template in which a placeholder appears for PackageObject.

version 8, 10, 11 template

What do I need to do on versions 8, 10 and 11 so that the template for myfunction looks like that in Mathematica 9?


I discovered that in Mathematica 10 and above, usage messages with built-in symbols actually behave as intended. Observe:

yourFunction::usage = "yourFunction[Cos[x],Sin[x],expr] replaces expr with its trigonometric counterpart."

enter image description here

The symbols Cos and Sin are correctly displayed, and do not appear as placeholders.

Edit #2

And then I found that if you first create the symbol in the System` context like this,


then the template is created as intended:

enter image description here

I think I'm getting close to the answer. Apparently, the template creation system is looking for symbols in the System` context. Is there any way to modify this behavior???

  • 2
    $\begingroup$ You can try to write to the support. $\endgroup$ – Kuba Sep 27 '16 at 6:28

The V9 behavior is technically buggy, although it is perhaps worth revisting.

One solution to your problem is to explictly include the context in the usage. For example:


It has the downside of not looking as pretty (either in the template or when inserted), but it (a) solves the problem of the bad Placeholder insertion, and (b) ensures that the symbol will always be created in the correct context.

If you really want to solve this, you can poke around the FE context, in particular the function insertTagBox which inserts the actual place holders. As usual, this unsupported, may eat your homework, and may break in a future release.

  • 2
    $\begingroup$ Thank you for your tips! After playing around with the FE` context, I found that if I set FE`systemQ[FE`s_] := StringMatchQ[Quiet[Check[Context[FE`s], ""]], "System`" | "myContext`"], then I get exactly the behavior I need. $\endgroup$ – QuantumDot Jul 25 '17 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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