aboutsummaryrefslogblamecommitdiffstats
path: root/include/bsf
blob: dbf7eebf170d79af3cf9dc88cf7d4bc85cf5deaf (plain) (tree)
1
2
3
4
5
6
7
8
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494


                                                                               
                                                                               


                                                                               
                                                                               









                                                                               


                                                                    



















                                                                               

                                                                           
                                                                           

                                                                           
 
                                                                         
 
 




                                                                           
 
 


































                                                 









                                                                               

                                                                             







                                                                        
                                     






                                                                            

                                                                        


                                                                          



























































































































                                                                               
                                                                   




                                                                         
                                                               














                                                                                


                                                                          


                                                                             



                                                                               
                                                                               


                                                                               

                                                         
 





                                                                 

























































































































































































































































































                                                                                 
                                                                               

















































                                                                               












                                            
















































































                                                                               
                                                                               


                                                                               


                     




                                


                                                                         



                                
                                                                                          
                                                                      
                                            



                 





















                                                                   








                                                                               
                                            



                                        
                                                                               


                                 
                                                                                        






                                                           
                                            



                               
                                                                               


                        
                                                                                        







                                                            
                                            
                            
                                              




                                                                
                                                                             





                                                                          
                                                                           










                                                                          
                                            
                            
                                              





















                                                                   
                                                            




                                                         
                                                                                  
















                                                                          
                                            
                            
                                              







                                                         




                                                 





                                            




                                           












                                                                               




                                               













                                                                               






                                                  
























































                                                                                             







                                                                              











                                                                              
                 
     
                                           


     














                                          









                          

                 
                                                                



                       
     
                                          


               
                 
     










                                                            

     









                                                               









































































































































































































































































































































































































                                                                                      
            
                                                                            







                                                   

















                                                         
                           



















































































                                                                                

###############################################################################
#                                                                             #
#  Lout @BasicSetup package                                                   #
#                                                                             #
#  Jeffrey H. Kingston                                                        #
#  5 February 1999                                                            #
#  Modified 30 October 2002 - reorganization of colours, textures, lengths    #
#                                                                             #
#  Based on the first part of the @DocumentLayout package, version 3.11.      #
#                                                                             #
#  This package contains basic symbols used widely throughout many            #
#  documents, for font changes, particular characters, standard words in      #
#  the current language, date and time, paragraphs, lists, colours,           #
#  rules, and boxes.                                                          #
#                                                                             #
###############################################################################

@SysInclude { lengths }		# @PSLengths
@SysInclude { coltex }		# @ColourCommand and @TextureCommand
@SysPrependGraphic { bsf.lpg }	# rules, boxes, margin note setup


###############################################################################
#                                                                             #
#  The following symbols are defined outside @BasicSetup so that              #
#  they can be invoked when setting its parameters in the @Use clause.        #
#                                                                             #
###############################################################################

def @OrIfPlain
    precedence 80
    left x
    right y
{
    @BackEnd @Case {
	PlainText @Yield y
	else      @Yield x
    }
}

###########################################################################
#                                                                         #
#   @Colour, @Color                                                       #
#                                                                         #
###########################################################################

def @Colour @Color left col right y { {@ColourCommand col} @SetColour y }


###########################################################################
#                                                                         #
#   @Texture                                                              #
#                                                                         #
###########################################################################


def @Texture
    left type
                      named scale	{ 1	}
                      named hscale	{ 1	}
                      named vscale	{ 1	}
    import @PSLengths named angle	{ 0d	}
    import @PSLengths named hshift	{ 0i	}
    import @PSLengths named vshift	{ 0i	}
    import @PSLengths named width	{ "dft"	}
    import @PSLengths named height	{ "dft"	}
    import @PSLengths named gap		{ "dft"	}
    import @PSLengths named radius	{ "dft"	}
    import @PSLengths named linewidth	{ "dft"	}
                      named font	{ "dft"	}
    import @PSLengths named size	{ "dft"	}
                      named value	{ "dft"	}
    right x
{
    { type @TextureCommand
	scale		{ scale		}
	hscale		{ hscale	}
	vscale		{ vscale	}
	angle		{ angle		}
	hshift		{ hshift	}
	vshift		{ vshift	}
	width		{ width		}
	height		{ height	}
	gap		{ gap		}
	radius		{ radius	}
	linewidth	{ linewidth	}
	font		{ font		}
	size		{ size		}
	value		{ value	}
    } @SetTexture x
}


###############################################################################
#                                                                             #
#  Symbols exported by @BasicSetup.                                           #
#                                                                             #
###############################################################################

export

    @InitialFont @InitialBreak @InitialOutdent @InitialSpace @InitialLanguage
    @InitialColour @OptimizePages @HeadingFont
    @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent
    @DisplayNumStyle @WideIndent @VeryWideIndent
    @ListGap @ListIndent @ListRightIndent @ListLabelWidth
    @NumberSeparator

    @Word @Roman @UCRoman @Alpha @UCAlpha @Months @ShortMonths @WeekDays
    @ShortWeekDays @TwelveHours @ShortHours @MeriDiems @ShortMeriDiems

    @Sym @Ding @R @I @B @BI @S @F @II
    "~" "~~" "``" "''" ",," "--" "---" "..."

    @Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling @Yen @Florin
    @Star @Degree @Minute @Second @Multiply @Divide @Lozenge @Register
    @CopyRight @TradeMark @Euro

    @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right
    @NoDotSep @NoDotJoin @Join @Sep @DotSep @ColonSep @DotJoin @DashJoin
    @NumSep @OverStrike @Sup @Sub @FullWidthRule @LocalWidthRule
    @Box @CurveBox @ShadowBox @BoundaryMarks
    @NumberMarker @NumberOf @TitleMarker @TitleOf
    @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink @ExternalLink

    @BeginDisplayCounter

    @Heading "^" "&-" @If @Not @And @Or @True
    @PP @LP @LLP @DP @LOP @NP @CNP

    @BeginAlignedDisplays
    @EndAlignedDisplays

    @Display
    @LeftDisplay
    @IndentedDisplay
    @QuotedDisplay
    @CentredDisplay
    @RightDisplay
    @AlignedDisplay
    @LeftAlignedDisplay
    @IndentedAlignedDisplay
    @QuotedAlignedDisplay
    @CentredAlignedDisplay
    @RightAlignedDisplay
    @NumberedDisplay
    @LeftNumberedDisplay
    @IndentedNumberedDisplay
    @QuotedNumberedDisplay
    @CentredNumberedDisplay
    @RightNumberedDisplay
    @AlignedNumberedDisplay
    @LeftAlignedNumberedDisplay
    @IndentedAlignedNumberedDisplay
    @QuotedAlignedNumberedDisplay
    @CentredAlignedNumberedDisplay
    @RightAlignedNumberedDisplay

    @RawDisplay
    @RawLeftDisplay
    @RawIndentedDisplay
    @RawQuotedDisplay
    @RawCentredDisplay
    @RawRightDisplay
    @RawAlignedDisplay
    @RawLeftAlignedDisplay
    @RawIndentedAlignedDisplay
    @RawQuotedAlignedDisplay
    @RawCentredAlignedDisplay
    @RawRightAlignedDisplay
    @RawNumberedDisplay
    @RawLeftNumberedDisplay
    @RawIndentedNumberedDisplay
    @RawQuotedNumberedDisplay
    @RawCentredNumberedDisplay
    @RawRightNumberedDisplay
    @RawAlignedNumberedDisplay
    @RawLeftAlignedNumberedDisplay
    @RawIndentedAlignedNumberedDisplay
    @RawQuotedAlignedNumberedDisplay
    @RawCentredAlignedNumberedDisplay
    @RawRightAlignedNumberedDisplay

    @ListItem
    @ListInterruptItem
    @ListNewPage
    @DropListItem
    @TagItem
    @DropTagItem

    @EndList
    @RawEndList

    @RawList
    @RawLeftList
    @RawIndentedList
    @RawQuotedList
    @RawCentredList @RawCenteredList
    @RawNumberedList
    @RawParenNumberedList
    @RawRomanList
    @RawParenRomanList
    @RawUCRomanList
    @RawParenUCRomanList
    @RawAlphaList
    @RawParenAlphaList
    @RawUCAlphaList
    @RawParenUCAlphaList
    @RawBulletList
    @RawStarList
    @RawDashList
    @RawTaggedList
    @RawWideTaggedList
    @RawVeryWideTaggedList

    @List
    @LeftList
    @IndentedList
    @QuotedList
    @CentredList @CenteredList
    @NumberedList 
    @ParenNumberedList
    @RomanList
    @ParenRomanList
    @UCRomanList
    @ParenUCRomanList
    @AlphaList
    @ParenAlphaList
    @UCAlphaList
    @ParenUCAlphaList
    @BulletList 
    @StarList 
    @DashList
    @TaggedList
    @WideTaggedList
    @VeryWideTaggedList


