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