[NEW] General objects for keeping track of line counts and line count deltas.
[ohcount] / test / src_dir / metapost.mp
1 % Sample MetaPost with embedded LaTeX, used as unit test for ohcount
2 %
3 % The MetaPost code is taken of LaTeXLabels.mp from
4 % the excellent MetaPost tutorial by Urs Oswald
5 % http://www.ursoswald.ch/metapost/tutorial.html
6 %
7 verbatimtex
8 %&latex
9 \documentclass{article}
10 \newcommand{\uB}{\upshape{B\'ezier}}   % up: upright
11 \newcommand{\iB}{\itshape{B\'ezier}}   % it: italic
12 \newcommand{\lB}{\slshape{B\'ezier}}   % sl: slanted
13 \newcommand{\cB}{\scshape{B\'ezier}}   % sc: small caps
14 \newfont{\cyr}{wncyr10}
15 \begin{document}
16 etex
17
18 u:=25;                    % 25 = 25bp = 25 PostScript points = 30/72 in
19 wi:=10;                   % width  in units u   
20 he:=7;                    % height in units u
21 hoehe:=he*u;              % height
22 breite:=wi*u;             % width
23 picture lab;
24
25 beginfig(1)
26   % --- Grid ---
27   for i=0 upto he:
28     draw (0, i*u)--(breite, i*u) withcolor .7white;
29   endfor
30   for j=0 upto wi:
31     draw (j*u, 0)--(j*u, hoehe) withcolor .7white;
32   endfor
33   % --- End Grid ---
34   
35   draw (0, 0)--(breite, 0)--(breite, hoehe)--(0, hoehe)--cycle;
36   
37   for i=0 upto 5:
38     draw .5(u, u){dir 20i}..{dir 20i}(9.5u, 4u);
39   endfor  
40   
41   lab:=\thelabel(
42     btex 
43       \begin{tabular}{|r|l|l|l|l|}
44         \hline
45         \textbf{md} & upright      & italic       & slanted      & smallcaps   \\ 
46         \hline
47         rm          & \textrm{\uB} & \textrm{\iB} & \textrm{\lB} &\textrm{\cB} \\
48         sf          & \textsf{\uB} & \textsf{\iB} &\textsf{\lB}  &\textsf{\cB} \\
49         tt          & \texttt{\uB} & \texttt{\iB} &\texttt{\lB}  &\texttt{\cB} \\
50         \hline
51       \end{tabular}
52     etex, 
53     (.5breite, hoehe-1.5u)
54   );
55     
56   unfill bbox lab;
57   draw lab; 
58   
59   label.ulft(btex \cyr C\char24 rih, 08.09.2002 etex, (breite, 0));   
60 endfig;
61
62 end