Skip to content

Commit 5aadaf1

Browse files
author
Rik
committed
doc: grammarcheck Octave manual before 9.1 release.
* doc/interpreter/func.txi, doc/interpreter/numbers.txi, doc/interpreter/octave.texi, doc/interpreter/plot.txi, doc/interpreter/sparse.txi, doc/interpreter/vectorize.txi, scripts/miscellaneous/jupyter_notebook.m, scripts/plot/draw/stemleaf.m: grammarcheck Octave manual before 9.1 release.
1 parent d46ac79 commit 5aadaf1

File tree

10 files changed

+64
-42
lines changed

10 files changed

+64
-42
lines changed

doc/interpreter/container.txi

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,8 @@ using the @code{cell2mat} and @code{cell2struct} functions.
949949
@cindex cs-lists
950950

951951
Comma-separated lists @footnote{Comma-separated lists are also sometimes
952-
informally referred to as @dfn{cs-lists}.} are the basic argument type
953-
to all Octave functions - both for input and return arguments. In the
954-
example
952+
referred to as @dfn{cs-lists}.} are the basic argument type to all Octave
953+
functions---both for input and return arguments. In the example
955954

956955
@example
957956
max (@var{a}, @var{b})
@@ -971,14 +970,13 @@ x = [1 0 1 0 0 1 1; 0 0 0 0 0 0 7];
971970

972971
@noindent
973972
Here, @samp{@var{x}, 2, "last"} is a comma-separated list constituting
974-
the input arguments of @code{find}. @code{find} returns a comma
975-
separated list of output arguments which is assigned element by
976-
element to the comma-separated list @samp{@var{i}, @var{j}}.
977-
978-
Another example of where comma-separated lists are used is in the
979-
creation of a new array with @code{[]} (@pxref{Matrices}) or the
980-
creation of a cell array with @code{@{@}} (@pxref{Basic Usage of Cell
981-
Arrays}). In the expressions
973+
the input arguments of @code{find}. @code{find} returns a comma-separated list
974+
of output arguments which is assigned element by element to the comma-separated
975+
list @samp{@var{i}, @var{j}}.
976+
977+
Another example of where comma-separated lists are used is in the creation of a
978+
new array with @code{[]} (@pxref{Matrices}) or the creation of a cell array
979+
with @code{@{@}} (@pxref{Basic Usage of Cell Arrays}). In the expressions
982980

983981
@example
984982
@group

doc/interpreter/expr.txi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ A([1; 2]) # result is a column vector: ans = [1; 2]
145145
@end example
146146

147147
The shape rules for @var{A}(@var{P}) are:
148+
148149
@itemize @bullet
149150
@item When at least one of @var{A} or @var{P} has two or more dimensions, then
150151
@var{A}(@var{P}) takes the shape of @var{P}. This happens when at least one
@@ -1103,28 +1104,28 @@ the equivalent of the operation @code{all (@var{boolean1}(:))}. If
11031104
@var{boolean1} is not a logical value, it is considered true if its value
11041105
is nonzero, and false if its value is zero. If @var{boolean1} is an array,
11051106
it is considered true only if it is non-empty and all elements are
1106-
non-zero. If @var{boolean1} evaluates to false, the result of the overall
1107+
nonzero. If @var{boolean1} evaluates to false, the result of the overall
11071108
expression is false. If it is true, the expression @var{boolean2} is
1108-
evaluated in the same way as @var{boolean1}. If it is true, the result of
1109+
evaluated in the same way as @var{boolean1}. If it is true, the result of
11091110
the overall expression is true. Otherwise the result of the overall
11101111
expression is false.
11111112

11121113
@strong{Warning:} the one exception to the equivalence with evaluating
11131114
@code{all (@var{boolean1}(:))} is when @code{boolean1} an the empty array.
1114-
For @sc{MATLAB} compatibility, the truth value of an empty array is always
1115+
For @sc{matlab} compatibility, the truth value of an empty array is always
11151116
@code{false} so @code{[] && true} evaluates to @code{false} even though
11161117
@code{all ([])} is @code{true}.
11171118

