File: metapost.mp

package info (click to toggle)
ohcount 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,712 kB
  • ctags: 3,205
  • sloc: ansic: 6,524; ruby: 2,560; perl: 2,041; erlang: 350; lisp: 272; sh: 244; pascal: 196; vhdl: 150; haskell: 149; asm: 128; cs: 124; awk: 98; java: 92; php: 73; tcl: 58; xml: 57; fortran: 54; makefile: 32; python: 31; ada: 30; objc: 30; jsp: 28; sql: 18; cobol: 13; ml: 9; cpp: 3
file content (62 lines) | stat: -rw-r--r-- 1,712 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% Sample MetaPost with embedded LaTeX, used as unit test for ohcount
%
% The MetaPost code is taken of LaTeXLabels.mp from
% the excellent MetaPost tutorial by Urs Oswald
% http://www.ursoswald.ch/metapost/tutorial.html
%
verbatimtex
%&latex
\documentclass{article}
\newcommand{\uB}{\upshape{B\'ezier}}   % up: upright
\newcommand{\iB}{\itshape{B\'ezier}}   % it: italic
\newcommand{\lB}{\slshape{B\'ezier}}   % sl: slanted
\newcommand{\cB}{\scshape{B\'ezier}}   % sc: small caps
\newfont{\cyr}{wncyr10}
\begin{document}
etex

u:=25;                    % 25 = 25bp = 25 PostScript points = 30/72 in
wi:=10;                   % width  in units u   
he:=7;                    % height in units u
hoehe:=he*u;              % height
breite:=wi*u;             % width
picture lab;

beginfig(1)
  % --- Grid ---
  for i=0 upto he:
    draw (0, i*u)--(breite, i*u) withcolor .7white;
  endfor
  for j=0 upto wi:
    draw (j*u, 0)--(j*u, hoehe) withcolor .7white;
  endfor
  % --- End Grid ---
  
  draw (0, 0)--(breite, 0)--(breite, hoehe)--(0, hoehe)--cycle;
  
  for i=0 upto 5:
    draw .5(u, u){dir 20i}..{dir 20i}(9.5u, 4u);
  endfor  
  
  lab:=\thelabel(
    btex 
      \begin{tabular}{|r|l|l|l|l|}
	\hline
	\textbf{md} & upright      & italic       & slanted      & smallcaps   \\ 
	\hline
	rm          & \textrm{\uB} & \textrm{\iB} & \textrm{\lB} &\textrm{\cB} \\
	sf          & \textsf{\uB} & \textsf{\iB} &\textsf{\lB}  &\textsf{\cB} \\
	tt          & \texttt{\uB} & \texttt{\iB} &\texttt{\lB}  &\texttt{\cB} \\
	\hline
      \end{tabular}
    etex, 
    (.5breite, hoehe-1.5u)
  );
    
  unfill bbox lab;
  draw lab; 
  
  label.ulft(btex \cyr C\char24 rih, 08.09.2002 etex, (breite, 0));   
endfig;

end