%-----------------------------------------------------------------------
%
%  TeX-makropaketti TLP:n julkaisusarjan kirjoja varten
%  OS & HK 1989
%
%-----------------------------------------------------------------------
/magnification=1200
%-----------------------------------------------------------------------
%
% fontit
%
%-----------------------------------------------------------------------
/font /ss=cmbx10
/font /sc=cmcsc10
/font /bigf=cmssbx10 scaled /magstephalf
/font /biggf=cmssbx10 scaled /magstep2
/font /pieni=cmr7
/font /bbf=cmbx10
%-----------------------------------------------------------------------
%
% otsikot
%
%-----------------------------------------------------------------------
/newcount/chapternumber
/newcount/sectionnumber
/newcount/subsectionnumber
/chapternumber=0

/outer/def/chapter#1</goodbreak/null/vskip1.5truecm
             /global/advance/chapternumber by 1
             /global/sectionnumber=0
             /gdef/rightheadertext<#1>
             </biggf/the/chapternumber/quad#1>/hfil/break/
              /nobreak/null/medskip/rm>

/outer/def/chaptera#1</goodbreak/null/vskip1.5truecm
             /gdef/rightheadertext<#1>
             </biggf#1>/hfil/break/
              /nobreak/null/medskip/rm>

/outer/def/section#1</goodbreak/null/vskip1.0truecm
              /global/advance/sectionnumber by 1
              /global/subsectionnumber=0
              </bigf/the/chapternumber./the/sectionnumber/quad#1>/hfil/break
              /nobreak/null/medskip/rm>


/outer/def/sectiona#1</goodbreak/null/vskip1.0truecm
              </bigf#1>/hfil/break
              /nobreak/null/medskip/rm>


/outer/def/subsection#1</goodbreak/null/vskip1.0truecm
              /global/advance/subsectionnumber by 1
              </bigf/the/chapternumber./the/sectionnumber./the/subsectionnumber
                  /quad#1>/hfil/break
              /nobreak/null/medskip/rm>

/let/title=/chapter
/let/subtitle=/section
/let/paaotsikko=/chapter
/let/otsikko=/section
/let/aliotsikko=/subsection
/def/ref#1<#1>
%-----------------------------------------------------------------------
%
% sivun- ja rivinvaihdot
% 
%-----------------------------------------------------------------------
/def/page</vfill/eject>
/def/nl</hfill/break>
/def/cspace</null/vskip1truecm>
%-----------------------------------------------------------------------
%
% tilaa kuvalle
%
%-----------------------------------------------------------------------
/def/picture#1</goodbreak/vbox to #1</null/vfill>>
%-----------------------------------------------------------------------
%
% verbatim
%
%-----------------------------------------------------------------------
/def/uncatcodespecials<
  /catcode`//=12
  /catcode`/>=12
  /catcode`/<=12
  /catcode`/$=12
  /catcode`/&=12
  /catcode`/#=12
  /catcode`/%=12
  /catcode`/~=12
  /catcode`/_=12
  /catcode`/^=12>

/def/beginverbatim</begingroup/setupverbex/doverbex>
</catcode`/@=0 @catcode`//=12 @gdef@doverbex#1/endverbatim<#1@endgroup>>
/def/setupverbex</tt/parindent=0pt /parskip=0pt
     /def/par</leavevmode/endgraf> 
     /catcode`/`=/active /obeylines /uncatcodespecials /obeyspaces>
