chiark / gitweb /
Import upstream version 5.3.
[mup] / mup / docs / uguide / headfoot.html
1 <HTML>
2 <HEAD><TITLE>
3 Mup header and footers
4 </TITLE></HEAD>
5 <BODY>
6 <P>
7 &nbsp;&nbsp;&nbsp;<A HREF="newscore.html">&lt;-- previous page</A>
8
9 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Table of Contents</A>&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="macros.html">next page --&gt;</A>
10 </P>
11            
12 <H2>
13 Headers and footers
14 </H2>
15 <P>
16 Mup provides ways to put headers and footers on pages of output.
17 Often you may want a certain kind of header and footer on the first
18 page, but a different kind on any subsequent pages, so Mup makes it
19 easy to do that. Mup also offers two different &quot;layers&quot; of headers and
20 footers. These layers may be particularly useful if you have a single Mup
21 file that contains multiple songs, or multiple movements of a song.
22 In that case, there may be certain things that you want printed in
23 headers and footers throughout,
24 like the current page number and the name of the entire collection,
25 but other things that you want to have change with each new song or
26 movement.
27 </P>
28 <P>
29 The &quot;outer&quot; layer is specified by four contexts: header, footer, header2,
30 and footer2. The &quot;inner&quot; layer is specified by four contexts:
31 top, bottom, top2, and bottom2.
32 All of these contexts are optional.
33 The outer contexts can only be specified once per file.
34 The inner contexts can be specified more than once per file, and
35 each time a set of them occurs, a new page is started.
36 On output pages, all of these contexts are placed horizontally
37 between the left and right margins, and vertically the
38 elements appear in the following order:
39  (topmargin)
40 header
41 top
42  (one or more scores of music or blocks of text)
43 bottom
44 footer
45  (bottommargin)
46 </P>
47 <P>
48 Which version is used--the one with or without the &quot;2&quot; suffix--depends
49 on which page is being printed. The items in header and footer
50 appear on only the very first page,
51 while those in header2 and footer2 appear on all subsequent pages.
52 Somewhat similarly, the items in top and bottom will appear on the page
53 that is started when they are encountered in the input,
54 while top2 and bottom2 will then be used on all subsequent pages.
55 However, you can specify a new top and/or bottom later,
56 that will then to used for one page, and you can specify
57 a new top2 and/or bottom2 later which will replace the previous top2/bottom2.
58 Note, however, that if you change top2 but not top,
59 that new top2 is used immediately on the new page,
60 whereas if you change both, the new top applies
61 to the immediately following new page,
62 and the new top2 isn't used until the following page. Subsequent pages
63 will use top2 in either case.
64 </P>
65 <P>
66 Some examples may help.
67 First a simple case: suppose you have a single song, and you'd like a title
68 at the top of the first page. This is straightforward:
69 <BR><PRE>
70 top
71     title &quot;Here is the Title&quot;
72 </PRE><BR>
73 For this simple example, it would work just as well to use &quot;header&quot; instead
74 of &quot;top,&quot; so you can use either one, although top is slightly more flexible.
75 Later we'll see some examples where you might use both header and top in
76 the same file, for different kinds of titles.
77 </P>
78 <P>
79 Now suppose you'd like to make the title bigger and bolder, and would like
80 to add a subtitle and composer information, as well as add a copyright
81 notice to the bottom of the page.
82 <BR><PRE>
83 top
84    title bold (18) &quot;Here is the Title&quot;
85    title ital (14) &quot;Here is a subtitle&quot;
86    title &quot;Lyrics: Ann Author&quot; &quot;Composer: Me&quot;
87 bottom
88    title &quot;\(copyright) Copyright 2003 by Ann Author and Me&quot;
89 </PRE><BR>
90 Again, in this simple example,
91 you could use &quot;header&quot; and &quot;footer&quot; rather than &quot;top&quot; and &quot;bottom.&quot;
92 </P>
93 <P>
94 Now suppose the song is long enough to take several pages,
95 and you would like to repeat the title along with the page number on
96 all pages after the first. To accomplish this, you could add:
97 <BR><PRE>
98 top2
99   title &quot;Here is the Title - \%&quot;
100 </PRE><BR>
101 The \% is a special marker that will get replaced on each page
102 with the current page number. While it can be used in any text string,
103 it is probably only likely to be useful in these header and footer kinds
104 of contexts.
105 <A NAME="pagenum">Another special marker</A>
106 is \#, which will be replaced by the page number of the final page.
107 This could be useful for doing something like &quot;page \% of \#.&quot;
108 </P>
109 <P>
110 As a variation, perhaps you'd prefer the information at the bottom of
111 the page.
112 <BR><PRE>
113 bottom2
114    title &quot;This is the title&quot;  &quot;Page \%&quot;
115 </PRE><BR>
116 In this variation, two separate text strings are specified,
117 so the first string will be left justified and the second will be
118 right justified.
119 </P>
120 <P>
121 Note that if you give a top2 or bottom2, 
122 but it turns out there aren't any additional pages,
123 they would never actually get used.
124 But it wouldn't hurt to have set them.
125 </P>
126 <P>
127 Now let's consider a more complicated example, using both outer and inner
128 contexts. Suppose you are publishing a book of songs,
129 entitled &quot;My Favorite Songs,&quot; and you want to put that title at the top
130 of every page throughout the book, and you want a page number at the bottom
131 of each page except the first.
132 You could get that much using:
133 <BR><PRE>
134 header
135    title &quot;My Favorite Songs&quot;
136 header2
137    title &quot;My Favorite Songs&quot;
138 footer2
139    title &quot;\%&quot;
140 </PRE><BR>
141 But suppose that in addition, you want each song to have its title on its
142 first page in big print, and on subsequent pages in regular size print.
143 To get this, at the beginning of each song, you could use top and top2:
144 <BR><PRE>
145 top
146    title (18) &quot;This is the Song Title&quot;
147 top2
148    title &quot;This is the Song Title&quot;
149 </PRE><BR>
150 </P>
151 <P>
152 A composition with multiple movements can be handled similarly,
153 by giving header, footer, header2, and footer2 (or any subset thereof)
154 for the composition as a whole,
155 and then giving new top, bottom, top2, and bottom2 definition (or any subset)
156 at the beginning of each new movement.
157 </P>
158 <P>
159 These contexts are conceptually in a separate coordinate space,
160 which will be overlaid on each page coordinate space.
161 When in these contexts,
162 <A HREF="tags.html#wintag">the _win special tag</A>
163 applies to
164 the header or footer window rather than the space between the header and
165 footer as it does in the music context.
166 </P>
167 <P>
168 Since headers or footers will expand as necessary, the
169 <A HREF="tags.html#wintag">value of _win.s and _win.y</A>
170 may be changed by any of the statements in the context. At any given
171 time, they refer to the boundaries as defined by what has been printed
172 so far. Thus, if the first line of a header contains an 18 point title,
173 after that, _win.s would be 18 points below _win.n.
174 It the header then contained a 12 point title, after that it
175 would be 31 points below _win.n (12 points for the title string, plus 1 point
176 of padding that is added between lines printed).
177 </P>
178 <P>
179 In addition to the &quot;title&quot; commands used in the examples above,
180 you can also use
181 <A HREF="prnttext.html">the "print," "left," "right," or "center" commands.</A>
182 In most
183 cases you will want to use &quot;nl&quot; for the <I>location</I> on those commands
184 to place things. If you don't specify a <I>location</I> for the first of these
185 commands in a header or footer, Mup will start at the left margin, just far
186 enough down from the top to accommodate the text string to be printed.
187 These contexts can also contain settings of the
188 <A HREF="param.html#font">font,</A>
189 <A HREF="param.html#fontfam">fontfamily,</A>
190 and
191 <A HREF="param.html#size">size</A>
192 parameters.
193 These parameter values will be used until the end of the context or until
194 set again to some other value.
195 </P>
196 <HR><P>
197 &nbsp;&nbsp;&nbsp;<A HREF="newscore.html">&lt;-- previous page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Table of Contents</A>&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="macros.html">next page --&gt;</A>
198 </P>
199 </BODY></HTML>