11181119
@item @var{boolean1} || @var{boolean2}
11191120
@opindex ||
11201121
The expression @var{boolean1} is evaluated and converted to a scalar using
1121-
the equivalent of the operation @code{all (@var{boolean1}(:))}. If
1122+
the equivalent of the operation @code{all (@var{boolean1}(:))}. If
11221123
@var{boolean1} is not a logical value, it is considered true if its value
11231124
is nonzero, and false if its value is zero. If @var{boolean1} is an array,
11241125
it is considered true only if it is non-empty and all elements are
1125-
non-zero. If @var{boolean1} evaluates to true, the result of the overall
1126+
nonzero. If @var{boolean1} evaluates to true, the result of the overall
11261127
expression is true. If it is false, the expression @var{boolean2} is
1127-
evaluated in the same way as @var{boolean1}. If it is true, the result of
1128+
evaluated in the same way as @var{boolean1}. If it is true, the result of
11281129
the overall expression is true. Otherwise the result of the overall
11291130
expression is false.
11301131

doc/interpreter/func.txi

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,17 +1987,19 @@ create apparent ambiguities with mathematical and logical expressions that
19871987
use function syntax. For example, all three of the statements
19881988

19891989
@example
1990+
@group
19901991
arg1 - arg2
19911992
arg1 -arg2
19921993
arg1-arg2
1994+
@end group
19931995
@end example
19941996

19951997
@noindent
19961998
could be intended by a user to be subtraction operations between
19971999
@code{arg1} and @code{arg2}. The first two, however, could also have been
19982000
meant as a command syntax call to function @code{arg1}, in the first case
19992001
with options @code{-} and @code{arg2}, and in the second case with option
2000-
@code{-arg2}.
2002+
@option{-arg2}.
20012003

20022004
Octave uses whitespace to interpret such expressions according to the
20032005
following rules:
@@ -2013,43 +2015,52 @@ arg1 arg2 arg3 ... argn
20132015

20142016
@item
20152017
Statements without any whitespace are always treated as function syntax:
2018+
20162019
@example
2020+
@group
20172021
arg1+arg2
20182022
arg1&&arg2||arg3
20192023
arg1+=arg2*arg3
2024+
@end group
20202025
@end example
20212026

20222027
@item
20232028
If the first symbol is a constant (or special-valued named constant pi, i,
20242029
I, j, J, e, NaN, or Inf) followed by a binary operator, the statement is
20252030
treated as function syntax regardless of any whitespace or what follows the
20262031
second symbol:
2032+
20272033
@example
2034+
@group
20282035
7 -arg2
20292036
pi+ arg2
20302037
j * arg2 -arg3
2038+
@end group
20312039
@end example
20322040

20332041
@item
20342042
If the first symbol is a function or variable and there is no whitespace
20352043
separating the operator and the second symbol, the statement is treated
20362044
as command syntax:
2045+
20372046
@example
2047+
@group
20382048
arg1 -arg2
20392049
arg1 &&arg2 ||arg3
20402050
arg1 +=arg2*arg3
2051+
@end group
20412052
@end example
20422053

20432054
@item
20442055
Any other whitespace combination will result in the statement being treated
20452056
as function syntax.
20462057
@end itemize
20472058

2048-
Note 1: If a special-valued named constant has been redefined as a
2059+
Note 1: If a special-valued named constant has been redefined as a
20492060
variable, the interpreter will still process the statement with function
20502061
syntax.
20512062

2052-
Note 2: Attempting to use a variable as @code{arg1} in a command being
2063+
Note 2: Attempting to use a variable as @code{arg1} in a command being
20532064
processed as command syntax will result in an error.
20542065

20552066

doc/interpreter/numbers.txi

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,11 @@ the range is not always included in the set of values. This can be useful
435435
in some contexts. For example:
436436

437437
@example
438+
@group
438439
## x is some predefined range or vector or matrix or array
439440
x(1:2:end) += 1; # increment all odd-numbered elements
440441
x(2:2:end) -= 1; # decrement all even-numbered elements
442+
@end group
441443
@end example
442444