###############################################################################
#                                                                             #
#  The @BasicSetup package.                                                   #
#                                                                             #
###############################################################################

def @BasicSetup
    named @InitialFont	  { Times Base 12p	} # initial font
    named @InitialBreak	  { {adjust 1.20fx hyphen} @OrIfPlain
			    {ragged 1fx nohyphen} } # initial break
    named @InitialOutdent { 2f @OrIfPlain 4s	} # initial outdent
    named @InitialSpace	  { lout		} # initial space style
    named @InitialLanguage{ English		} # initial language
    named @InitialColour  { black		} # initial colour
    named @OptimizePages  { No			} # optimize page breaks?
    named @HeadingFont	  { Bold		} # font for @Heading
    named @FixedWidthFont { Courier Base -1p	} # font for @F
    named @ParaGap	  { 1.3vx @OrIfPlain 1f	} # gap between paragraphs
    named @ParaIndent	  { 2.0f @OrIfPlain 5s	} # first-line indent for @PP
    named @DisplayGap	  { 1.0v @OrIfPlain 1f	} # gap above, below displays
    named @DisplayIndent  { 2.0f @OrIfPlain 5s	} # @IndentedDisplay indent
    named @DefaultIndent  { 0.5rt		} # @Display indent
    named @DisplayNumStyle
	right num	  { (num)		} # display number style
    named @WideIndent	  { 4.0f @OrIfPlain 10s	} # @WideTaggedList indent
    named @VeryWideIndent { 8.0f @OrIfPlain 20s	} # @VeryWideTaggedList indent
    named @ListOuterGap	  { 1.0v @OrIfPlain 1f	} # gap before, after list
    named @ListGap	  { 1.0v @OrIfPlain 1f	} # gap between list items
    named @ListIndent	  { 0s			} # indent of list items
    named @ListRightIndent{ 0s			} # right indent of list items
    named @ListLabelWidth { 2.0f @OrIfPlain 5s	} # width allowed for list tags
    named @NumberSeparator{ .			} # separates numbers like 2.3.7
    import @BasicSetup
    named @CrossLinkFormat
	right @Body	  { @Body		} # format for cross links
    import @BasicSetup
    named @ExternalLinkFormat
	right @Body	  { @Body		} # format for external links
