Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I use the ::usage tag to allow the Mathematica v9 front end to know that there are multiple ways to call an overloaded function (a function that can have different number of arguments?

For example, if I sequentially run the two commands

myfunc::usage = "foo[x,y,z] will combine x, y and z for you.";
myfunc::usage = "foo[x,y,z,w] will be even better.";

The second line has overwritten the first and the front end doesn't know about both cases. A built-in example of what I'm talking about is Table which the front-end recognizes as having many different templates.

share|improve this question
up vote 16 down vote accepted

As of Mathematica 9, multiple autocomplete templates are supported and the different templates are delimited by newlines. So for your example, you'll need to define them as:

myfunc::usage = "foo[x,y,z] will combine x, y and z for you.

foo[x,y,z,w] will be even better.";

enter image description here

share|improve this answer
Thanks! But, I am now trying to add a third template, and adding yet another line seems not to work. Does having three templates work for you? – QuantumDot Feb 19 '13 at 3:49
@QuantumDot Yes it works, but only if it was defined that way initially. If you want to add a new definition, it looks like you'll have to Remove the symbol first (ClearAll doesn't suffice, even though the message definitions are cleared). My guess is that since the template completion is handled by the FrontEnd, it loads this when the function is first defined and remembers it forever and is unaware of later changes to the symbol in the kernel. – R. M. Feb 19 '13 at 4:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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