443445
The above code works correctly whether @var{x} has an odd number of elements
@@ -448,51 +450,61 @@ range. As a result, defining ranges with floating-point values can result
448450
in pitfalls like these:
449451

450452
@example
453+
@group
451454
a = -2
452455
b = (0.3 - 0.2 - 0.1)
453456
x = a : b
457+
@end group
454458
@end example
455459

456460
Due to floating point rounding, @var{b} may or may not equal zero exactly,
457461
and if it does not, it may be above zero or below zero, hence the final range
458462
@var{x} may or may not include zero as its final value. Similarly:
459463

460464
@example
465+
@group
461466
x = 1.80 : 0.05 : 1.90
462467
y = 1.85 : 0.05 : 1.90
468+
@end group
463469
@end example
464470

471+
@noindent
465472
is not as predictable as it looks. As of Octave 8.3, the results obtained are
466473
that @var{x} has three elements (1.80, 1.85, and 1.90), and @var{y} has only
467474
one element (1.85 but not 1.90). Thus, when using floating points in ranges,
468475
changing the start of the range can easily affect the end of the range even
469476
though the ending value was not touched in the above example.
470477

471478
To avoid such pitfalls with floating-points in ranges, you should use one of
472-
the following patterns. This change to the previous code:
479+
the following patterns. This change to the previous code:
473480

474481
@example
482+
@group
475483
x = (0:2) * 0.05 + 1.80
476484
y = (0:1) * 0.05 + 1.85
485+
@end group
477486
@end example
478487

488+
@noindent
479489
makes it much safer and much more repeatable across platforms, compilers,
480490
and compiler settings. If you know the number of elements, you can also use
481491
the @code{linspace} function (@pxref{Special Utility Matrices}), which will
482492
include the endpoints of a range. You can also make judicious use of
483-
@code{round}, @code{floor}, @code{ceil}, @code{fix}, etc to set the
493+
@code{round}, @code{floor}, @code{ceil}, @code{fix}, etc.@: to set the
484494
limits and the increment without getting interference from floating-point
485495
rounding. For example, the earlier example can be made safer and much more
486496
repeatable with one of the following:
487497

488498
@example
499+
@group
489500
a = -2
490501
b = round ((0.3 - 0.2 - 0.1) * 1e12) / 1e12 # rounds to 12 digits
491502
c = floor (0.3 - 0.2 - 0.1) # floors as integer
492503
d = floor ((0.3 - 0.2 - 0.1) * 1e12) / 1e12 # floors at 12 digits
493504
x = a : b
494505
y = a : c
495506
z = a : d
507+
@end group
496508
@end example
497509

498510
When adding a scalar to a range, subtracting a scalar from it (or subtracting a

doc/interpreter/octave.texi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ Object Groups
625625
Graphics Toolkits
626626
627627
* Customizing Toolkit Behavior::
628-
* Hardware vs Software Rendering::
628+
* Hardware vs. Software Rendering::
629629
* Precision issues::
630630
631631
Matrix Manipulation

doc/interpreter/plot.txi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ Data source variables.
27642764

27652765
@menu
27662766
* Customizing Toolkit Behavior::
2767-
* Hardware vs Software Rendering::
2767+
* Hardware vs. Software Rendering::
27682768
* Precision issues::
27692769
@end menu
27702770

@@ -2794,8 +2794,8 @@ plot (1:10)
27942794
@end group
27952795
@end example
27962796

2797-
@node Hardware vs Software Rendering
2798-
@subsubsection Hardware vs Software Rendering
2797+
@node Hardware vs. Software Rendering
2798+
@subsubsection Hardware vs. Software Rendering
27992799
@cindex opengl rendering slow windows
28002800

28012801
When using the Octave for Windows installer, the user has the option to select
@@ -2804,7 +2804,7 @@ whether software rendering is used for the OpenGL graphics toolkits
28042804
(@qcode{"qt"} and @qcode{"fltk"}). Software rendering can be used to avoid
28052805
rendering and printing issues due to imperfect OpenGL driver implementations
28062806
for diverse graphic cards from different vendors (notably integrated Intel
2807-
graphics). As a down-side, software rendering might be considerably slower
2807+
graphics). As a downside, software rendering might be considerably slower
28082808
than hardware accelerated rendering (and it might not work correctly on 32-bit
28092809
platforms or WoW64). To permanently switch between hardware accelerated
28102810
rendering with your graphics card drivers and software rendering, use the
@@ -2813,7 +2813,7 @@ Alternatively, rename the following file while Octave is closed:
28132813

