%-----------------------------------------------------------------------
%
%  TeX-makropaketti TLP:n julkaisusarjan kirjoja varten
%  t{m{ tiedosto tarvitaan hakemiston alkuun
%  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
%-----------------------------------------------------------------------
%
% sivun- ja rivinvaihdot
% 
%-----------------------------------------------------------------------
/def/page</vfill/eject>
/def/nl</hfill/break>
/def/cspace</null/vskip1truecm>

/def/boxed#1<
    /leavevmode/hbox</vrule/vtop</vbox</hrule/kern1pt
    /hbox</vphantom<//>/thinspace</tt #1>/thinspace>>
    /kern1pt/hrule>/vrule>/thinspace>

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

/newdimen/hhsize
/newdimen/colsize
/hsize=14truecm
/hhsize=14truecm
/colsize=6.5truecm

/newdimen/vvsize
/newdimen/twovsize
/vsize=21truecm
/vvsize=21truecm
/twovsize=42truecm

/hoffset=0.8truecm
/voffset=-0.05truecm

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

/raggedbottom
/overfullrule=0pt
/nopagenumbers
%-----------------------------------------------------------------------
%
% sivun yl{reunan teksti
%
%-----------------------------------------------------------------------
/font/headerfont=cmsl9

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

/def/headline</ifodd/pageno/rightheadline/else/leftheadline/fi>
/def/makeheadline<>

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

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

%----------------------------------------------------------------------
%
% hakemistorivit ovat muotoa  /sana(txt)(sivunumerot)
%
%----------------------------------------------------------------------
/def/sana(#1) (#2)</vbox to 12pt<
                    /hbox to /colsize<</rm#1>/hfil</rm#2>>
                    /vfill>>
/def/zana(#1) (#2)</vbox to 24pt<
                    /hbox to /colsize<</rm#1>/hfil>/break
                    /hbox to /colsize</hfill</rm#2>>
                    /vfill>>

/newdimen/pagewidth/pagewidth=/hsize
/newdimen/pageheight/pageheight=/vsize

/catcode`@=11

/def/onepageout#1</shipout/vbox< % here we define one page of output
    /offinterlineskip            % butt the boxes together
    </hsize=/hhsize/vbox to 1.5truecm</headline/vfill>>
    /vbox to /pageheight<#1      % now insert the main information
      /boxmaxdepth=/maxdepth/vfill>>
    /advancepageno>

/newbox/partialpage

/def/begindoublecolumn</begingroup
   /output=</global/setbox/partialpage=/vbox</unvbox255/vskip/baselineskip>>
   /eject
   /output=</doublecolumnout>/hsize=/colsize /vsize=/twovsize>

/def/enddoublecolumn</output=</balancecolumns>/eject
   /endgroup /pagegoal=/vsize>

/def/doublecolumnout</splittopskip=/topskip /splitmaxdepth=/maxdepth
   /dimen@=/vvsize /advance/dimen@ by-/ht/partialpage
   /setbox0=/vsplit255 to/dimen@ /setbox2=/vsplit255 to/dimen@
   /onepageout/pagesofar /unvbox255 /penalty/outputpenalty>

/def/pagesofar</unvbox/partialpage
   /wd0=/hsize /wd2=/hsize /hbox to/pagewidth</box0/hfill/box2>>

/def/balancecolumns</setbox0=/vbox</unvbox255> /dimen@=/ht0
   /advance/dimen@ by/topskip /advance/dimen@ by-/baselineskip
   /divide/dimen@ by2 /splittopskip=/topskip
   </vbadness=10000 /loop /global/setbox3=/copy0
      /global/setbox1=/vsplit3 to/dimen@
      /ifdim/ht3/gt/dimen@ /global/advance/dimen@ by1pt /repeat>
   /setbox0=/vbox to/dimen@</unvbox1> /setbox2=/vbox to/dimen@</unvbox3>
   /onepageout/pagesofar>

/catcode`@=12 % at signs are no longer letters



