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