28142814
@file{@var{octave-home}\bin\opengl32.dll}
28152815
@*where @var{octave-home} is the directory returned by
2816-
@ref{XREFOCTAVE_HOME, , @w{@qcode{OCTAVE_HOME}}}, i.e., the directory in which
2816+
@ref{XREFOCTAVE_HOME, , @w{@code{OCTAVE_HOME}}}, i.e., the directory in which
28172817
Octave is installed (the default is
28182818
@file{C:\Program Files\GNU Octave\Octave\Octave-@var{version}\mingw64}).
28192819
Change the file extension to @file{.bak} for hardware rendering or to

doc/interpreter/sparse.txi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ contents of these three vectors for the above matrix will be
150150

151151
Note that this is the representation of these elements with the first row
152152
and column assumed to start at zero, while in Octave itself the row and
153-
column indexing starts at one. Thus the number of elements in the
154-
@var{i}-th column is given by @code{@var{cidx} (@var{i} + 1) -
155-
@var{cidx} (@var{i})}.
153+
column indexing starts at one. Thus, the number of elements in the
154+
@var{i}-th column is given by
155+
@code{@var{cidx} (@var{i} + 1) - @var{cidx} (@var{i})}.
156156

157157
Although Octave uses a compressed column format, it should be noted
158158
that compressed row formats are equally possible. However, in the

doc/interpreter/vectorize.txi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ subtraction takes place.
344344

345345
A special case of broadcasting that may be familiar is when all
346346
dimensions of the array being broadcast are 1, i.e., the array is a
347-
scalar. Thus for example, operations like @code{x - 42} and @code{max
348-
(x, 2)} are basic examples of broadcasting.
347+
scalar. Thus, for example, operations like @code{x - 42} and
348+
@code{max (x, 2)} are basic examples of broadcasting.
349349

350350
For a higher-dimensional example, suppose @code{img} is an RGB image of
351351
size @code{[m n 3]} and we wish to multiply each color by a different

scripts/miscellaneous/jupyter_notebook.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
##
5151
## @itemize @bullet
5252
## @item
53-
## "%plot -f <format>" or "%plot --format <format>": specifies the
54-
## image storage format. Supported formats are:
53+
## "@code{%plot -f <format>}" or "@code{%plot --format <format>}": specifies
54+
## the image storage format. Supported formats are:
5555
##
5656
## @itemize @minus
5757
## @item
@@ -67,16 +67,16 @@
6767
## @end itemize
6868
##
6969
## @item
70-
## "%plot -r <number>" or "%plot --resolution <number>": specifies the
71-
## image resolution.
70+
## "@code{%plot -r <number>}" or "@code{%plot --resolution <number>}":
71+
## specifies the image resolution.
7272
##
7373
## @item
74-
## "%plot -w <number>" or "%plot --width <number>": specifies the
75-
## image width.
74+
## "@code{%plot -w <number>}" or "@code{%plot --width <number>}": specifies
75+
## the image width.
7676
##
7777
## @item
78-
## "%plot -h <number>" or "%plot --height <number>": specifies the
79-
## image height.
78+
## "@code{%plot -h <number>}" or "@code{%plot --height <number>}": specifies
79+
## the image height.
8080
## @end itemize
8181
##
8282
## Examples:

scripts/plot/draw/stemleaf.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
## The default stem width is 10.
4343
##
4444
## The output of @code{stemleaf} is composed of two parts: a
45-
## "Fenced Letter Display," followed by the stem-and-leaf plot itself.
45+
## "Fenced Letter Display", followed by the stem-and-leaf plot itself.
4646
## The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
4747
## Briefly, the entries are as shown:
4848
##

0 commit comments

Comments
 (0)