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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
%%
%% This is file `emp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% emp.dtx (with options: `style')
%%
%% Copyright (C) 1997 by Thorsten.Ohl@Physik.TH-Darmstadt.de
%%
%% This file is NOT the source for emp, because almost all comments
%% have been stripped from it. It is NOT the preferred form of emp
%% for making modifications to it.
%%
%% Therefore you can NOT redistribute and/or modify THIS file. You can
%% however redistribute the complete source (emp.dtx and emp.ins)
%% and/or modify it under the terms of the GNU General Public License as
%% published by the Free Software Foundation; either version 2, or (at
%% your option) any later version.
%%
%% As a special exception, you can redistribute parts of this file for
%% the electronic distribution of scientific papers, provided that you
%% include a short note pointing to the complete source.
%%
%% Emp is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \CheckSum{291}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{v1.00}
\NeedsTeXFormat{LaTeX2e}
{\def\RCS#1#2\endRCS{%
\ifx$#1%
\@RCS $#2 \endRCS
\else
\@RCS $*: #1#2$ \endRCS
\fi}%
\def\@RCS $#1: #2,v #3 #4 #5 #6 #7$ \endRCS{%
\gdef\filename{#2}%
\gdef\filerevision{#3}%
\gdef\filedate{#4}%
\gdef\filemaintainer{#6}}%
\RCS $Id: emp.dtx,v 1.10 1997/11/12 21:14:41 ohl Exp $ \endRCS}%
\ProvidesPackage{emp}[\filedate\space\fileversion\space
Encapsulated MetaPost LaTeX Package (\filemaintainer)]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphics}}
\ProcessOptions
\RequirePackage{graphics}[1994/12/15]
\RequirePackage{verbatim}
{\catcode`\%=11\gdef\p@rcent{%}}
\def\empwrite#1{%
\if@empio
\immediate\write\@outemp{#1}%
\fi
\ignorespaces}
\newif\if@empio
\@empiotrue
\newwrite\@outemp
\newcommand{\empfile}[1][\jobname]{%
\def\theempfile{#1}%
\if@empio
\@ifundefined{ifmeasuring@}%
{}%
{\def\if@empio{\ifmeasuring@\else}}%
\immediate\openout\@outemp=\theempfile.mp\relax
\empwrite{\p@rcent\p@rcent\p@rcent\space \theempfile.mp -- %
do not edit, generated automatically by \jobname.tex}%
\expandafter\ifx\expandafter*\the\emp@TeX*\else
\emp@TeX=\expandafter{\the\emp@TeX^^J\begin{document}}%
\empwrite{verbatimtex^^J\the\emp@TeX^^Jetex;}%
\fi
\expandafter\ifx\expandafter*\the\emp@prelude*\else
\empwrite{\the\emp@prelude;}%
\fi
\fi
\setcounter{empfig}{0}}
\let\theempfile\relax
\newcounter{empfig}
\newtoks\emp@TeX
\ifcase\@ptsize
\emp@TeX={\documentclass[10pt]{article}}
\or
\emp@TeX={\documentclass[11pt]{article}}
\or
\emp@TeX={\documentclass[12pt]{article}}
\else
\emp@TeX={\documentclass{article}}
\fi
\newtoks\emp@prelude
\def\empTeX#1{\emp@TeX={#1}}
\def\empaddtoTeX#1{\emp@TeX=\expandafter{\the\emp@TeX^^J#1}}
\def\empprelude#1{\emp@prelude={#1}}
\def\empaddtoprelude#1{\emp@prelude=\expandafter{\the\emp@prelude^^J#1}}
\def\endempfile{%
\expandafter\ifx\expandafter*\the\emp@TeX*\else
\empwrite{verbatimtex^^J\string\end{document}^^Jetex;}%
\fi
\empwrite{\p@rcent\p@rcent\p@rcent\space the end.^^J%
end.^^J%
endinput;}%
\let\theempfile\relax
\if@empio
\immediate\closeout\@outemp
\fi}
\newcommand{\emp}[1][*]{%
\def\emp@@name{#1}%
\emp@}
\def\emp@(#1,#2){%
\emp@start{#1}{#2}%
\emp@includegraphics{\theempfile}{\theempfig}%
\empcmds}
\def\emp@start#1#2{%
\emp@checkfile
\global\expandafter\advance\csname c@empfig\endcsname \@ne
\emp@@def{\emp@@name}%
\empwrite{beginfig(\theempfig);^^J%
LaTeX_unitlength := \the\unitlength;^^J%
w := #1*LaTeX_unitlength;^^J%
h := #2*LaTeX_unitlength;}}
\def\emp@checkfile{%
\ifx\theempfile\relax
\errhelp={Outside a empfile environment, I have no clue as to where^^J%
the MetaPost commands should go. I will use empdefault.mp^^J%
for this graph, but you'd better fix your code!}%
\errmessage{I detected a emp environment outside of empfile}%
\empfile[empdefault]
\fi}
\def\emp@includegraphics#1#2{%
\leavevmode
\IfFileExists{#1.#2}%
{\includegraphics{#1.#2}}%
{\typeout{%
emp: File #1.#2\space not found:^^J%
emp: Process #1.mp with MetaPost and then %
reprocess this file.}}}
\def\empcmds{%
\begingroup
\@bsphack
\let\do\@makeother\dospecials
\catcode`\^^M\active
\def\verbatim@processline{\empwrite{\the\verbatim@line}}%
\verbatim@start}%
\def\endempcmds{%
\@esphack
\endgroup}
\def\endemp{%
\endempcmds
\empwrite{endfig;}}
\newcommand{\empdef}[1][\relax]{%
\def\emp@@name{#1}%
\emp@def}
\def\emp@def(#1,#2){%
\emp@start{#1}{#2}%
\empcmds}
\def\endempdef{\endemp}
\def\emp@@def#1{%
\global\e@namedef{emp@k:f:#1}{\theempfile}%
\global\e@namedef{emp@k:c:#1}{\theempfig}}
\def\e@namedef#1{\expandafter\edef\csname #1\endcsname}
\newcommand{\empgraph}[1][*]{%
\def\emp@@name{#1}%
\emp@graph}
\def\emp@graph(#1,#2){%
\emp@start{#1}{#2}%
\empwrite{draw begingraph (w, h);}%
\emp@includegraphics{\theempfile}{\theempfig}%
\empcmds}
\def\endempgraph{%
\endempcmds
\empwrite{endgraph;^^Jendfig;}}
\def\empuse#1{%
\@ifundefined{emp@k:f:#1}%
{\typeout{emp: \string\empuse: `#1' undefined!}}%
{\emp@includegraphics{\@nameuse{emp@k:f:#1}}{\@nameuse{emp@k:c:#1}}}}
\endinput
%%
%% End of file `emp.sty'.
|