# How to create 'help' ? for a function (as documentation)

I have defined a function `PassVeltB` in some complicated way. But now I would like to add a little documentation that gives the user information on how it is to be used.

I know that the `?` symbol could be placed before a built-in function to generate useful information about that built-in function. Is there a way I can add helpful information about my `PassVeltB` function in a similar way?

-

## 2 Answers

You can include usage info using the `::usage` tag as follows

````foo::usage = "foo[x] takes one argument and returns nothing"
````

Using `Information[foo]` or `?foo` will display the string in the above message

````?foo
(* "foo[x] takes one argument and returns nothing" *)
````

In addition, in version 8 (and some older versions), using CmdShiftK will complete the template if you start the usage message with `foo[x] ...`. Unfortunately, this doesn't work in version 9.

-

The simplest way for a short documentation is by adding a usage to a function, as described in the other answer above.

For a more in depth documentation (as in the Mathematica help) you can use Wolfram Workbench, a tutorial can be found there
http://www.wolfram.co.uk/products/workbench/.

Alternatively you can have a look at this answer.
http://stackoverflow.com/questions/6574710/integrating-notebooks-to-mathematicas-documentation-center

-

1
it might be the best way, but for sure not the simplest. – Yves Klett Jan 3 at 8:51
Yes I agree, I modified my answer accordingly. – Faysal Aberkane Jan 3 at 10:10
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.842789888381958, "perplexity_flag": "middle"}