5
$\begingroup$

I've got a small collection of Mathematica tools that I'd like to make into a package. One of the nicest features in Mathematica is the ability to right click on any built-in function and just select "Get Help" to see detailed documentation on usage, examples, etc.

How do I achieve this functionality in my custom package, so users can "Get Help" on my functions in the same way?

$\endgroup$
2
  • 2
    $\begingroup$ Does this answer your question? What are the best resources for paclet development? $\endgroup$
    – Domen
    Commented Apr 6 at 15:53
  • $\begingroup$ Unfortunately you need to make it into a paclet and need the documentation to integrate into the Documentation Center. Many years ago I wrote a series of packages to make Documentation Center-compatible pages. In theory, this could all be done on the fly in real time, but you're better off using tools that are designed for this purpose. $\endgroup$
    – b3m2a1
    Commented Apr 11 at 18:06

1 Answer 1

3
+50
$\begingroup$

Very basic form of help.

ClearAll[fu]

fu[x_, y_ : 1] := Total[Divisors[x]^y]

fu::usage = 
  "fu[x] gives sum of divisors of x\nfu[x,y] gives sum of y-th powers \
of divisors of x";

Then using Information[fu] or ?fu or ??fu:

?fu


enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks, this is close, but not quite what I was hoping for. If possible, I'd prefer to have the ability to provide richer documentation (e.g. showing explanations, example usage, output, pictures, etc.) like what is available in the Documentation Center. $\endgroup$
    – smish
    Commented Apr 5 at 19:59
  • $\begingroup$ @smish You can also just make a notebook with the help for your particular function, say, fu and save it as fu.nb then make a custom help function, say, myhelp which when used as myhelp[fu] would open notebook fu.nb when as myhelp[fu2] would open another notebook with help fu2.nb. $\endgroup$ Commented Apr 5 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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