@Begin

    ###########################################################################
    #                                                                         #
    #   @Sym, @Ding font symbols, and miscellaneous special characters.       #
    #                                                                         #
    ###########################################################################

    def @Sym  right x { { Symbol Base } @Font @Char x	}
    def @Ding right x { { Dingbats Base } @Font @Char x	}

    def @R    right x { Base @Font x			}
    def @I    right x { Slope @Font x			}
    def @B    right x { Bold @Font x			}
    def @BI   right x { BoldSlope @Font x		}
    def @S    right x { smallcaps @Font x		}
    def @F    right x { @FixedWidthFont @Font x 		}

    def @II
	right x
    {
	{ @CurrFace @Case {
	    Bold @Yield BoldSlope
	    else @Yield Slope
	} } @Font x
    }

    def "~"  left x right y { x &1su y }
    def "~~" left x right y { x &2s y }

    def "``"       { @Char "quotedblleft"	@OrIfPlain "``"	}
    def "''"       { @Char "quotedblright"	@OrIfPlain "''"	}
    def ",,"       { @Char "quotedblbase"	@OrIfPlain ",,"	}
    def "--"       { @Char "endash"		@OrIfPlain "--"	}
    def "---"      { @Char "emdash"		@OrIfPlain "---"}
    def "..."      { @Char "ellipsis"		@OrIfPlain "..."}
    def @Bullet    { @Char "bullet"		@OrIfPlain "o"	}
    def @ParSym    { @Char "paragraph"		@OrIfPlain "P"	}
    def @SectSym   { @Char "section"		@OrIfPlain "$"	}
    def @Dagger    { @Char "dagger"		@OrIfPlain "+"	}
    def @DaggerDbl { @Char "daggerdbl"		@OrIfPlain "++"	}
    def @CDot      { @Char "periodcentered"	@OrIfPlain "."	}
    def @Sterling  { @Char "sterling"		@OrIfPlain "&"	}
    def @Yen       { @Char "yen"		@OrIfPlain "Y"	}
    def @Florin    { @Char "florin"		@OrIfPlain "f"	}

    def @Star      { @Sym  "asteriskmath"	@OrIfPlain "*"	}
    def @Degree    { @Sym  "degree"		@OrIfPlain "o"	}
    def @Minute    { @Sym  "minute"		@OrIfPlain "'"	}
    def @Second    { @Sym  "second"		@OrIfPlain "''"	}
    def @Multiply  { @Sym  "multiply"		@OrIfPlain "x"	}
    def @Divide    { @Sym  "divide"		@OrIfPlain "/"	}
    def @Lozenge   { @Sym  "lozenge"		@OrIfPlain "O"	}
    def @Register  { @Sym  "registersans"	@OrIfPlain "R"	}
    def @CopyRight { @Sym  "copyrightsans"	@OrIfPlain "C"	}
    def @TradeMark { @Sym  "trademarksans"	@OrIfPlain "TM"	}

    def @Euro
    {
	@BackEnd @Case {

	    PostScript @Yield {
		0.65w @VShift @VContract @HContract
		"xsize ysize ysize 0.07 mul louteuro" @Graphic {
		    0.7f @High 0.735f @Wide
		}
	    }

	    PDF @Yield { EUR }

	    PlainText @Yield { EUR }
	}
    }


    ###########################################################################
    #                                                                         #
    #  Symbols stored in the "standard" database                              #
    #                                                                         #
    #    @Word            language-spacific words such as Chapter, etc.       #
    #    @Roman           lower case Roman numerals i, ii, ... , cc           #
    #    @UCRoman         upper case Roman numerals I, II, ... , CC           #
    #    @Alpha           lower case Roman alphabet a, b,  ... , z            #
    #    @UCAlpha         upper case Roman alphabet A, B,  ... , Z            #
    #    @Months          months of the year:  January, ... , December        #
    #    @ShortMonths     months of the year, abbreviated:  Jan, ..., Dec     #
    #    @WeekDays        days of the week:  Sunday, ... , Saturday           #
    #    @ShortWeekDays   days of the week, abbreviated:  Sun, ... , Sat      #
    #    @TwelveHours     hours, from 1 to 12                                 #
    #    @ShortHours      hours, from 0 to 23                                 #
    #    @DateTimeFormat  format of results of @Date and @Time                #
    #                                                                         #
    ###########################################################################

    def @Word		left @Tag right @Val { @Val }
    def @Roman		left @Tag right @Val { @Val }
    def @UCRoman	left @Tag right @Val { @Val }
    def @Alpha		left @Tag right @Val { @Val }
    def @UCAlpha	left @Tag right @Val { @Val }
    def @Months		left @Tag right @Val { @Val }
    def @ShortMonths	left @Tag right @Val { @Val }
    def @WeekDays	left @Tag right @Val { @Val }
    def @ShortWeekDays	left @Tag right @Val { @Val }
    def @TwelveHours  	left @Tag right @Val { @Val }
    def @ShortHours  	left @Tag right @Val { @Val }
    def @MeriDiems  	left @Tag right @Val { @Val }
    def @ShortMeriDiems	left @Tag right @Val { @Val }

    export @Value
    def @DateTimeFormat	left @Tag
	named @Value
	    named @Year          {}
	    named @ShortYear     {}
	    named @Month         {}
	    named @ShortMonth    {}
	    named @MonthNum      {}
	    named @Day           {}
	    named @ShortDay      {}
	    named @DayNum        {}
	    named @MeriDiem      {}
	    named @ShortMeriDiem {}
	    named @Hour          {}
	    named @TwelveHour    {}
	    named @ShortHour     {}
	    named @Minute        {}
	    named @Second        {}
	{}
    {}

    @SysDatabase @Word @Roman @UCRoman @Alpha @UCAlpha @Months
		 @ShortMonths @WeekDays @ShortWeekDays @TwelveHours
		 @ShortHours @MeriDiems @ShortMeriDiems @DateTimeFormat
    { standard  }


    ###########################################################################
    #                                                                         #
    #  @Date and @Time: the date and time now.                                #
    #                                                                         #
    ###########################################################################

    def @Date
	named @Format
	    named @Year         { @Moment&&now @Open { {@Century}@Year         }}
	    named @ShortYear    { @Moment&&now @Open { @Year                   }}
	    named @Month        { @Moment&&now @Open { @Months&&@Month         }}
	    named @ShortMonth   { @Moment&&now @Open { @ShortMonths&&@Month    }}
	    named @MonthNum     { @Moment&&now @Open { @Month                  }}
	    named @Day          { @Moment&&now @Open { @WeekDays&&@WeekDay     }}
	    named @ShortDay     { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}}
	    named @DayNum       { @Moment&&now @Open { @Day                    }}
	    named @MeriDiem     { @Moment&&now @Open { @MeriDiems&&@Hour       }}
	    named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour  }}
	    named @Hour         { @Moment&&now @Open { @Hour                   }}
	    named @TwelveHour   { @Moment&&now @Open { @TwelveHours&&@Hour     }}
	    named @ShortHour    { @Moment&&now @Open { @ShortHours&&@Hour      }}
	    named @Minute       { @Moment&&now @Open { @Minute                 }}
	    named @Second       { @Moment&&now @Open { @Second                 }}
	{
	    @DateTimeFormat&&date @Open { @Value
		@Year          { @Year }
		@ShortYear     { @ShortYear }
		@Month         { @Month }
		@ShortMonth    { @ShortMonth }
		@MonthNum      { @MonthNum }
		@Day           { @Day }
		@ShortDay      { @ShortDay }
		@DayNum        { @DayNum }
		@MeriDiem      { @MeriDiem }
		@ShortMeriDiem { @ShortMeriDiem }
		@Hour          { @Hour }
		@TwelveHour    { @TwelveHour }
		@ShortHour     { @ShortHour }
		@Minute        { @Minute }
		@Second        { @Second }
	    }
	}
    { @Format }

    def @Time
	named @Format
	    named @Year         { @Moment&&now @Open { {@Century}@Year         }}
	    named @ShortYear    { @Moment&&now @Open { @Year                   }}
	    named @Month        { @Moment&&now @Open { @Months&&@Month         }}
	    named @ShortMonth   { @Moment&&now @Open { @ShortMonths&&@Month    }}
	    named @MonthNum     { @Moment&&now @Open { @Month                  }}
	    named @Day          { @Moment&&now @Open { @WeekDays&&@WeekDay     }}
	    named @ShortDay     { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}}
	    named @DayNum       { @Moment&&now @Open { @Day                    }}
	    named @MeriDiem     { @Moment&&now @Open { @MeriDiems&&@Hour       }}
	    named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour  }}
	    named @Hour         { @Moment&&now @Open { @Hour                   }}
	    named @TwelveHour   { @Moment&&now @Open { @TwelveHours&&@Hour     }}
	    named @ShortHour    { @Moment&&now @Open { @ShortHours&&@Hour      }}
	    named @Minute       { @Moment&&now @Open { @Minute                 }}
	    named @Second       { @Moment&&now @Open { @Second                 }}
	{
	    @DateTimeFormat&&time @Open { @Value
		@Year          { @Year }
		@ShortYear     { @ShortYear }
		@Month         { @Month }
		@ShortMonth    { @ShortMonth }
		@MonthNum      { @MonthNum }
		@Day           { @Day }
		@ShortDay      { @ShortDay }
		@DayNum        { @DayNum }
		@MeriDiem      { @MeriDiem }
		@ShortMeriDiem { @ShortMeriDiem }
		@Hour          { @Hour }
		@TwelveHour    { @TwelveHour }
		@ShortHour     { @ShortHour }
		@Minute        { @Minute }
		@Second        { @Second }
	    }
	}
    { @Format }


    ###########################################################################
    #                                                                         #
    #  @DropCapTwo and @DropCapThree                                          #
    #                                                                         #
    ###########################################################################

    def @DropCapTwo
	left y
	named height { 1.5v }
	right x
    {
	def @ParPlace { @Galley }
	def @EndParPlace { @Galley }

	def @LineList
	{
	    @PAdjust @ParPlace
	    //1vx @LineList
	}

	def @ParGalley horizontally into { @ParPlace&&preceding }
	    right x
	{
	    x
	}

	def @EndPar force into { @EndParPlace&&following } { @Null }

	def @Cap
	{
	    -0.25f @VShift 1.0w @VShift {
		-90d @Rotate height @Wide @Scale 90d @Rotate y
	    }
	}

						  |1s @PAdjust @ParPlace 
	/1vo  @Cap @ParGalley {x & @EndPar &1rt } |   @PAdjust @ParPlace
	//1vx @LineList
	//    @EndParPlace
    }

    def @DropCapThree
	left y
	named height { 2.5v }
	right x
    {
	def @ParPlace { @Galley }
	def @EndParPlace { @Galley }

	def @LineList
	{
	    @PAdjust @ParPlace
	    //1vx @LineList
	}

	def @ParGalley force horizontally into { @ParPlace&&preceding }
	    right x
	{
	    x
	}

	def @EndPar force into { @EndParPlace&&following } { @Null }

	def @Cap
	{
	    -0.25f @VShift 1.0w @VShift {
		-90d @Rotate height @Wide @Scale 90d @Rotate y
	    }
	}

						|1s @PAdjust @ParPlace 
	/1vo  @ParGalley { x & @EndPar &1rt }	|   @PAdjust @ParPlace
	/1vo  @Cap				|   @PAdjust @ParPlace
	//1vx @LineList
	//    @EndParPlace
    }


    ###########################################################################
    #                                                                         #
    #  @Centre, @Center, @Right, @NoDotSep, @NoDotJoin, @DotSep,              #
    #  @ColonSep, @DotJoin, @DashJoin, @NumSep                                #
    #                                                                         #
    ###########################################################################

    macro @Centre @Center { |0.5rt @HContract }

    def @Right
	precedence 50
	left x
	right y
    { x |1.0rt @OneCol { 2f @Wide {} | y } }

    def @NoDotSep left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x |2s y }
		}
	    }
	}
    }

    def @NoDotJoin left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
	        y @Case {
		    {}   @Yield x
		    else @Yield { x{y} }
	        }
	    }
	}
    }

    def @DotSep left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x. |2s y }
		}
	    }
        }
    }

    def @ColonSep left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x: |2s y }
		}
	    }
        }
    }

    def @DotJoin left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x.y }
		}
	    }
	}
    }

    def @DashJoin left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x--y }
		}
	    }
        }
    }

    def @NumSep left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield {
			@CurrLang @Case {
			    Hungarian @Yield { y. x }
			    else      @Yield { x y }
			}
		    }
		}
	    }
        }
    }


    ###########################################################################
    #                                                                         #
    #   @OverStrike, @Sup and @Sub                                            #
    #                                                                         #
    ###########################################################################

    def @OverStrike left x right y
    {
	@OneRow { @HContract @VContract x /0io @HContract @VContract y }
    }

    def @Sup
	left x
	named gap { 0.40fk }
	right y
    {
	@HContract @VContract
	{
	    | 0.7f @Font y ^/gap x
	}
    }

    def @Sub
	left x
	named gap { 0.40fk }
	right y
    {
	@HContract @VContract
	{
	    x /gap | 0.7f @Font y
	}
    }


    ###########################################################################
    #                                                                         #
    #   @AddPaint, @StrokeCommand                                             #
    #                                                                         #
    ###########################################################################

    def @AddPaint
        left col
	right texture
    {
	col @Case {
	    none @Yield ""
	    nochange @Yield {
		@BackEnd @Case {
		    PostScript @Yield { "gsave" texture "fill grestore" }
		    PDF        @Yield { "q f Q" }
		    PlainText  @Yield { "" }
		}
	    }
	    else @Yield {
		@BackEnd @Case {
		    PostScript @Yield {"gsave" @ColourCommand col texture "fill grestore"}
		    PDF        @Yield { "q" @ColourCommand col "f Q" }
		    PlainText  @Yield { "" }
		}
	    }
	}
    }

    def @StrokeCommand right linewidth
    {
	@BackEnd @Case {
	    PostScript @Yield {
		linewidth @Case {
		    ""   @Yield { "stroke" }
		    none @Yield { }
		    else @Yield { linewidth "setlinewidth stroke" }
		}
	    }
	    PDF @Yield {
		linewidth @Case {
		    ""   @Yield { "S" }
		    none @Yield { }
		    else @Yield { linewidth "w S" }
		}
	    }
	    else @Yield ""
	}
    }



    ###########################################################################
    #                                                                         #
    #   @FullWidthRule, @Box, @CurveBox, and @ShadowBox                       #
    #                                                                         #
    ###########################################################################

    def @FullWidthRule
	import @PSLengths named linewidth {}
    {
	@BackEnd @Case {

	    PostScript @Yield @HExpand {
		{ "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High }
	    }

	    PDF @Yield @HExpand {
		{ "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High }
	    }

	    PlainText @Yield { "-" @PlainGraphic 1f @High }
	}
    }

    def @LocalWidthRule
	import @PSLengths named linewidth {}
    {
	@BackEnd @Case {

	    PostScript @Yield {
		{ "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High }
	    }

	    PDF @Yield {
		{ "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High }
	    }

	    PlainText  @Yield { "-" @PlainGraphic 1f @High }
	}
    }

    def @Box
	named margin { 0.3f }
	import @PSLengths named linewidth {}
	named paint { none }
	import @TextureImport named texture {}
	right x
    {
	@BackEnd @Case {

	    PostScript @Yield @VContract @HContract 0c @HShift {
		{"LoutBox" paint @AddPaint texture @StrokeCommand linewidth }
		@Graphic
		{ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
	    }

	    PDF @Yield @VContract @HContract 0c @HShift {
		{ "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h"
		paint @AddPaint texture @StrokeCommand linewidth } @Graphic
		{ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
	    }

	    PlainText @Yield @VContract @HContract 0c @HShift {
		^/margin ^|margin 0c @HShift @OneRow x |margin /margin
	    }
	}
    }

    def @CurveBox
	named margin { 0.3f }
	import @PSLengths named linewidth {}
	named paint { none }
	import @TextureImport named texture {}
	right x
    {
	def @PDFStuff
	{
	    "__xmark 0 m"
	    "__sub(__xsize, __xmark) 0 l"
	    "__sub(__xsize, __div(__mul(11, __xmark), 24)) 0"
	    "__xsize __div(__mul(11, __xmark), 24)"
	    "__xsize __xmark c"
	    "__xsize __sub(__ysize, __xmark) l"
	    "__xsize __sub(__ysize, __div(__mul(11, __xmark), 24))"
	    "__sub(__xsize, __div(__mul(11, __xmark), 24)) __ysize"
	    "__sub(__xsize, __xmark) __ysize c"
	    "__xmark __ysize l"
	    "__div(__mul(11, __xmark), 24) __ysize"
	    "0 __sub(__ysize, __div(__mul(11, __xmark), 24))"
	    "0 __sub(__ysize, __xmark) c"
	    "0 __xmark l"
	    "0 __div(__mul(11, __xmark), 24)"
	    "__div(__mul(11, __xmark), 24) 0"
	    "__xmark 0 c"
	    "h"
	    paint @AddPaint texture @StrokeCommand linewidth
	}

	@VContract @HContract 0c @HShift @BackEnd @Case {

	    PostScript @Yield {
		{"LoutCurveBox" paint @AddPaint texture @StrokeCommand linewidth }
		@Graphic
		{ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
	    }

	    PlainText @Yield {
		^/margin ^|margin 0c @HShift @OneRow x |margin /margin
	    }

	    PDF @Yield {
		@PDFStuff @Graphic
		{ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
	    }
	}
    }

    def @ShadowBox
	named margin { 0.3f }
	import @PSLengths named linewidth {}
	named paint { none }
	import @TextureImport named texture {}
	named shadow { 0.2f }
	right x
    {
	@VContract @HContract 0c @HShift @BackEnd @Case {

	    PostScript @Yield {
		"LoutShadowBox fill" @Graphic
		{ ^/shadow ^|shadow 0c @HShift
		      @Box
			  margin {margin}
			  paint {paint}
			  texture { texture }
			  linewidth {linewidth} x
		      |shadow /shadow
		}
	    }

	    PlainText @Yield {
		^/shadow ^|shadow 0c @HShift
		@Box
		    margin { margin }
		    paint { paint }
		    texture { texture }
		    linewidth {linewidth} x
		|shadow /shadow
	    } 

	    PDF @Yield {
		{
		  "__mul(__xmark, 2) 0 m __xsize 0 l"
		  "__xsize __sub(__ysize, __mul(__xmark, 2)) l"
		  "__sub(__xsize, __xmark) __sub(__ysize, __mul(__xmark, 2)) l"
		  "__sub(__xsize, __xmark) __xmark l"
		  "__mul(__xmark, 2) __xmark l h f"
		}
		@Graphic
		{ ^/shadow ^|shadow 0c @HShift
		  @Box
		      margin { margin }
		      paint { paint }
		      texture { texture }
		      linewidth { linewidth } x
		  |shadow /shadow
		}
	    }
	}
    }


    ###########################################################################
    #                                                                         #
    #   @BoundaryMarks                                                        #
    #                                                                         #
    ###########################################################################

    def @BoundaryMarks
	import @PSLengths named linewidth { 0.2p }
	import @PSLengths named length { 0.5c }
	import @PSLengths named gap { 0.5c }
	import @PSLengths named lout { 0c }
	import @PSLengths named rout { 0c }
	import @PSLengths named uout { 0c }
	import @PSLengths named dout { 0c }
    {
	def @UpStroke    { "0" gap       "rmoveto" "0" length     "rlineto" }
	def @DownStroke  { "0" gap "neg" "rmoveto" "0" length "neg rlineto" }
	def @LeftStroke  { gap "neg" "0" "rmoveto" length "neg" "0 rlineto" }
	def @RightStroke { gap "0"       "rmoveto" length       "0 rlineto" }

	def @LLSpot { lout "neg"             dout "neg" moveto }
	def @LRSpot { xsize rout "add"       dout "neg" moveto }
	def @ULSpot { lout "neg"       ysize uout "add" moveto }
	def @URSpot { xsize rout "add" ysize uout "add" moveto }

	def @PDFStuff {
	    "__sub(-"gap", "lout")            __sub(0, "dout") m "
	    "__sub(__sub(-"gap", "lout"), "length") __sub(0, "dout") l"
	    "__sub(0, "lout")       __sub(-"gap", "dout") m "
	    "__sub(0, "lout") __sub(__sub(-"gap", "dout"), "length") l"
	    "__add(__xsize,"rout")       __sub(-"gap", "dout") m "
	    "__add(__xsize,"rout") __sub(__sub(-"gap", "dout"), "length") l"
	    "__add(__add(__xsize,"rout"),"gap")           __sub(0, "dout") m "
	    "__add(__add(__add(__xsize,"rout"),"gap"),"length") __sub(0, "dout") l"
	    "      __sub(__sub(0, "lout"), "gap")            __add(__ysize, "uout") m "
	    "__sub(__sub(__sub(0, "lout"), "gap"), "length") __add(__ysize, "uout") l"
	    "__sub(0, "lout")       __add(__add(__ysize, "uout"), "gap") m "
	    "__sub(0, "lout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l"
	    "      __add(__add(__xsize, "rout"), "gap")            __add(__ysize, "uout") m "
	    "__add(__add(__add(__xsize, "rout"), "gap"), "length") __add(__ysize, "uout") l"
	    "__add(__xsize, "rout")       __add(__add(__ysize, "uout"), "gap") m "
	    "__add(__xsize, "rout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l"

	    linewidth "w S"
	}

	@BackEnd @Case {

	    PostScript @Yield {
		{
		    @LLSpot @LeftStroke
		    @LLSpot @DownStroke
		    @LRSpot @DownStroke
		    @LRSpot @RightStroke
		    @ULSpot @LeftStroke
		    @ULSpot @UpStroke
		    @URSpot @RightStroke
		    @URSpot @UpStroke
	
		    linewidth "setlinewidth stroke"
		} @Graphic {}
	    }

	    PlainText @Yield ""

	    PDF @Yield { @PDFStuff @Graphic {} }
	}
    }

    ##########################################################################
    #                                                                        #
    #  @NumberMarker, @NumberOf, @TitleMarker, @TitleOf,                     #
    #  @PageMark, @PageOf, @CrossLink, @ExternalLink                         #
    #                                                                        #
    #  NB the default value ?? is desperately important for unsorted         #
    #  reference lists numbered by first appearance (@NumberOf @Tag),        #
    #  because it is the special sort key value that prevents merging,       #
    #  hence allowing all the references to be printed even though           #
    #  their sort keys are all ?? initially.                                 #
    #                                                                        #
    ##########################################################################

    export @Tag @Value
    def @NumberMarker
	named @Tag {}
	named @Value { "??" }
    {
	@Null
    }

    def @NumberOf
	right tag
    {
	@NumberMarker&&tag @Open { @Value }
    }


    export @Tag @Value
    def @TitleMarker
	named @Tag {}
	named @Value { "??" }
    {
	@Null
    }

    def @TitleOf
	right tag
    {
	@TitleMarker&&tag @Open { @Value }
    }


    export num rawnum @Tag
    def @PageMarker
	named @Tag {}
	named num {}
	named rawnum {}
    {
	@PageLabel num
    }

    def @PageMark
	right tag
    {
	tag @LinkDest @Null & @PageMarker&&preceding @Tagged tag
    }

    def @NoLinkPageMark
	right tag
    {
	@PageMarker&&preceding @Tagged tag
    }

    def @PageOf
	right tag
    {
	@PageMarker&&tag @Open { num }
    }

    def @CrossLink
	left tag
	named @Format right @Body { @CrossLinkFormat @Body }
	right obj
    {
	@HContract @VContract {
	    tag @LinkSource @Format obj
	}
    }

    def @ExternalLink
	left tag
	named @Format right @Body { @ExternalLinkFormat @Body }
	right obj
    {
	@HContract @VContract {
	    tag @URLLink @Format obj
	}
    }


    ###########################################################################
    #                                                                         #
    #  @Join and @Sep                                                         #
    #                                                                         #
    #  Join two objects together with @NumberSeparator, unless one is         #
    #  empty in which case just return the other.                             #
    #                                                                         #
    ###########################################################################

    def @Join left x right y
    {
        x @Case {
	    {}   @Yield y
	    else @Yield {
	        y @Case {
		    {}   @Yield x
		    else @Yield { x{@NumberSeparator}y }
	        }
	    }
        }
    }

    def @Sep left x right y
    {
	x @Case {
	    {}   @Yield y
	    else @Yield {
		y @Case {
		    {}   @Yield x
		    else @Yield { x{@NumberSeparator} |2s y }
		}
	    }
        }
    }


    ###########################################################################
    #                                                                         #
    #  Miscellaneous.                                                         #
    #                                                                         #
    ###########################################################################

    def @Heading       right x { ragged @Break @HeadingFont      @Font x }
    def "^"		       { {} ^& {}				 }
    def "&-"  left x   right y { x &0ch y				 }


    ###########################################################################
    #                                                                         #
    #  @If @Not @And @Or @True                                                #
    #                                                                         #
    #  Used in databases to make optional fields format nicely.               #
    #                                                                         #
    ###########################################################################

    def @If
	precedence 97
	left x
	right y
    {
	y @Case {
	    {} @Yield @Null
	    else @Yield { @Null{x} }
	}
    }

    def @Not
	precedence 100
	right y
    {
	y @Case {
	    {} @Yield "*"
	    else @Yield ""
	}
    }

    def @And
	precedence 99
	left x
	right y
    {
	x @Case {
	   {} @Yield {}
	   else @Yield y
	}
    }

    def @Or
	precedence 98
	left x
	right y
    {
	x @Case {
	   {} @Yield y
	   else @Yield x
	}
    }

    def @True { "*" }


    ###########################################################################
    #                                                                         #
    #  Paragraphs.                                                            #
    #                                                                         #
    ###########################################################################

    macro @PP	{ //@ParaGap @ParaIndent @Wide &{0i}	}
    macro @LP	{ //{@ParaGap}			  	}
    macro @LLP	{ //{1vx}				}
    macro @DP	{ //{@DisplayGap}			}
    macro @LOP	{ //{@ListOuterGap}			}
    macro @NP	{ //{1.1b}				}
    macro @CNP	{ // 3.2v @High //0io //{}		}


    ###########################################################################
    #                                                                         #
    #  Beginning and ending of aligned displays.                              #
    #                                                                         #
    ###########################################################################

    def @APlace            { @Galley }
    def @EndAlignedPlace   { @Galley }
    def @AlignedPlace      { @Galley }

    def @BAligned into { @APlace&&preceding }
    {
	def @AlignedList { @AlignedPlace /1.1b @AlignedList }

	//1.1b @AlignedList
	//     @EndAlignedPlace
    }

    macro @BAD @BeginAlignedDisplays { // @APlace | @BAligned }
    def   @EAD @EndAlignedDisplays force into { @EndAlignedPlace&&preceding } {}


    ###########################################################################
    #                                                                         #
    #  New code for numbered displays that will cross section boundaries      #
    #                                                                         #
    ###########################################################################

    export @Tag val
    def @NumDispCounterMarker
	named @Tag {}
	named val {}
    {
	@Null
    }

    def @NumDispNum right tag
    {
	@NumDispCounterMarker&&tag @Open { @Next val }
    }

    def @NumDispCounterIncrement
	right tag
    {
	@NumDispCounterMarker&&preceding @Tagged tag
	@NumDispCounterMarker val { @NumDispNum tag }
	@NumberMarker @Tag { tag } @Value { @NumDispNum tag }
    }

    def @NN
    {
	@NumDispCounterMarker&&preceding @Open { @DisplayNumStyle val }
    }

    def @Do
        left x
        right y
    {
        x @Case {
            { No None } @Yield @Null
            else        @Yield y
        }
    }

    def @BeginDisplayCounter
	left condition
	right prefix
    {
	condition @Do @NumDispCounterMarker val { prefix @Join 0 }
    }


    ###########################################################################
    #                                                                         #
    #  Galleys that carry displays to their places.                           #
    #                                                                         #
    ###########################################################################

    def @DispPlace { @Galley }

    def @Disp into { @DispPlace&&preceding }
	right x
    {
	x
    }

    def @NDisp into { @DispPlace&&preceding }
	named @Tag {}
	right x
    {
	@OneRow {
	   @NumDispCounterIncrement @Tag
	   @PageMark @Tag
	   ^//
	   @OneRow x
	}
    }

    def @ADisp into { @AlignedPlace&&preceding }
	right x
    {
	x
    }

    def @ANDisp into { @AlignedPlace&&preceding }
	named @Tag {}
	right x
    {
	@OneRow {
	   @NumDispCounterIncrement @Tag
	   @PageMark @Tag
	   ^/
	   @OneRow x
	}
    }


    ###########################################################################
    #                                                                         #
    #  Displays and raw displays.                                             #
    #                                                                         #
    ###########################################################################

    macro @G  { |@DefaultIndent      }
    macro @LG { |                    }
    macro @IG { |@DisplayIndent      }
    macro @CG { |0.5rt               }
    macro @RG { |1.0rt               }
    macro @QR { @DisplayIndent @Wide { |1rt @NN } }
    macro @DX { @DispPlace           }
    macro @DY { @Disp                }
    macro @AX { @APlace              }
    macro @AY { @ADisp               }
    macro @NY { @NDisp               }
    macro @MY { @ANDisp              }

    macro @D	 @Display			{ @DP @G   @DX  |         @DP // @DY }
    macro @LD	 @LeftDisplay			{ @DP @LG  @DX  |         @DP // @DY }
    macro @ID	 @IndentedDisplay		{ @DP @IG  @DX  |         @DP // @DY }
    macro @QD	 @QuotedDisplay			{ @DP @IG  @DX  @IG       @DP // @DY }
    macro @CD	 @CentredDisplay
		 @CenteredDisplay		{ @DP @CG  @DX  |         @DP // @DY }
    macro	 @RightDisplay			{ @DP @RG  @DX  |         @DP // @DY }


    macro @AD	 @AlignedDisplay		{ @DP @G   @AX  |         @DP // @AY }
    macro @LAD	 @LeftAlignedDisplay		{ @DP @LG  @AX  |         @DP // @AY }
    macro @IAD	 @IndentedAlignedDisplay	{ @DP @IG  @AX  |         @DP // @AY }
    macro @QAD	 @QuotedAlignedDisplay		{ @DP @IG  @AX  @IG       @DP // @AY }
    macro @CAD	 @CentredAlignedDisplay
		 @CenteredAlignedDisplay	{ @DP @CG  @AX  |         @DP // @AY }
    macro        @RightAlignedDisplay		{ @DP @RG  @AX  |         @DP // @AY }

    macro @ND	 @NumberedDisplay		{ @DP @G   @DX  |1rt @NN  @DP // @NY }
    macro @LND	 @LeftNumberedDisplay		{ @DP @LG  @DX  |1rt @NN  @DP // @NY }
    macro @IND	 @IndentedNumberedDisplay	{ @DP @IG  @DX  |1rt @NN  @DP // @NY }
    macro @QND	 @QuotedNumberedDisplay		{ @DP @IG  @DX  |1rt @QR  @DP // @NY }
    macro @CND	 @CentredNumberedDisplay
		 @CenteredNumberedDisplay	{ @DP @CG  @DX  |1rt @NN  @DP // @NY }
    macro	 @RightNumberedDisplay		{ @DP @RG  @DX  |1rt @NN  @DP // @NY }

    macro @AND	 @AlignedNumberedDisplay	{ @DP @G   @AX  |1rt @NN  @DP // @MY }
    macro @LAND	 @LeftAlignedNumberedDisplay	{ @DP @LG  @AX  |1rt @NN  @DP // @MY }
    macro @IAND	 @IndentedAlignedNumberedDisplay{ @DP @IG  @AX  |1rt @NN  @DP // @MY }
    macro @QAND  @QuotedAlignedNumberedDisplay	{ @DP @IG  @AX  |1rt @QR  @DP // @MY }
    macro @CAND	 @CentredAlignedNumberedDisplay
		 @CenteredAlignedNumberedDisplay{ @DP @CG  @AX  |1rt @NN  @DP // @MY }
    macro	 @RightAlignedNumberedDisplay	{ @DP @RG  @AX  |1rt @NN  @DP // @MY }


    macro @RD	 @RawDisplay			{     @G   @DX  |         // @DY }
    macro @RLD	 @RawLeftDisplay		{     @LG  @DX  |         // @DY }
    macro @RID	 @RawIndentedDisplay		{     @IG  @DX  |         // @DY }
    macro @RQD	 @RawQuotedDisplay		{     @IG  @DX  @IG |     // @DY }
    macro @RCD	 @RawCentredDisplay
		 @RawCenteredDisplay		{     @CG  @DX  | |       // @DY }
    macro @RRD	 @RawRightDisplay		{     @RG  @DX  |         // @DY }


    macro @RAD	 @RawAlignedDisplay		{     @G   @AX  |         // @AY }
    macro @RLAD	 @RawLeftAlignedDisplay		{     @LG  @AX  |         // @AY }
    macro @RIAD	 @RawIndentedAlignedDisplay	{     @IG  @AX  |         // @AY }
    macro @RQAD	 @RawQuotedAlignedDisplay	{     @IG  @AX  @IG |     // @AY }
    macro @RCAD	 @RawCentredAlignedDisplay
		 @RawCenteredAlignedDisplay	{     @CG  @AX  |         // @AY }
    macro @RRAD  @RawRightAlignedDisplay	{     @RG  @AX  |         // @AY }

    macro @RND	 @RawNumberedDisplay		{     @G   @DX  |1rt @NN  // @NY }
    macro @RLND	 @RawLeftNumberedDisplay	{     @LG  @DX  |1rt @NN  // @NY }
    macro @RIND	 @RawIndentedNumberedDisplay	{     @IG  @DX  |1rt @NN  // @NY }
    macro @RQND	 @RawQuotedNumberedDisplay	{     @IG  @DX  |1rt @QR  // @NY }
    macro @RCND	 @RawCentredNumberedDisplay
		 @RawCenteredNumberedDisplay	{     @CG  @DX  |1rt @NN  // @NY }
    macro @RRND	 @RawRightNumberedDisplay	{     @RG  @DX  |1rt @NN  // @NY }

    macro @RAND	 @RawAlignedNumberedDisplay	{     @G   @AX  |1rt @NN  // @MY }
    macro @RLAND @RawLeftAlignedNumberedDisplay {     @LG  @AX  |1rt @NN  // @MY }
    macro @RIAND @RawIndentedAlignedNumberedDisplay { @IG  @AX  |1rt @NN  // @MY }
    macro @RQAND @RawQuotedAlignedNumberedDisplay {   @IG  @AX  |1rt @QR  // @MY }
    macro @RCAND @RawCentredAlignedNumberedDisplay
		 @RawCenteredAlignedNumberedDisplay { @CG  @AX  |1rt @NN  // @MY }
    macro @RRAND @RawRightAlignedNumberedDisplay{     @RG  @AX  |1rt @NN  // @MY }


    ###########################################################################
    #                                                                         #
    #  Lists and raw lists.                                                   #
    #                                                                         #
    ###########################################################################


    def @ItemPlace          { @Galley }
    def @InterruptItemPlace { @Galley }
    def @NewPageItemPlace   { @Galley }
    def @TagPlace           { @Galley }
    def @EndListPlace       { @Galley }

    def @RawList
	named style right num { num              }
	named type  right num { num              }
	named gap             { @ListGap         }
	named indent          { @ListIndent      }
	named itemindent      { 0c		 }
	named rightindent     { @ListRightIndent }
	named labelwidth      { @ListLabelWidth  }
	named start           { 1                }
    {
        def @MakeList right num
	{
	    def @NormalItem
	    {
	        |indent
	        labelwidth @Wide {
		    # @NumberMarker @Value {style num} {style num} &0io
		    @NumberMarker @Value {num} {style type num} &0io
		}
	        |itemindent  @ItemPlace  |rightindent
	        //gap  @MakeList @NotRevealed @Next num
	    }

	    def @InterruptItem
	    {
		@InterruptItemPlace
		//gap  @MakeList @NotRevealed num
	    }

	    def @NewPageItem
	    {
		@NewPageItemPlace
		//1.1b  @MakeList @NotRevealed num
	    }

	    @OneOf
	    {
		@NormalItem
		@InterruptItem
		@NewPageItem
	    }
	}

	def @ListGalleyPlace { @Galley }

	def @ListGalley into { @ListGalleyPlace&&preceding }
	{
	    @MakeList start // @EndListPlace
	}

	@ListGalleyPlace
	//
	@ListGalley
    }

    def listitem into { @ItemPlace&&preceding }
	named @Tag {}
	right x
    {
	   @NumberMarker&&preceding @Tagged @Tag
	// x
	// @PageMark @Tag   # weird placement, but @PageMark is definite now
    }

    def droplistitem into { @ItemPlace&&preceding }
	named @Tag {}
	right x
    {
	   @NumberMarker&&preceding @Tagged @Tag
	// @PageMark @Tag
	//1vx x
    }

    def tagitem into { @ItemPlace&&preceding }
	named tag {}
	right x
    {
	def sendtag into { @TagPlace&&preceding } { tag }

	sendtag // x
    }

    def droptagitem into { @ItemPlace&&preceding }
	named tag {}
	right x
    {
	def sendtag into { @TagPlace&&preceding } { tag }

	sendtag // //1vxu x
    }

    def endlist force into { @EndListPlace&&preceding } {}

    def listnewpage into { @NewPageItemPlace&&preceding } {}

    def listinterruptitem into { @InterruptItemPlace&&preceding }
	right x
    {
	x
    }


    macro @LI   @ListItem		{ // listitem			}
    macro @LII  @ListInterruptItem	{ // listinterruptitem		}
    macro @LNP  @ListNewPage		{ // listnewpage		}
    macro @DLI  @DropListItem		{ // droplistitem		}
    macro @TI   @TagItem		{ // tagitem tag		}
    macro @DTI  @DropTagItem		{ // droptagitem tag		}
    macro @REL  @RawEndList		{ // & endlist // 		}
    macro @EL   @EndList		{ // & endlist @LOP		}


    macro @RLL    @RawLeftList		{ @RawList style {}
						   labelwidth { 0c }           }
    macro @RIL    @RawIndentedList	{ @RawList style {}                    }
    macro @RQL    @RawQuotedList	{ @RawList style {}
						   rightindent {@DisplayIndent}}
    macro @RCL    @RawCentredList	{ @RawList style {}
						   labelwidth {0c}
						   itemindent {0.5rt}          }
    macro         @RawCenteredList	{ @RawCentredList                      }
    macro @RNL    @RawNumberedList      { @RawList style { num.	             } }
    macro @RPNL   @RawParenNumberedList { @RawList style { (num)	     } }
    macro @RRL    @RawRomanList	        { @RawList type  { @Roman&&num }
						   style { num.    } }
    macro @RPRL   @RawParenRomanList    { @RawList type  { @Roman&&num }
						   style { (num)   } }
    macro @RUCRL  @RawUCRomanList       { @RawList type  { @UCRoman&&num }
						   style { num.  } }
    macro @RPUCRL @RawParenUCRomanList  { @RawList type  { @UCRoman&&num }
						   style { (num) } }
    macro @RAL    @RawAlphaList	        { @RawList type  { @Alpha&&num }
						   style { num.    } }
    macro @RPAL   @RawParenAlphaList    { @RawList type  { @Alpha&&num }
						   style { (num)   } }
    macro @RUCAL  @RawUCAlphaList       { @RawList type  { @UCAlpha&&num }
						   style { num.  } }
    macro @RPUCAL @RawParenUCAlphaList  { @RawList type  { @UCAlpha&&num }
						   style { (num) } }
    macro @RBL    @RawBulletList        { @RawList style { @Bullet	     } }
    macro @RSL    @RawStarList	        { @RawList style { @Star	     } }
    macro @RDL    @RawDashList	        { @RawList style { --	 	     } }
    macro @RTL    @RawTaggedList        { @RawList type { @TagPlace         } }
    macro @RWTL   @RawWideTaggedList    { @RawList type { @TagPlace         }
					           labelwidth { @WideIndent  } }
    macro @RVWTL  @RawVeryWideTaggedList{ @RawList type { @TagPlace         }
					        labelwidth { @VeryWideIndent } }


    macro @L     @List			{ @LOP @RawList			}
    macro @LL    @LeftList		{ @LOP @RawLeftList		}
    macro @IL    @IndentedList		{ @LOP @RawIndentedList		}
    macro @QL    @QuotedList		{ @LOP @RawQuotedList		}
    macro @CL    @CentredList		{ @LOP @RawCentredList		}
    macro        @CenteredList		{ @LOP @RawCenteredList		}
    macro @NL    @NumberedList		{ @LOP @RawNumberedList		}
    macro @PNL   @ParenNumberedList	{ @LOP @RawParenNumberedList	}
    macro @RL    @RomanList		{ @LOP @RawRomanList		}
    macro @PRL   @ParenRomanList	{ @LOP @RawParenRomanList	}
    macro @UCRL  @UCRomanList		{ @LOP @RawUCRomanList		}
    macro @PUCRL @ParenUCRomanList	{ @LOP @RawParenUCRomanList	}
    macro @AL    @AlphaList		{ @LOP @RawAlphaList		}
    macro @PAL   @ParenAlphaList	{ @LOP @RawParenAlphaList	}
    macro @UCAL  @UCAlphaList		{ @LOP @RawUCAlphaList		}
    macro @PUCAL @ParenUCAlphaList	{ @LOP @RawParenUCAlphaList	}
    macro @BL    @BulletList		{ @LOP @RawBulletList		}
    macro @SL    @StarList		{ @LOP @RawStarList		}
    macro @DL    @DashList		{ @LOP @RawDashList		}
    macro @TL    @TaggedList		{ @LOP @RawTaggedList		}
    macro @WTL   @WideTaggedList	{ @LOP @RawWideTaggedList	}
    macro @VWTL  @VeryWideTaggedList	{ @LOP @RawVeryWideTaggedList	}

@End @BasicSetup