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"},
"GetFEKernelInit.tr"]
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
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.