@style(comments yes)
;;			MANUAL.FMT - Modification of Standard.FMT
;;			9/12/88
;;
;;                      Add: @ModifyLarge -- 12/19/91
;;

@style(counter SectionNumber)
@style(WidowPrevent 2)
@tct("-" "-@|")
@macro(label() = "@tag(@eval SectionNumber)")
@macro(Title() = "@value(@eval(text)Title)")
@macro(NeedSpace() = "@havespace(@eval,n "@newpage")")
@macro(kern() = "@hsp(-@eval)")
@macro('"' "@notct(")")
@macro(ifodd(v,y,n) = "@if((@eval(v))&1,y y,n n)")
@macro(makeodd() = "@newpage@if(page&1,else "@blankpage()")")
@macro(makeeven() = "@newpage@if(page&1,"@blankpage()")")
@macro[TabDivide() = "@tabset()@case{@eval,
	1 "@tabset(.5 line)",
	2 "@tabset(.333 line, .667 line)",
	3 "@tabset(.25 line, .5 line, .75 line)",
	4 "@tabset(.2 line, .4 line, .6 line, .8 line)",
	5 "@tabset(.167 line, .333 line, .5 line, .667 line, .833 line)",
	6 "@tabset(.143 line, .286 line, .429 line, .572 line, .714 line, .857 line)",
	7 "@tabset(.125 line, .25 line, .375 line, .5 line, .625 line, .75 line, .875 line)",
	8 "@tabset(.111 line, .222 line, .333 line, .444 line, .556 line, .667 line, .778 line, .889 line)",
	9 "@tabset(.1 line, .2 line, .3 line, .4 line, .5 line, .6 line, .7 line, .8 line, .9 line)",
	ELSE "@Error(Illegal argument '@eval()' to @@Tabdivide)"}"]

@define(B, font bold, ifnotfound, overstruck)
@define(Large=B, font wide dwidth, ifnotfound, size 1.414,
	font bold, ifnotfound, overstruck, afterexit "@nohinge")

@define(E, font italic uns, ifnotfound, underline nonblank)
@define(Q, font sub, ifnotfound, script -.25, font small, ifnotfound, size .707)
@macro(R = default)
@define(S, font super, ifnotfound, script .35, font small, ifnotfound, size .707)
@define(T, font elite pica courier, ifnotfound)
@define(U, font uns, ifnotfound, underline)
@macro(V = Ref)
@macro(A = Large)
@define(X, strikeout)
@macro(- = Q)
@macro(+ = S)
@macro(I = E)
@define(UN = U, underline alphanumeric)
@macro(UX = U)
@macro(W = UN)
; Trick to allow user to specify, with a command, the behavior of underlining.
@macro(Underscore() "@ifdef(under_score_,
	y "@warn(You can only set the underscore style once per document.)",
	n "@Set(under_score_ = 1)@case(@eval,
		continuous, c, y, all "@Modify(u, underline all)@modify(E, underline all)@modify(ux, underline all)",
		noncontinuous, discontinuous, n, words "@Modify(u, underline nonblank)@modify(E, underline nonblank)@modify(ux, underline nonblank)",
		)")")

@macro(font()="@string(curfont = font)@case[@eval,"default" "@style(font @value(basefont))",
                  else "@style(font @eval(text))"]")

@macro(endf="@style(font @value(curfont))")

@macro(size()="@string(cursize = size)@style(size @eval(text))")
@macro(ends="@style(size @value(cursize) u)")


;; Page head definitions:
@define(PageHead,above page,columns 1,spacing 1)
@define(PageFoot,below page,columns 1,spacing 1)

@macro(timestamp "@value(month)/@value(day)/@value(year) @value((hour+11)%12+1):@value(minute)@if(hour>=12,"pm",else "am")")

