summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/base/mptmac.tex
blob: f5af73afdfda4848315e40dbc19fb3f84e0959f5 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% Special macros for use with MFT output.
% Adapted to METAPOST sources by Wlodek Bzyl, July 2001.

\ifx\mptmacisloaded\relax\endinput\else\let\mptmacisloaded=\relax\fi

\catcode`\@=11

\font\tenlogo=logo10 % font used for the METAFONT logo
\font\tentex=cmtex10 \hyphenchar\tentex=-1 % font used for strings
\font\sevenit=cmti7  \scriptfont\itfam=\sevenit
\def\MF{{\tenlogo META}\-{\tenlogo FONT}}
\def\MP{{\tenlogo META}\-{\tenlogo POST}}

\parindent=0pt
\thinmuskip=5mu
\thickmuskip=6mu plus 6mu
\mathcode`\|="326A

\def\\#1{{\it#1}} % italic type for identifiers
\def\0#1#2#3{\hbox{\rm\'{}\kern-.2em\it#1#2#3\/\kern.05em}} % octal constant
\def\1#1{\mathop{\hbox{\rm#1}}} % operator, in roman type
\def\2#1{\mathop{\hbox{\mftbf#1\/\kern.05em}}} % operator, in bold type
\def\3#1{\,\mathclose{\hbox{\mftbf#1\/}}} % `fi' and `endgroup'
\def\4#1{\mathbin{\hbox{\mftbf#1\/}}} % `step' and `at'
\def\5#1{\hbox{\mftbf#1\/}} % `true' and `nullpicture'
\def\6#1{\mathbin{\rm#1}} % `++' and `scaled'
\def\7{\hbox\bgroup\mft@nocats\frenchspacing\mft@finstring} % string token
\def\8#1{\mathrel{\mathcode`\.="8000 \mathcode`\-="8000
  #1\unkern}} % `..' and `--'
\def\9{\hfill$\%} % comment separator
\def\?#1{\mathopen{#1}\;} % `:', `::', and `||:'
\def\frac#1/#2{\leavevmode\kern.1em
  \raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em
  /\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}}

\mathchardef\AM="2026 % ampersand
\let\BL=\medskip % space for empty line
\mathchardef\BS="026E %  backslash
\mathchardef\HA="0222 % hat ("005E not as good)
\def\PS{\mathbin{+{-}+}} % pythagorean subtraction
\def\SH{\raise.7ex\hbox{$\scriptstyle\#$}} % sharp sign for sharped units
\mathchardef\TI="007E % tilde

\chardef\other=12
\def\mft@noc@ts{\catcode`\\=\other \catcode`\{=\other
  \catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
  \catcode`\#=\other \catcode`\~=\other
  \catcode`\_=\other \catcode`\^=\other}
\def\mft@nocats{\mft@noc@ts \catcode`\%=\other}
\def\mft@finstring"#1"{\tentex"#1"\egroup}

\newbox\mft@shorthyf \setbox\mft@shorthyf=\hbox{-\kern-.05em}
\mathchardef\period=`\.
{\catcode`\-=\active \global\def-{\copy\mft@shorthyf\mkern3.9mu}
 \catcode`\.=\active \global\def.{\period\mkern3mu}}

\def\mftbf{\fam\bffam
  \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
  \tenbf}

\def\join#1${} % say %%\join in .mf file to join lines together
\def\]{\hskip0pt plus 1filll\ } % say % comment\] to get comment flush left

{\obeyspaces \global\let =\ } % don't skip spaces which begin a line

\def\mft@verbatimtex{\begingroup 
  \def\par{\leavevmode\endgraf}% don't skip empty lines
  \mft@nocats \obeyspaces \obeylines \tt}

% the percent sign in btex .. etex group is a comment character.
\def\mft@btex{\begingroup \mft@noc@ts \obeyspaces \tt}

% Names `\mftbeginV', `\mftbeginB', and `\mftend' are hard-wired into MFT

\outer\def\mftbeginV#1{\5{#1}$\mftverbatimtex}
\outer\def\mftbeginB#1{\5{#1}$\mftbtex}
\def\mftend#1{$\5{#1}}

\outer\def\mftverbatimtex{\let\par=\endgraf \mft@verbatimtex \parskip=\z@
  \mft@finish}
\outer\def\mftbtex{\mft@btex \mft@finish}

{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|mft@finish#1\mftend{#1|endgroup|mftend}}

\catcode`\@=12

\endinput