The -imain- Command
An alternative to “TERM-index” is to tell the student to press a key such as shift-DATA to reach an index page. If this index is in unit “table”, you must then put the statement “datal table” in every main unit, since all unit pointers are cleared when a new main unit is entered. A better way to do this is to use an -imain- command which specifies a unit to be done initially in every main unit:
is equivalent to:
The -imain- command names unit “setit” to be done at the beginning of every main unit. This saves you the trouble of placing the statement “do setit” at the beginning of each main unit.
You can specify all kinds of initializations to be performed in each main unit. For example, you might advertise the shift-DATA key with this display at the bottom of the screen:
In this case you would write something like:
Now the display will appear with each main unit, and the shift-DATA key will be activated. (Incidentally, if you have blank -pause- commands in your units, pressing shift-DATA will merely take the student past the pause, not to the table of contents. Similarly, pressing the TERM key at a blank -pause- will not offer TERM capabilities but will merely take the student past the pause. Rather than use a blank -pause-, use a statement such as “pause keys=next,clatal,term”, as discussed in Chapter 8. With this kind of pause, pressing shift-DATA will take the student to the index, and pressing TERM will give normal TERM features, while pressing NEXT will take the student past the pause. Other keys are ignored.)
The -imain- command sets a pointer, just as the -help- and -basecommands do. You can change the associated unit by executing another -imain- command:
Notice that the new “imain” unit will not be done immediately, but only when a new main unit is entered. You must add the statement “do other” if you want unit “other” to be done immediately. You can stop having an imain-associated unit done by using “imain q”, or “imain” (blank tag), to clear the -imain- pointer.
While any key may be used to access an index, many authors have agreed to use shift-DATA in order to provide some uniformity from one lesson to another. This procedure reduces the number of new conventions a student must learn when studying new material.
There is a similar -iarrow- command which can be used to specify a unit to be performed every time a student enters a response. If the -iarrow- command is itself located in the -imain- unit, all -arrow-s will be affected.