Editing Help text style guide
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
Functions should have help text so that people know how to use it. | |||
= Guidelines = | |||
== First sentence == | |||
The first sentence of help text should start with a statement that is like a command. For example, the first sentence of {{Codeline|hist}}: | The first sentence of help text should start with a statement that is like a command. For example, the first sentence of {{Codeline|hist}}: | ||
<pre> | <pre> | ||
Line 22: | Line 10: | ||
</pre> | </pre> | ||
== Manual reference == | |||
When submitting a function to Octave, a tag for the docstring should be added to some appropriate place in one of the manual's .txi source files (they are all in {{Path|doc/interpreter/}}). Find the most appropriate section in the manual and add the following with the related functions: | When submitting a function to Octave, a tag for the docstring should be added to some appropriate place in one of the manual's .txi source files (they are all in {{Path|doc/interpreter/}}). Find the most appropriate section in the manual and add the following with the related functions: | ||
{{Code|adding tag for function help text in Octave's manual|<pre> | {{Code|adding tag for function help text in Octave's manual|<pre> | ||
Line 108: | Line 18: | ||
If appropriate, also write some text about the function on the manual for better inclusion into the manual. | If appropriate, also write some text about the function on the manual for better inclusion into the manual. | ||
== Sentence spacing == | |||
The typographical convention in Octave is to use two full spaces after a period that ends a sentence. For example: | |||
<pre> | |||
there is no correct for sentence spacing. But we need a convention # good | |||
there is no correct for sentence spacing. But we need a convention # bad | |||
</pre> | |||
= TexInfo = | |||
This is the preferred format for help text. There is also a comprehensive [ | This is the preferred format for help text. There is also a comprehensive [http://www.gnu.org/software/texinfo/manual/texinfo/html_node/index.html TexInfo manual]. | ||
== Examples == | |||
If you give a code example in the documentation written in Texinfo with | If you give a code example in the documentation written in Texinfo with | ||
Line 120: | Line 36: | ||
ps documents. That means, keep the lines of examples under 60 characters. | ps documents. That means, keep the lines of examples under 60 characters. | ||
== Octave specific macros == | |||
=== seealso === | |||
Do not use this macro empty as it will create problems with the {{forge|generate_html}} package. | Do not use this macro empty as it will create problems with the {{forge|generate_html}} package. | ||
=== deftypefn === | |||
This environment will enclose the function help text. It takes as argument the type of function. Typical values are | This environment will enclose the function help text. It takes as argument the type of function. Typical values are | ||
* Function File -- for functions in .m files | * Function File -- for functions in .m files | ||
Line 132: | Line 48: | ||
Besides this environment there is also the alternative {{Codeline|deftypenx}} for alternative forms. Typically these are mentioned at the top of the help text, right after the {{Codeline|deftypen}} although this is not really necessary. Cases where it's acceptable to have them on other sections would be methods on the help text of a class constructor, since they will not always be on a separate file. | Besides this environment there is also the alternative {{Codeline|deftypenx}} for alternative forms. Typically these are mentioned at the top of the help text, right after the {{Codeline|deftypen}} although this is not really necessary. Cases where it's acceptable to have them on other sections would be methods on the help text of a class constructor, since they will not always be on a separate file. | ||
== Formatting == | |||
=== Formulas === | |||
Do not use the example environment to insert formulas, consider using {{Codeline|@verbatim}} instead. | Do not use the example environment to insert formulas, consider using {{Codeline|@verbatim}} instead. | ||
Line 161: | Line 77: | ||
</pre>}} | </pre>}} | ||
=== Plain-tex missing macros === | |||
When compared to LaTeX, plain TeX is missing some very useful macros for including mathematical notation. The following is a list of their definitions which can be added on a as needed basis: | When compared to LaTeX, plain TeX is missing some very useful macros for including mathematical notation. The following is a list of their definitions which can be added on a as needed basis: | ||
Line 167: | Line 83: | ||
<pre>\def\frac#1#2{{\begingroup#1\endgroup\over#2}}</pre> | <pre>\def\frac#1#2{{\begingroup#1\endgroup\over#2}}</pre> | ||
== Special inserts == | |||
=== Escape characters === | |||
To escape characters in TexInfo, use the character {{Codeline|@}}. Only the characters '''@''', '''{''' and '''}''' need to be escaped. | To escape characters in TexInfo, use the character {{Codeline|@}}. Only the characters '''@''', '''{''' and '''}''' need to be escaped. | ||
Line 177: | Line 93: | ||
In certain contexts (such as {{Codeline|@acronym}} or {{Codeline|@xref}}), commas may need to be escaped. In such situations, use {{Codeline|<nowiki>@comma{}</nowiki>}}. | In certain contexts (such as {{Codeline|@acronym}} or {{Codeline|@xref}}), commas may need to be escaped. In such situations, use {{Codeline|<nowiki>@comma{}</nowiki>}}. | ||
=== Ellipsis (...) === | |||
Ellipsis are frequently used in octave help text, | Ellipsis are frequently used in octave help text, specially when defining a function API. Use the {{Codeline|<nowiki>@dots{}</nowiki>}} rather than three dots. | ||
{{Code||<pre> | {{Code||<pre> | ||
@deftypefn | @deftypefn {Function File} {} imhist (@var{I}) | ||
@deftypefnx {} {[@var{counts}, @var{x}] =} imhist (@dots{}) | @deftypefnx {Function File} {[@var{counts}, @var{x}] =} imhist (@dots{}) | ||
</pre>}} | </pre>}} | ||
=== Matlab === | |||
Sometimes it is | Sometimes it is need to mention matlab in the help text. For example, to mention that a weird behavior needs to be kept for matlab compatibility. In such case, small caps should be used. For example, the following is used in the {{Codeline|length}} help text: | ||
{{Code||<pre> | {{Code||<pre> | ||
Line 192: | Line 108: | ||
greater (this odd definition is used for compatibility with @sc{matlab}). | greater (this odd definition is used for compatibility with @sc{matlab}). | ||
</pre>}} | </pre>}} | ||