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