home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / lout2.lzh / LOUT2 / DOC / TR.LOUT / ch1.04 < prev    next >
Text File  |  1994-01-25  |  10KB  |  306 lines

  1. @Section
  2.    @Title { Galleys }
  3.    @Tag { galleys }
  4. @Begin
  5. @PP
  6. It is time to pause and ask ourselves how close we are to achieving our
  7. aim of producing neatly formatted documents.  We can certainly produce
  8. the pieces of a document, using the page layout definitions from Section
  9. {@NumberOf definitions}:
  10. @ID {
  11.  
  12. nohyphen @Break @LittlePageColumn {
  13. @DP
  14. |0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  15. @DP
  16. In the world of music England is supposed to be a mere province.  If she
  17. produces an indifferent composer or performer, that is regarded
  18. elsewhere as perfectly normal and natural; but if foreign students of
  19. musical history have to acknowledge a British musical genius, he is
  20. considered a freak.
  21. @PP
  22. Such a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  23. the world's musical classics, as here, we find that we cannot omit this
  24. English master.
  25. }
  26.  
  27. ||1c
  28.  
  29. @LittlePageColumn
  30. { { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  31. }
  32.  
  33. ||1c
  34.  
  35. @Code {
  36.        @LittlePage { "@TextPlace" //1rt "@FootSect" }
  37. //     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  38. //     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  39. //0.2c 8p @Font "@PageList"
  40. }
  41.  
  42. }
  43. but when we try to merge them together, we encounter two obstacles.
  44. @PP
  45. First, when an object is entered at a certain place in the document, it
  46. appears at that place.  But a footnote is naturally entered immediately
  47. after the point it refers to (`{-2p @Font PURCELL}' in this case), yet it
  48. appears somewhere else: at the bottom of a page.
  49. @PP
  50. Second, all our features build up larger objects out of smaller ones,
  51. but the -2p @Font PURCELL object, for example, must be broken down into
  52. page-sized pieces.  This occurs when the available space at the
  53. `somewhere else' is insufficient to hold the entire object, so this
  54. second obstacle arises out of the first.
  55. @PP
  56. Lout's last major feature, which we introduce to overcome these
  57. obstacles, is the @I galley
  58. galley.feature @Index { Galleys }
  59. (the name is borrowed from the galleys
  60. used in manual typesetting).  A galley is an object plus a cross
  61. reference which points to where the object is to appear.  The example
  62. above has three galleys:
  63. @ID {
  64.  
  65. {
  66. //0.1c
  67.  
  68. nohyphen @Break @LittlePageColumn {
  69. @DP
  70. |0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  71. @DP
  72. In the world of music England is supposed to be a mere province.  If she
  73. produces an indifferent composer or performer, that is regarded
  74. elsewhere as perfectly normal and natural; but if foreign students of
  75. musical history have to acknowledge a British musical genius, he is
  76. considered a freak.
  77. @PP
  78. Such a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  79. the world's musical classics, as here, we find that we cannot omit this
  80. English master.
  81. }  { //0.4c 180d @Rotate @Arrow 2.0c }
  82.  
  83. }
  84.  
  85. ||0io ||4.8c
  86.  
  87. @Code {
  88.        @LittlePage { "@TextPlace" //1rt "@FootSect" }
  89. //     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  90. //     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  91. //0.2c 8p @Font "@PageList"
  92. }  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  93.  
  94. ||0io ||2.0c
  95. {
  96. //3.9c
  97.  
  98. { @Arrow 1.7c }  nohyphen @Break @LittlePageColumn
  99. { { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  100. }
  101. }
  102. }
  103. A galley replaces the invocation pointed to by its cross reference.  If
  104. space is not sufficient there to hold it all, the remainder of the
  105. galley is split off (the vertical concatenation symbol preceding it
  106. being discarded) and it replaces later invocations of the same symbol.
  107. This is exactly what is required to get text and footnotes onto pages.
  108. @PP
  109. To create a galley, first define a symbol with a
  110. special @Code into
  111. into @Index { @Code into clause }
  112. clause, like this:
  113. @ID @Code {
  114. "def @FootNote into { @FootPlace&&following }"
  115. "   right x"
  116. "{"
  117. "   8p @Font x"
  118. "}"
  119. }
  120. An invocation of such a symbol will then be a galley whose object is the
  121. result of the invocation, and whose cross reference is given by the
  122. @Code into clause.  The right parameter of the cross reference must be
  123. either @Code preceding or @Code following.
  124. @PP
  125. A symbol, like @Code "@FootPlace", which is the @I target of a galley,
  126. target @Index { Target of a galley }
  127. must contain the special symbol @@Galley exactly once in its body; often
  128. this is all that the body contains:
  129. @ID @Code {
  130. "def  @FootPlace  {  @Galley  }"
  131. }
  132. It is this special symbol that is replaced by the incoming galley, in
  133. fact, not the @Code "@FootPlace" symbol as a whole.
  134. @PP
  135. A symbol which contains @@Galley, either directly within its body or
  136. indirectly within the body of a symbol it invokes, is called a @I receptive
  137. receptive @Index { Receptive symbol }
  138. symbol, meaning receptive to galleys.  @Code "@FootPlace" is receptive, which
  139. makes @Code "@FootList", @Code "@FootSect" and @Code "@PageList"
  140. receptive since they invoke @Code "@FootPlace".  If no galley replaces
  141. any @@Galley within some invocation of a receptive symbol, that
  142. invocation is replaced by @@Null.  The advantages of this rule for page
  143. layout were explained at the end of Section {@NumberOf definitions}.
  144. @PP
  145. Let us now follow through the construction of our example
  146. document.  Initially there is just the one @I root
  147. root.galley @Index { Root galley }
  148. galley, containing an unexpanded invocation of @Code "@PageList":
  149. @ID { ||5c
  150. 10p @Font @Code "@PageList"  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  151. }
  152. Then the -2p @Font PURCELL galley appears, targeted to a @Code
  153. "@TextPlace".  Lout knows that there is a @Code "@TextPlace" hidden
  154. inside @Code "@PageList", so it expands @Code "@PageList":
  155. @ID {
  156.  
  157. {
  158. //0.1c
  159.  
  160. nohyphen @Break @LittlePageColumn {
  161. @DP
  162. |0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  163. @DP
  164. In the world of music England is supposed to be a mere province.  If she
  165. produces an indifferent composer or performer, that is regarded
  166. elsewhere as perfectly normal and natural; but if foreign students of
  167. musical history have to acknowledge a British musical genius, he is
  168. considered a freak.
  169. @PP
  170. Such a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  171. the world's musical classics, as here, we find that we cannot omit this
  172. English master.
  173. }  { //0.4c 180d @Rotate @Arrow 2.2c }
  174. }
  175.  
  176. ||0io ||5c
  177.  
  178. @Code {
  179.        @LittlePage { "@TextPlace" //1rt "@FootSect" }
  180. //0.2c 8p @Font "@PageList"
  181. }  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  182.  
  183. }
  184. After promoting the first line into @Code "@TextPlace", the footnote
  185. galley attached to it appears and demands an invocation of
  186. @Code "@FootPlace" following its attachment point
  187. (`{-2p @Font PURCELL}').  Such a @Code "@FootPlace" is found at
  188. the bottom of the first page, inside @Code "@FootSect", which is
  189. accordingly expanded, and the footnote is promoted onto the page:
  190. @ID {
  191.  
  192. {
  193. //1.2c
  194.  
  195. nohyphen @Break @LittlePageColumn {
  196. In the world of music England is supposed to be a mere province.  If she
  197. produces an indifferent composer or performer, that is regarded
  198. elsewhere as perfectly normal and natural; but if foreign
  199. students of musical history have to acknowledge a British musical genius,
  200. he is considered a freak.
  201. @PP
  202. Such a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  203. the world's musical classics, as here, we find that we cannot omit this
  204. English master.
  205. }  180d @Rotate @Arrow 2.2c
  206. }
  207.  
  208. ||0io ||5c
  209.  
  210. {
  211. nohyphen @Break @LittleDocument
  212. //
  213. @LittleText {
  214. @DP
  215. |0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  216. @LittleFootNote
  217. { { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  218. //1vx @Code "@FootList"
  219. }
  220. //1vx @Code "@TextPlace" }
  221. //
  222. @LittleEndRun
  223. //0.2c 8p @Font @Code "@PageList"
  224. }  180d @Rotate @Arrow 1i -2p @Font @I {to printer}
  225.  
  226. }
  227. Now the promotion of the -2p @Font PURCELL galley resumes.  When the
  228. first page is filled, Lout searches forwards for another @Code "@TextPlace"
  229. to receive the remainder, once again expanding a @Code "@PageList":
  230. @ID {
  231.  
  232. {
  233. //4.85c
  234.  
  235. nohyphen @Break @LittlePageColumn {
  236. performer, that is regarded
  237. elsewhere as perfectly normal and natural; but if foreign
  238. students of musical history have to acknowledge a British musical genius,
  239. he is considered a freak.
  240. @PP
  241. Such a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  242. the world's musical classics, as here, we find that we cannot omit this
  243. English master.
  244. }  180d @Rotate @Arrow 2.2c
  245. }
  246.  
  247. ||0io ||5c
  248.  
  249. {
  250. nohyphen @Break @LittleDocument
  251. //
  252. @LittleText {
  253. @DP
  254. |0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  255. @LittleFootNote
  256. { { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  257. }
  258. @DP
  259.       @HExpand {In the world of music}
  260. //1vx @HExpand {England is supposed to}
  261. //1vx @HExpand {be a mere province.  If}
  262. //1vx @HExpand {she produces an indifferent composer or}
  263. }
  264. //
  265. @LittleEndRun
  266. //     @LittlePage { @Code "@TextPlace" //1rt @Code "@FootSect" }
  267. //0.2c 8p @Font @Code "@PageList"
  268. }  180d @Rotate @Arrow 1i -2p @Font @I {to printer}
  269.  
  270. }
  271. and so on until the entire galley is promoted.  All these expansions and
  272. replacements are done with total
  273. integrity.  For example, if Lout finds after expanding @Code "@FootSect"
  274. that the page is too full to accept even the first line of the footnote,
  275. @Code "@FootSect" is reset to unexpanded and the search for a target for
  276. the footnote moves on.  And the cross reference direction, @Code
  277. preceding or @Code following, is always obeyed (although lack of space
  278. sometimes prevents Lout from choosing the nearest target).  Only the
  279. root galley contains receptive symbols in our running example, but in
  280. fact any galley may contain them, without restriction.
  281. @PP
  282. When footnotes are placed at the bottom of a page, they appear there in
  283. first come, first served order.  To make galleys appear in sorted order, as
  284. sorted.galley @Index { Sorted galleys }
  285. is needed in bibliographies and indexes, a parameter or nested definition
  286. with the special name @@Key
  287. key. @Index { @@Key parameter }
  288. is added to the galley definition, like this:
  289. @ID @Code {
  290. "def @IndexEntry into { @IndexPlace&&following }"
  291. "   left @Key"
  292. "   right x"
  293. "{ x }"
  294. }
  295. Like @@Tag, @@Key must be set to a simple word when the galley is invoked:
  296. @ID @Code {
  297. "cities @IndexEntry { cities, comparison of, 27 }"
  298. }
  299. and this key is used to sort the galleys.  If several sorted galleys
  300. with the same key are sent to the same place, only one of them is
  301. printed, since the others are probably unwanted duplicates.
  302. @PP
  303. The discussion of galleys is continued at a more detailed level in
  304. Section {@NumberOf targets}.
  305. @End @Section
  306.