9

Has anyone come across a tutorial to create documentation for functions you create in Mathematica? I'm trying to organize some functions that I have written but so far I'm doing a terrible job. I would really like to have a file explicitly for the functions and one for the documentation and somehow add a path to the Mathematica documentation so that Mathematica can also search for it.

Take the documentation for the Sin function for instance:

doc

When you click on the arrows it opens a notebook with information on the Sin function. I tried copying the contents of that notebook and pasting in a fresh notebook so that I can edit it but I can't modify the contents.

I really like Mathematica's format for the documentation and I would like to document my functions in the same way for future reference. Does any one know how to document functions the same way Mathematica does?

jmlopez
  • 4,853
  • 4
  • 40
  • 74
  • 2
    Documentation pages that are fully integrated into Mathematica Help may be created using `Workbench`. There is a nice screencast tutorial (by Adam Berry) available [here](http://www.wolfram.com/broadcast/screencasts/workbench/documentation/). Other Workbench screencast tutorials are available [here](http://www.wolfram.com/products/workbench/videos/) – 681234 Jun 29 '11 at 08:20
  • 1
    I think this question is partially relevant: "[Convenient way to add inline formatting to usage Messages](http://stackoverflow.com/questions/6419830/convenient-way-to-add-inline-formatting-to-usage-messages)". – Alexey Popkov Jun 29 '11 at 13:53
  • @Alexey, I think what you posted there is pretty relevant. I am trying to write some C functions and I would like to be able to format the usage tag. I'm really wondering how to put a Hyperlink in the messages too. I was thinking about `Workbench` after reading all the answers but I really don't feel like filling out another form with Wolfram just to download it. – jmlopez Jun 29 '11 at 16:50
  • 1
    @jmlopez It is as easy to embed a hyperlink into a string as any other in-line formatting (boxes). Try for example: `"Here is embedded hyperlink: "<>ToString[Hyperlink["Wolfram Research, Inc.", "http://www.wolfram.com"],StandardForm]`. – Alexey Popkov Jun 30 '11 at 07:34
  • @Alexey, thanks, that clears my questions on hyperlinks. Silly question now. How do you style the `>>` so that they look like the ones in the screenshot I posted? – jmlopez Jun 30 '11 at 07:55
  • @jmlopez You can easily find yourself that it is `Style["\[RightSkeleton]", "SR"]` by pressing Ctrl+Shift+E when the output Cell showed in your screenshot is selected. – Alexey Popkov Jun 30 '11 at 08:01
  • Very nice. I should probably look for a list of shortcuts. – jmlopez Jun 30 '11 at 08:09
  • @Alexey, would you happen to know a shortcut to make a cell editable? If you copy and paste some portion of a documentation you cannot edit it. But if you right click its cell you can change its properties. Then go to Editing Options and change Editable from False to True and viola. You can edit it. – jmlopez Jul 01 '11 at 09:10
  • @jmlopez Such shortcut is not defined in the default installation of *Mathematica*. But you can define it yourself by careful editing of the `KeyEventTranslations.tr` file: see [this](http://stackoverflow.com/questions/4209405/), [this](http://stackoverflow.com/questions/5604837/) and [this](http://stackoverflow.com/questions/4912754/) threads. – Alexey Popkov Jul 01 '11 at 13:17
  • 1
    @Alexey, awesome. I may not need to use a shorcuts to change the options. Your links lead me to this: `FrontEndExecute[FrontEndToken["EditStyleDefinitions"]]`. Same as going to `Format->EditStyleSheet`. Then enter the name of the Style you want to edit. For instance, you can modify the default behaviour or `Usage` and `ObjectName`. When you enter those names a cell will appear there then go to `Format->ObjectOptions` and make them editable. Now when you copy and paste things from the documentation you'll be able to edit them. – jmlopez Jul 01 '11 at 18:04

3 Answers3

7

You can use Mathematica's workbench to create documentation.

The videos here are also good in order to start using Wolfram Workbench.

Ken White
  • 123,280
  • 14
  • 225
  • 444
Sjoerd C. de Vries
  • 16,122
  • 3
  • 42
  • 94
6

Perhaps this or this will be useful.

acl
  • 6,490
  • 1
  • 27
  • 33
1

I think you're looking for ::usage. Have a look at tutorial/DocumentationConstructs in the Documentation Center.

Ron
  • 133
  • 5
  • 2
    I have used ::usage to get a short description. But what I'm really interested in is how to build the whole documentation page. In that way I will be able to write more information and examples about the functions just like they do with the rest of the Mathematica functions. – jmlopez Jun 29 '11 at 05:47
  • I'm looking for how to document a function I write. Why this doesn't meet question guidelines is beyond me? Sometimes the moderators act like someone is born knowing all of Mathematica. – cybervigilante Oct 19 '22 at 20:08