white space in documentation strings
Thorsten Meyer
thorsten.meyier at gmx.de
Sat Nov 1 17:00:16 CDT 2008
John W. Eaton wrote:
> On 1-Nov-2008, Thorsten Meyer wrote:
>
> | Hi,
> |
> | I have noticed that white space in the documentation strings of octave
> | functions is not deflated in the output of the help command.
> | E.g., a line break in the source code will give an additional space
> | in the help output. Or as a more extreme example:
> | a documentation string like this:
> | ## @var{extension} is created. The original file is not touched.
> | ## If @var{rootdir} is defined [...]
> |
> | looks like that in the output of the help command:
> | Each file is compressed separately and a new file with the
> | extension EXTENSION is created. The original file is
> | not touched. If ROOTDIR is defined the compressed
> |
> | Is that a bug or a feature?
>
> Octave's help command passes the Texinfo source of the doc string
> through makeinfo and displays the result. This is what the Texinfo
> manual says about multiple spaces, in the section titled "Multiple
> Spaces":
>
> Ordinarily, TeX collapses multiple whitespace characters (space, tab,
> and newline) into a single space. Info output, on the other hand,
> preserves whitespace as you type it, except for changing a newline into
> a space; this is why it is important to put two spaces at the end of
> sentences in Texinfo documents.
>
I see. The preservation of the large space between is and created is
a feature.
But what about the white space that the help command generates for
every newline? In the above example, you can see it between "touched."
and "If". Or look at the output for "help plot":
[...]
* If a single data argument is supplied, it is taken as the set
of Y coordinates and the X coordinates are taken to be the
indices of the elements, starting with 1.
[...]
, compare with what "doc plot" gives:
[...]
* If a single data argument is supplied, it is taken as the set
of Y coordinates and the X coordinates are taken to be the
indices of the elements, starting with 1.
[...]
and compare with the source code in plot.m:
## @item
## If a single data argument is supplied, it is taken as the set of @var{y}
## coordinates and the @var{x} coordinates are taken to be the indices of
## the elements, starting with 1.
The newlines after "@var{y}" and "of" are changed into two spaces in the
output of"help plot", and only one space in the output of "doc plot".
Is that intended behaviour?
regards
Thorsten
More information about the Bug-octave
mailing list