aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/HTXAdvPage5.ht
blob: 7c99f38984139f524d43e8f5440c74dd1c68e04c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
\begin{page}{HTXAdvPage5}{\Language{} paste-ins}
\centerline{\fbox{{\tt \thispage}}}\newline
\begin{scroll}

The {\it paste} and {\it patch} facility (see \downlink{previous page}{HTXAdvPage4})
is used to display (or hide) the \Language{} output
of an \Language{} command ({\tt\\axiomcommand})
included in a
\HyperName{} page.

A mechanism has been set up to {\it automatically} generate
these paste-ins. It amounts to replacing an
{\tt \\axiomcommand} by a {\tt \\pastecommand} in the
\HyperName{} page.

In the case of a \axiomOp{draw} \Language{} command
, where the result is to create an interactive viewport,
the appropriate command to use is {\tt \\pastegraph}.
The effect of this is to include (as the output)
the \Language{} generated {\it image} of the graph
as an active area. Clicking on it will put up an
interactive viewport.
The {\tt \\pastegraph} command should be used only when
the result of the associated \Language{} operation is
to {\it create} an interactive viewport. It is {\it not} necessarily
appropriate for all commands whose result
is a \axiomType{Two{}Dimensional{}Viewport} or \axiomType{Three{}Dimensional{}Viewport}.
The {\tt \\pastecommand} and {\tt \\pastegraph}
are  macros defined in {\bf util.ht}.



There is no automatic paste-in generation facility
for \Language{} piles (the {\tt \\begin\{axiomsrc\}} command).


The automatic paste-in generation mechanism works
by invoking \Language{} with a particular option.
\HyperName{} is also started automatically. It reads
the {\tt \\pastecommand} and {\tt \\pastegraph}
commands in all pages in a specified
{\bf somefile.ht}  and passes them to
\Language{} for evaluation. \HyperName{}
captures the output and writes it out (to a
file called {\bf somefile.pht}) as the body of
some {\it patch} definitions. The commands
encountered are written to a file
{\bf somefile.input} which you can {\tt )read} from an \Language{} session.
It also creates directories for the graphics
images encountered. Those files and directories
will be written under the {\it current} directory.
The idea is that you then include the {\it patch} definitions
in {\bf somefile.pht} in your local database using {\bf htadd}.


You can try this feature now. Edit a file called, say, {\bf trypaste.ht}
in a directory, say {\bf /tmp}. Put the following \HyperName{} text
in it.
\beginImportant
\newline
{\tt \\begin\{page\}\{TryPaste\}\{Trying out paste-in generation\}}\newline
{\tt \\begin\{scroll\}}\newline
{\tt \\pastecommand\{f z == z**2 \\bound\{f\}\}}\newline
{\tt \\pastegraph\{draw(f,-1..1) \\free\{f\}\}}\newline
{\tt \\pastecommand\{x:= f 3 \\free\{f\}\}}\newline
{\tt \\end\{scroll\}}\newline
{\tt \\end\{page\}}\newline
\endImportant

From the directory that contains the {\bf trypaste.ht},
issue
\centerline{
{\tt htadd -l ./trypaste.ht}
}
You will get the
{\bf ht.db} database file.
Set the environment variable {\tt HTPATH} so that
it points first to your directory and then the system directory.
In the {\bf /bin/csh}, you might use
\centerline{
{\tt setenv HTPATH /tmp:\$AXIOM/doc/hypertex/pages}
}
Make sure that no {\bf trypaste.input} or {\bf trypaste.pht}
files exist in the directory.
Then issue
\centerline{
{\tt axiom -paste trypaste.ht}
}
 and wait for
\Language{} to finish.

There is a modification you will wish to make to
the {\bf trypaste.pht} file.
This is because the generated \HyperName{} text will assume that
the {\it viewport} data will be located in the
{\it system} directory.
\centerline{{\bf \env{AXIOM}/doc/viewports}}
You may want to place your images in a different directory,
say, {\bf /u/sugar/viewports}.
If so, then change all occurences of
\beginImportant
\newline
{\tt \\env\{AXIOM\}/doc/viewports/}
\centerline{{\it by}}
{\tt /u/sugar/viewports/}
\endImportant
in the file {\bf trypaste.pht}. The last step
is to include the {\it patch} definitions
in {\bf trypaste.pht} to your local database.
Issue
\centerline{
{\tt htadd -l ./trypaste.pht}
}
to update the database. If you have provided
a link to your pages from the {\tt RootPage}
via the {\tt \\localinfo} macro, you should now
be able to start \Language{} or \HyperName{}
and see the computed \Language{} output whenever you
click on the buttons to the left of each command.



\end{scroll}
\beginmenu
\menulink{Next Page --- Miscellaneous}{HTXAdvPage6}
\endmenu

\end{page}