@if(plain,
	"@modify(PageHead,linelength 6.5 inches)@~
	@template(day"%02d")@template(minute"%02d")@macro(PageInit = "@~
	@PageHead(@u[@value(manuscript) @timestamp@>Page @value(page)])@;")",
else "@macro(PageInit = "@~
	@PageHead(@if(Page&1,Y "@if(page=1,y phf,n pho)",N phe))@~
	@PageFoot(@if(Page&1,Y "@if(page=1,y pff,n pfo)",N pfe))@;")")
;old	@PageHead(@if(Page&1,Y pho,N phe))@~
;old	@PageFoot(@if(Page&1,Y pfo,N pfe))@;")")


@macro(Header()		"@string(pho=text,phe=pho)")
@macro(HeaderO()		"@string(pho=text)")
@macro(HeaderE()		"@string(phe=text)")
@macro(HeaderT()		"@string(phf=text)")
@macro(Footer()		"@string(pfo=text,pfe=pfo)")
@macro(FooterO()		"@string(pfo=text)")
@macro(FooterE()		"@string(pfe=text)")
@macro(FooterT()		"@string(pff=text)")

@macro(PassInit = "
	@set(maketoc 0)
	@HeaderT(@*)
	@Header(@*)
	@FooterT(@*)
	@Footer[@case(page,1 "@*",else "@=- @value(page) -")]")

; Scribe-style formats:
@Define(Center, centered, indent 0, group, blanklines hinge)
@Define(FlushLeft=Center, justify left)
@Define(FlushRight=Center, justify right)
@Define(Address, leftindent .5 line, above 2, below 2,fill n,group,initialize="@nohinge")
@macro(Closing = Address)
@Define(Quotation, margins +.5 in, above 1, below 1, spacing 1)
@Define(Text,indent 0)
@Define(Column,column)
@Define(Undent = Text, indent -.5 inch)
@Define(Verbatim, indent 0, spacing 1, fill n, linelength 0, notct)
@Define(Display = Verbatim, leftindent +.5 in, above 1, below 1, group, blanklines hinge)
@Define(Example = Display, font elite pica courier, size 10pt, ifnotfound)
@Define(Description, indent -.25 line, WithEach "@b(@eval)  @\",above 1,below 1)
@Define(Numbered, indent -5,above 1,below 1, numbered "%&.%]%<%u%;%a%;%i%]",
	BeforeEach "@>()@value(counter).@hsp(.2in)@\")
@Define(Hyphens=Numbered, numbered "%<-%;*%;o%]",
	BeforeEach "@>()@value(counter)@hsp(.2in)@\")
@Define(Bullets=Numbered, numbered "%<o%;-%;*%]",
	BeforeEach "@>()@value(counter)@hsp(.2in)@\")
@Define(Asterisks=Numbered, numbered "%<*%;o%;-%]",
	BeforeEach "@>()@value(counter)@hsp(.2in)@\")
@Define(MultiLevel, indent - 7, numbered "", 
	BeforeEach "@>()@value(counter).@hsp(.2in)@\",above 1,below 1)
@Define(Outline=Numbered, numbered "%<%I%;%A%;%u%;%a%;%i%]", indent -10,
	BeforeEach "@>()@value(counter).@hsp(.2in)@\",above 1,below 1)

@Define(FNote, font small, ifnotfound, size .707, spacing 1,
	below, counter footnote,
	divider "@ux(@>)@*@*", above .5,
	AfterEntry "@ref(Footnote). @[",
	AfterExit "@+(@,@ref(Footnote)@,)")

@Define(snote, indent -7, font small, ifnotfound, size .707, spacing 1,
	below, counter starnote,
	divider "@ux(@>)@*@*", above .5,
	AfterEntry "@ref(starnote)@\",
	AfterExit "@+(@,@ref(starnote)@,)")

@template(starnote = "%(*%)")


@Define(BigCenteredHead=Large, columns 1, centered, group, leftindent 0,
	afterentry "@blankspace(1 inch)", below 2, afterexit "@nohinge@nofloats")

@Define(TOC, before, justify no, margins .5in, initialize "
	@string(pfo="@=@ref(page,template'%i')", pfe=pfo, pff=pfo)
	@string(pho="", phe=pho, phf=pho)
	@string(sectiontitle="Contents", chaptertitle=sectiontitle)
	@BigCenteredHead(Contents)@TabSet(3,6,9,12)")

@macro(incr() = "@set(@eval +1)@set(SectionNumber @eval)")

@parent(Section = Chapter)
@parent(SubSection = Section)
@parent(Paragraph = SubSection)
@parent(figure = Chapter)
@parent(table = Chapter)
@parent(page = Chapter)

@macro(maketoc "@set(maketoc 1)")

@macro(HeadingA() = "
	@makeodd()
	@string(SectionTitle=text, ChapterTitle=text)
	@BigCenteredHead(@eval)
	@if(maketoc,"@TOC(@hinge@*@eval@word[@>@eval(page)]@nohinge@*)")")

@macro(Chapter() = "
	@makeodd()
	@incr(Chapter)
	@string(SectionTitle=text, ChapterTitle=text)
	@BigCenteredHead(Chapter @value(Chapter)@*@*@eval)
	@maketoc@TOC(@hinge@*Chapter @eval(Chapter)  @$@eval@word[@>@eval(Page)]@nohinge@*)@~")
@comment[        @maketoc@TOC(@hinge@*Chapter @eval(Chapter)@$
        @eval@word[@>@eval(Chapter)-@eval(Page)]@nohinge@*)@~") ]


@Define(BigLeftHead = Large, columns 1, fill n, group, leftindent 0,
	above 4, below 2, afterexit "@nohinge@nofloats")

@macro(HeadingB() = "
	@string(SectionTitle=text)
	@BigLeftHead(@eval)
	@if(maketoc,"@TOC(@\@$@eval@word[@>( .) @eval(Page)]@*)")@~")

@macro(Section() = "
	@incr(Section)@string(SectionTitle=text)
	@BigLeftHead(@value(section)  @eval)
	@maketoc@TOC(@\@eval(section)  @$@eval@word[@>( .) @eval(Page)]@*)@~")

@Define(MedLeftHead = B, fill n, group, leftindent 0,
	above 2, below 1, afterexit "@nohinge")

@macro(HeadingC() = "
	@string(SectionTitle=text, SubSectionTitle=text)
	@MedLeftHead(@eval)
	@if(maketoc,"@TOC(@\@\@$@eval@word[@>( .) @eval(Page)]@*)")@~")

@macro(SubSection() = "
	@incr(SubSection)
	@string(SectionTitle=text, SubSectionTitle=text)
	@MedLeftHead(@value(SubSection)  @eval)
	@maketoc@TOC(@\@\@eval(subsection)  @$@eval@word[@>( .) @eval(Page)]@*)@~")

@Define(LittleLeftHead = U, fill n, group, leftindent 0,
	above 1, below 1, afterexit "@nohinge")

@macro(HeadingD() = "
	@string(SectionTitle=text, ParagraphTitle=text)
	@LittleLeftHead(@eval)
	@if(maketoc,"@TOC(@\@\@\@$@eval@word[@>( .) @eval(Page)]@*)")@~")

@macro(Paragraph() = "
	@incr(Paragraph)
	@string(SectionTitle=text, ParagraphTitle=text)
	@LittleLeftHead(@value(Paragraph)  @eval)
	@maketoc@TOC(@\@\@\@eval(Paragraph)  @$@eval@word[@>( .) @eval(Page)]@*)@~")

@template(Appendix "%A")
@macro(Appendix() = "
	@makeodd()
	@incr(Appendix)@set(Chapter=Appendix)
	@string(SectionTitle=text, AppendixTitle=text, ChapterTitle=text)
	@BigCenteredHead(Appendix @value(Appendix)@*@*@eval)
	@maketoc@TOC(@*Appendix @eval(Appendix)  @$@eval@>@eval(Page)@*)@~")

@macro(AppendixSection = Section)

@Define(TOF=TOC,initialize "
	@makeodd()
	@string(sectiontitle="Figures", chaptertitle=sectiontitle)
	@BigCenteredHead(Figures)")
@Define(TOT=TOC,initialize "
	@makeodd()
	@string(sectiontitle="Tables", chaptertitle=sectiontitle)
	@BigCenteredHead(Tables)")
@define(Figure,group,columns 1,spacing 1,fill n,linelength 0,notct,below 1)
@define(Table,group,columns 1,spacing 1,fill n,linelength 0,notct,below 1)
@define(fcapt = center,font = small,ifnotfound,size .707,
	counter figure,fill,initialize "@b(Figure @value(figure)): ")
@define(Tcapt = center,font = small,ifnotfound,size .707,
	counter table,fill,initialize "@b(Table @value(table)): ")
@macro(caption() = "@fcapt(@eval)@TOF(Figure @eval(figure): @$@eval@>( .)@eval(page)@*)")
@macro(tcaption() = "@tcapt(@eval)@TOT(Table @eval(table): @$@eval@>( .)@eval(page)@*)")

@Define(Notes, after, above 3, spacing 1, indent +5, initialize "@HeadingC(Notes)")
@macro(ENote() = "@set(footnote +1)@Notes(@eval(footnote). @eval@*)@+(@,@value(Footnote)@,)")
@macro(NoteChapter = "@Notes(@*@*@<@b(Chapter @eval(Chapter).  @eval(ChapterTitle))@*@*)@set(footnote 0)")
@macro(NoteSection = "@Notes(@*@*@<@b(@eval(Section).  @eval(SectionTitle))@*@*)@set(footnote 0)")
@define(note = text, font small, ifnotfound, size .707, spacing 1,
	below, above .5, divider "@u(@>)")

@Define(TheIndex, index, columns 2, spread .5, spacing 1, justify no,
	margins +.75 inch, indent -3,
	initialize "@headingA(Index)@string(chapter="Index")@tabset(3,6,9,12)",
	BeforeEach "@case[counter,0 "",else "@*@Large[@char(counter)]@nohinge@*"]")
@macro(IxRef() = "@`@TheIndex(e="@eval(text)@hinge",v="@, @eval(page)@,")@'")
@macro(IxMaster() = "@`@TheIndex(e="@eval(text)@hinge",v="@, @b(@eval(page))@,")@'")
@macro(IxRange(tag_,word_)="@`@TheIndex(e="@eval(word_)@hinge",
   v="@if(@pageref(@eval(tag_))=@eval(page),
   y "@, @eval(page)@,",
   n "@, @pageref(@eval(tag_))-@eval(page)@,")")@'")

@macro(IxSee(entry,see) = 
	"@`@TheIndex(e=entry,v="@, @E(See:) @eval(see)@hinge@,")@'")
@macro(IxSeeAlso(entry,see) = 
	"@`@TheIndex(e=entry,v="@, @E(See Also:) @eval(see)@hinge@,")@'")
@macro(D() "@TheIndex(e="@eval(text)@hinge",v="@, @eval(page)@,")@eval")
@macro(Merge_Init_ = "@place(toc)@place(tof)@newpage@Reset@PassInit")
@ifdef(paper, y "@case{paper,
	Letter	"@style(paper 11 inches)",
	Legal	"@Style(paper 14 inches)",
	A4		"@Style(paper 297 mm,paperwidth 210 mm)",
	A3		"@Style(paper 420 mm,paperwidth 297 mm)",
	A5		"@Style(paper 210 mm,paperwidth 148 mm)",
	B5		"@Style(paper 250 mm,paperwidth 176 mm)",
	IntFan	"@Style(paper 305 mm,paperwidth 210 mm)",
	Comput	"@Style(paper 11 inches,paperwidth 14.75 inches)",
	else		"@Error(Paper type '@value(paper)' not known.)"}")
@set(monthname month)
@template(monthname "%[%;January%;February%;March%;April%;May%;June%;July%;August%;September%;October%;November%;December%]")
@template(weekday "%[Sunday%;Monday%;Tuesday%;Wednesday%;Thursday%;Friday%;Saturday%]")

;; dummy @eps command, the one in Postscript TCT file will send the real file
@macro(EPS(file,width,height) = "
	@ReadEPS(@eval(file))@set(w (urx-llx))@set(h (ury-lly))@~
	@ifdef(width, "@set(w1 @hunits(@eval(width)))")
	@ifdef(height, "@set(h1 @vunits(@eval(height)))@ifdef(width,
			"@set(w=w1,h=h1)",
		else "@set(w=(h1/h)*w,h=h1)")",
	else "@ifdef(width,
		"@set(h=(w1/w)*h,w=w1)",
	else "@set(w=@hunits(@eval(w)pt),h=@vunits(@eval(h)pt))")")
		[graphic @eval(file) goes here]@escape(s="@char(0)",w @eval(w)u,h @eval(h)u)")

;; dummy @key command, prints in bold, with brackets.  Replaced by one
;; in Postscript TCT file
@macro(key()="@B([@eval(text)])")

;; Maintain compatibility with old FinalWord II documents
@macro(P() = "@i(@b(@eval))")
@macro(phbuild() =
	"@string(@eval "@eval(left)@<@=@eval(center)@<@>@eval(right)@*@eval(line)")")

@macro(FWPageHeading(even,odd,left,center,right,line) = "
	@if(even,n "@phbuild(pho)")
	@if(odd,n "@phbuild(phe)")")

@macro(FWPageFooting(even,odd,left,center,right,line) = "
	@if(even,n "@phbuild(pfo)")
	@if(odd,n "@phbuild(pfe)")")

;; New additions but maintain compatability with older documents
@define(columns1, columns 1)
@define(columns2, columns 2)
@define(columns3, columns 3)
@define(columns4, columns 4)
@define(columns5, columns 5)
@define(columns6, columns 6)


@macro(Big = Large)

@macro(MajorHeading = HeadingA)
@macro(Heading = HeadingB)
@macro(SubHeading = HeadingC)
@macro(SubSubHeading = HeadingD) 

@macro(Level = MultiLevel)
@macro(Itemize = Hyphens)
@macro(Enumerate = Numbered)

@macro(Index = IxRef)
@macro(MIndex = IxMaster)
@macro(See = IxSee)
@macro(SeeAlso = IxSeeAlso)
@macro(RIndex = IxRange)

@macro(Foot = FNote)
@macro(EndNote = ENote)

;; Aliases for internal formatter commands
@macro(ColumnBreak = NewColumn)
@macro(PgCond = Hinge)
@macro(KeepFollowing = NoHinge)

@macro(Reserve = Blankspace)
@macro(PGBlank = Blankpage)

@macro(PageHeading = Header)
@macro(PageHeadingFirst = HeaderT)
@macro(PageHeadingOdd = HeaderO)
@macro(PageHeadingEven = HeaderE)

@macro(PageFooting = Footer)
@macro(PageFootingFirst = FooterT)
@macro(PageFootingOdd = FooterO)
@macro(PageFootingEven = FooterE)

;; For printers that can't do precise underlines, modify the dividers
@case(printer,
	"Brother*",
	"C-Itoh*",
	"Citizen*",
	"Dec*",
	"Epson*",
	"Facit*",
	"Fujitsu*",
	"Honeywell*",
	"HP*",
	"IBM*",
	"MT*",
	"Nec*",
	"Okidata*",
	"Olivetti*",
	"Sanco*",
	"Star*",
	"Tandy*",
	"XEROX*" "@modify(fnote, divider "@>(_)@*")@modify(snote, divider "@>(_)@*")@modify(note, divider "@>(_)@*")")

@case(printer,PostScript "@include(postscr.tct)")
@string(basefont=font)
@style(comments no)

@macro(ModifyLarge()="
  @modify(Large, font @eval)
  @modify(BigCenteredHead, font @eval)
  @modify(BigLeftHead, font @eval)
  @modify(A, font @eval)
  @modify(Big, font @eval)")
