Producing Examples for Manual




On Mon, 8 Mar 2010, Wilhelm Haager wrote:

< Hi,
< 
< I want to make a manual using texinfo, but I don't know how to
< produce the examples (automatically) like those in the Maxima manual.
< 
< When I call for example Maxima this way:
< 
<     maxima --batch-string "x:a**2/b**2;",
< 
< I get the following result:
< 
<                                    2
<                                   a
< (%i1)                         x : --
<                                    2
<                                   b
<                                  2
<                                 a
< (%o1)                           --
<                                  2
<                                 b
< 
< I think, the input expression should not be "displayed-2d",
< but reproduced exactly as typed in (also without indentation);
< how can that be done?
< 
< I'm using Maxima-5.10.1 on Windows XP.
< (I don't know, whether the Perl-script "update-examples" is still actual,
< at least it does not run under Windows.)

This script does work with the current version of perl on my linux
machine. Here it is, processing the README.update_examples files.
I've included only enough to show it works. 

Leo
ps: 5.10.1 is a typo, right?


$ MAXIMA_EXAMPLE_COMMAND='~/maxima/sandbox/maxima/maxima-local
--lisp=cmucl --quiet --init-mac=/dev/null' ./update_examples <
README.update_examples

Perl script `update_examples' is intended to update
examples in the Maxima texinfo documentation.

`update_examples' is a filter - it reads standard input
and direst result to standard output:

./update_examples < original.texi > updated.texi

The script scans input texinfo file for
constructions of the form:

@c ===beg===
@c expand((x+y)^2);
@c factor(%);
@c ===end===
@example
@group
(%i1) expand((x+y)^2);
                          2            2
(%o1)                    y  + 2 x y + x
@end group
@group
(%i2) factor(%);
                                   2
(%o2)                       (y + x)
@end group
@end example

Lines between `@c ===beg===' and `@c ===end==='
are Maxima commands (without leftmost `@c ').
The script extracts this commands, passes them to
Maxima and inserts resulting output between
`@example' and `@end example'. 

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.