• Aucun résultat trouvé

Miscellaneous layout statenlents

Dans le document CARNEGIE-IVIELLON UNIVERSITY (Page 112-116)

yacc + lex

4.24 Miscellaneous layout statenlents

This section describes several slug, page and document layout commands that are not conveniently described elsewhere.

4.24.1 Spacing statements

@hsp

@vsp

newline

This takes a single parameter, which is a horizontal distance. If the statement occurs in an environment other than @pageoffset the specified amount of space is left in the slug in which it occurs. If the distance is negative, backspacing within the slug occurs, and overprinting may occur.

This takes a single parameter, which is a vertical distance. If the statement occurs in an environment other than @pageoffset then a slug of the specified size is inserted into the box; the slug is otherwise empty. The distance may be negative, in which case lines may overwrite each other. This statement will produce unusual results if it occurs on a line that contains other characters.

This takes a single parameter, which is the number of slugs to terminate. If the parameter is absent or is empty, then the current slug is terminated. @* has the same effect at @newl ine( 1). Newl i ne is a macro which calls Zsp, which is the basic statement controlling the generation on new pages. Newl i ne is defined in section 4.l8.1.11.

The effects of Hsp and Vsp, if they cause the slug or box to exceed its normal size, are unpredicatable (or rather, I don't know what will happen).

4.24.2 Page commands

Commands are passed to the page layout procedures via the OddsandSods galley, which basically allows several commands to be delayed. These commands allow for running headings and· footings to be inserted on pages, for pages to be offset to allow binding margins, and for page skips to be made:

4.24.2.1 Page headings and footings

The PageHeading and PageFoot ing environments allow any of the standard terminal environments to be nested inside them. The cross references that these environments leave in the Ma i n galley are picked up by the Defaul to layout procedure, and the boxes within them are then placed in the heading and footing area of the page as it is completed. The boxes are selected sequentially, and the Page Head i ng and Page Foot i ng box is restarted after it is complete. In this way several headings and footings can alternate at any cycle length.

Note that if a slug contains a definition of a label (either explicitly, or implicitly through using NConv

with an empty label parameter), Mint will create new, unique labels to ensure that cross references are correct. Thus, to obtain a page number at the bottom of each page, the statement

@pagefooting(@pageno(»

suffices.

4.24.2.2 Page offsets

The PageOffset environment feeds slugs to the layout procedures in a manner similar to that for PageHead; ng and PageFoot i ng. Each slug is scanned for Vspand Hsp statements. If either is found, the page is offset by that amount. Thus it is possible to shift pages either horizontally or vertically, and to set up cycles. For example, pages that are to be reproduced back-to-back, and stapled in the top left-hand corner, can by adjusted by

@begin(PageOffset)

@Hsp(+O.25in)@Vsp(+O.25in)

@Hsp(-O.25in)@Vsp(+O.25in)

@end(PageOffset) 4.24.2.3 Page skips

The PageCommand environment is a general way of passing information to the layout procedures.

Currently they only recognize one item in the s~ugs within the environment, the Zsp statement. Zsp takes one parameter, which is either an unsigned number, or a signed number. If an unsigned number, the layout procedure will skip to that page number in the current part, if the page has not already been finished; if a signed number, the layout procedure will skip that number of pages. To skip one page, the statement

@PageCommand (@Zsp (+1»

is used. The Newpage macro provides a convenient way of using this statement 4.24.3 Tabulations

Tabulations are a part of the Mint environment parameters, and are set and cleared when the environment starts; thus the casual use of tabulations that Scribe encourages is not permitted.

To clear the standard tabulations of an environment, the T abCl ea r environment parameter is used.

Tabulations are set using Tab set followed by a horizontal distance. Alternatively tabulations can be set equidistant along the box by T abO; vi de, which clears all previous tabulations. The environment parameters are scanned from left to right, so that to set a pair of tabulations, one does

@begin(description, tabclear, tabset 8 ems, tabset 18 ems)

Tabulations can be set dynamically by the use of @t; this adds another tabulation to the collection for the enviroment. To move to a tabulation stop, @\ is used.

At most 10 tabulations can be set for an environment in the box parameters. Any number of additional tabulations can be set using @t.

4.24.4 The Ali g n environment

The Al ign environment treats @\ differently from the way other environments treat it. (The maths environment treats tabulations in a similar way the the ali g n environment; see 4.27.) On encountering a

@\, rvIint searches backwards in the slug until it finds a space, and it then stretches the space so that the tabulation occurs at the correct position. Thus if the tabulation occurs in the middle of a sequence of characters, all the characters are shifted to the right. This allows vertical lists to be aligned around arbitrary points. For example,

@newpattern(line2,2.1)

@newbordersty1e(width2,n,n,n,n,line2,line2, 1ine2, 1ine2)

@begin(tab1e, width 5.5in, bordersty1e width2)

@begin(caption, border O.lin, bordersty1e widthl) Personal Expenses Claimed against Income

@end(caption)

@begin(align, tabclear,· border O.lin)

@u(Nature of exp@~ense claimed) @u(Amount c@~laimed)

@w(Depreciation @\- Fabric) $125@\

@w(Oepreciation @\- Furnishings) $95@\.50

@w(Heating @\- Gas) $26@\.25

@w(Heating @\- Electricity) $57@\.O

@end(align)

@end(table)

produces the following effect

Table 11 .. Personal Expenses Claimed against Income Nature of expense claimed

Depreciation - Fabric Depreciation - Furnishings

Heating - Gas

Heating - Electricity

Amount claimed

$125

$95.50

$26.25

$57.0

The Ali g n environment also allows you to centre text around some tabulation. The marker @< causes Mint to search backwards in the slug to find the preceding tabulation, and it then adjusts the spacing so that the the text between the two is centred about the tabulation. To help in the visual appearance of the .Mss . file, I have provided the tabulation mark @>, which has the same effect as @\. Thus you would normally

write

@>Text to be centred@<

In order to simplify the use of @< and @\ in the ali 9 n environment, ~1int inserts a space of width zero after them; this allows you to write @) x@<y@\.

A comprehensive example of the use of the Al ign environment is provided by the PageHeading and Page Foot i ng environments that have been used for the heading and footing of this manual. They are

@form (chap,x.@""@Chapter(@value(x»

@begin(pageheading)

@begin(align,border=O.lin.borderstyle=widthl.tabdivide 2)

@pageno() @>@b(@value(x»@< @ovp( @+(@w(Peter Hibbard»@\)@-( @w(Mint User Manual»@\

@end(align)

@begin(align.border=O.lin,borderstyle=widthl,tabdivide 2)

@ovp(@+(@w(Peter Hibbard»)@-(@w(Mint User Manual» @>@b(@value(x»@<

@pageno()@\

" )

@end(align)

@end(pageheading)

@begin(pagefooting)

@begin(align,tabdivide 1)

@s(@value(sourcefile»

@end(align)

@begin(align.tabdivide 1)

@s(@value(sourcefile»@\

@end(align)

@end(pagefooting)

4.24.5 The Des c rib e 10 environment

Sometimes it is necessary to place two or more environments side by side. The commentary facility provides one such example. Mint provides a general facility for laying out environments adjacent to each other, so that you can select the widths of each of the environments. The c omme n t a ry feature is, in fact, a degenerate case of the describe environment, and the default values of the several parameters that descr i be takes allow it to be used for the desc r i pt i on environment as well.

The number of environments that are placed adjacent to each other, and their widths, are determined by the tabulations of the describe environment. For example, if you wanted to place three DP drawings next to each other, you could do

@begin(describe, tabclear. tab set 2.75in. tabset 4.75in, border 0.15in, borderstyle widthl)

@dp(@include(mouse.dp»

@dp(@include(mouse.dp»

@dp(@include(mouse.dp»

@end(describe)

which produces the following

But there is no need for the environments to be the same.

For example, you can flush one environment to the right and another

to the left In fact, I could have used an

itemi ze, enume rate, or even another describe here, to produce a number of effects.

. One particular use of the des c rib e is to layout tables; those in section 4.4.2 have been produced in this way.

If you do not specify the tabulations explicitly, the de s c rib e environment provides one tabulation only, at a quarter of the distance across the box. This is the same distance as the items occur in a de sc r i pt ion environment.

Dans le document CARNEGIE-IVIELLON UNIVERSITY (Page 112-116)