</obeyspaces/global/let =/ >
</catcode`/`=/active /gdef`</relax/lq>>

%
% toinen verbatim  joka ei ole liian verbatim
%
/def/copymode</tt/parskip0mm/parindent10truemm
              /def/par</leavevmode/endgraf>/obeylines/obeyspaces>
</obeyspaces/global/let =/ >
%-----------------------------------------------------------------------
%
% itemilistat
%
%-----------------------------------------------------------------------
/def/beginitems</parindent=1truecm/parskip=0pt>
/def/beginitemss#1#2</parindent=#1/def/itemlen<#2>>
/def/enditems</parindent=0pt/parskip/medskipamount>
/def/entry</item<$/bullet$>>
/def/itemm#1</item</hbox to /itemlen</tt#1/hfill>>> 
%-----------------------------------------------------------------------
%
% sit{ sun t{t{ kielen syntaksin esitt{mist{ varten
%
%-----------------------------------------------------------------------
/def/meta#1<<$/lt$#1$/gt$>>
/def/lb<$/lbrack$>
/def/rb<$/rbrack$>
/def/lbc<$/lbrace$>
/def/rbc<$/rbrace$>
/def/br#1<<$/lbrack$#1$/rbrack$>>
/def/brc#1<<$/lbrace$#1$/rbrace$>>
/def/optional#1<<$/lbrack$#1$/,/rbrack$>>
/def/opt#1<<$/lbrack$#1$/,/rbrack$>>
/def/iter<$^*$>
/def/iterr<$^+$>
/def/boxed#1<
    /leavevmode/hbox</vrule/vtop</vbox</hrule/kern1pt
    /hbox</vphantom<//>/thinspace</tt #1>/thinspace>>
    /kern1pt/hrule>/vrule>/thinspace>

/newbox/mystrutbox
/setbox/mystrutbox=/hbox</vrule height13pt depth2pt width0pt>
/def/mystrut</relax/ifmmode/copy/mystrutbox/else/unhcopy/mystrutbox/fi>

/def/hhrule</hrule height 0.3mm>
/def/vvrule</vrule width 0.3mm>
%-----------------------------------------------------------------------
%
% yleinen sivun formaatti
%
%-----------------------------------------------------------------------
/hfuzz=2.0pt
/parindent=0pt
/parskip/medskipamount
/baselineskip=12pt

/newdimen/hhsize
/hsize=140.0truemm
/hhsize=140.0truemm

/hoffset=0.8truecm
/voffset=7.5truemm

/pretolerance=1600 
/tolerance=1200 
/hbadness=5000

/raggedbottom
/overfullrule0pt
/nopagenumbers
%-----------------------------------------------------------------------
%
% sivun yl{reunan teksti
%
%-----------------------------------------------------------------------
/font/headerfont=cmsl9

/def/headertext<Opas>
/def/leftheadertext</headertext>
/def/rightheadertext</headertext>

/headline=</ifodd/pageno/rightheadline/else/leftheadline/fi>

/def/sivuno<
  /def/leftheadline</noindent/vbox</hsize=/hhsize/leftskip 0mm%
  /noindent</bbf/folio></headerfont/qquad/leftheadertext
  /hfill Luku /the/chapternumber>/vskip 1truemm/hrule>>

  /def/rightheadline</noindent/vbox</hsize=/hhsize/leftskip 0mm%
  /noindent</headerfont Luku /the/chapternumber
  /hfill/rightheadertext/qquad></bbf/folio>/vskip 1truemm/hrule>>
>
%
%  sivunoa on kuten sivuno, mutta luvun numeroa ei tule mukaan
%
/def/sivunoa<
  /def/leftheadline</noindent/vbox</hsize=/hhsize/leftskip0mm%
  /noindent</bbf/folio>
  </headerfont/qquad/leftheadertext/hfill>/vskip 1truemm/hrule>>

  /def/rightheadline</noindent/vbox</hsize=/hhsize/leftskip 0mm%
  /noindent</headerfont/hfill/rightheadertext/qquad>
  </bbf/folio>/vskip 1truemm/hrule>>
>

%----------------------------------------------------------------------
%
% hakemisto (tulostetaan tiedostoon index.tex)
%
%  /ii<txt>  vie hakusanan txt hakemistoon muodossa /sana(txt)(sivu)
%            mutta ei vaikuta sen tulostumiseen mitenk{{n
%  /iii<txt> vie sanan hakemistoon; sana ei tulostu tekstiin
%
%----------------------------------------------------------------------
/newwrite/inx
/immediate/openout/inx=index

/def/ii#1</xdef/writeit</write/inx<//sana(#1)/space
    (/noexpand/number/pageno)>>/writeit#1>

/def/iii#1</xdef/writeit</write/inx<//sana(#1)/space
    (/noexpand/number/pageno)>>/writeit/ignorespaces>

%----------------------------------------------------------------------
%
% motto
%
%----------------------------------------------------------------------
/font/mottofont=cmssqi8
/long/def/motto#1<</mottofont
/def/par</ifhmode/endgraf/fi>/obeylines
  /parfillskip 0mm
  /interlinepenalty 10000
/leftskip0mm plus 20cm#1/par>>

/endinput
