Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In Mathematica 9.0.1, I want to write a user-defined template for a function that I wrote: myfunc

myfunc::usage = "myfunc[x,y,z] is a function.
                 myfunc[x,y,z,w] is another function."

with the result:

User-defined template for myfunc

As you can see, within the description "myfunc" is (in my opinion) unnecessarily repeated. In fact, templates for built-in functions do not behave that way. For example, look at the template for the Integrate function:

Build-int template for Integrate

The function name "Integrate" is not repeated in the description. How do I tell Mathematica not to repeat the name of the function inside the description?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The built-in function templates displayed by the Input Assistant when Shift+Ctrl+K-ing the symbol name are NOT drawn from either

  • the package file that holds the symbol. Check and edit e.g. Calendar`DaysPlus in $InstallationDirectory\AddOns\Packages\Calendar\Calendar.m. It has one simple usage though the Input Assistant shows two.
  • the usage file: $InstallationDirectory\SystemFiles\Kernel\TextResources\English\Usage.m. It does contain the multiple usage messages for e.g. Calendar`DaysPlus or Integrate, but editing them will only change ?f and Message[f::usage] prints, but not the Input Assistant templates.

The usage messages in Usage.m are probably programmatically created from the same source during initialization that is used to format the templates. This source is in v9 (before, it was FunctionInformation.m):

file = ToFileName[{$InstallationDirectory, "SystemFiles", "Kernel", "TextResources", 
            CurrentValue["Language"]}, "FunctionInformation2.m"]

The file is read when the FrontEnd initializes (at line 376 in GetFEKernelInit.tr):

ToFileName[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources"},

While "FunctionInformation2.m" is compressed, it is easy to create a wrapper that makes it readable. Here I only print the information on System` symbols (and omit package symbols that form the first part of data). Warning: the list is huge, 2871 symbols are printed.

format[list_List] := OpenerView[{list[[1]], Column@{
      "ArgumentsPattern" -> list[[2]],
      "Help" -> If[list[[3]] =!= None, Panel@Column[
          MapThread[Row[{##}, " "] &, {DisplayForm /@ list[[3]], 
            DisplayForm /@ list[[4]]}], Alignment -> Left]],
      "Options" -> If[Length@list > 4, list[[5]], ""],
      "LocalVariables" -> If[Length@list > 5, list[[6]], ""]

data = Uncompress@Get@file;
format /@ Last@Last@data // Column

enter image description here

The structure is: first symbols without options, then symbols with options, then symbols with options and available "LocalVariables" specification. What you are looking for is the list[[4]] part, that lists the textual part of each line of help (while list[[3]] lists the formula part for each line).

Unfortunately, I don't see any easy ways to add custom syntax information/template to "FunctionInformation2.m" in the way you would like it to be. It's a pity WRI does not allow users to manipulate the Input Assistant in a more usable fashion.

share|improve this answer
Thanks for your answer (from 1.5 years ago). Do you know if the situation is any different in v10? –  QuantumDot Aug 6 '14 at 21:53

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.