2 % Some utilities for formatting (extended) lambda calculus and
6 \startuseMPgraphic{HLine}
8 % Create a rectangle of the full size
9 a := origin -- (\MPvar{width}, 0mm);
11 b := a randomized (\overlaywidth / 25) ;
13 drawoptions (withpen pencircle scaled .75mm withcolor black) ;
17 % Draw a line with the given options. Accepts only the 'width' option. Be
18 % careful that these are metapost options, so use \the\textwidth instead of
19 % textwidth, and a metapost expression for arithmethic (e.g. 0.5 *
20 % \the\textwidth instead of 0.5\textwidth).
22 {\setupMPvariables[HLine][#1]%
25 \startuseMPgraphic{box}
27 % Create a rectangle of the full size
28 a := unitsquare xyscaled(\overlaywidth,\overlayheight);
30 b := a randomized (\overlaywidth / 25) ;
32 drawoptions (withpen pencircle scaled .75mm withcolor black) ;
36 \defineoverlay[box][\useMPgraphic{box}]
38 % Define \{start,stop}boxed with a nice metapost box around it.
39 \defineframedtext[boxed][background=box,frame=off]
40 % A boxed variant with the width forced to page width. This is used in
41 % \startrans, since the content somehow doesn't scale the box around it
43 \defineframedtext[wideboxed][background=box,frame=off,width=\textwidth,offset=.02\textwidth]
45 % Install the lambda calculus pretty-printer, as defined in pret-lam.lua.
46 \installprettytype [LAM] [LAM]
47 % Define \startlambda \stoplambda
48 \definetyping[lambda][option=LAM,style=sans,before=\startboxed,after=\stopboxed]
50 % Define \lam{} (since \lambda is taken)
51 \definetype[lam][option=LAM,style=sans]
53 % Install the transformation pretty-printer, as defined in pret-trans.lua.
54 \installprettytype [TRANS] [TRANS]
55 % Define \starttrans \stoptrans
56 \definetyping[trans][option=TRANS,style=normal,before=\startwideboxed,after=\stopwideboxed]
58 % Install the haskell pretty-printer, as defined in pret-haskell.lua.
59 \installprettytype [HASKELL] [HASKELL]
60 % Define \starthaskell \stophaskell
61 \definetyping[haskell][option=HASKELL,before=\startboxed,after=\stopboxed]
63 \definetype[hs][option=HASKELL,style=mono]