blob: 8b6481d47ff7d05225e6fa895cf7844380e7f7d5 (
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
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
|
%%
%% This is file `fmp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fmp.dtx (with options: `package')
%%
%% Copyright 2001 Marco Kuhlmann
%%
%% This program may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version
%% 1.2 of this license or (at your option) any later version. The
%% latest version of this license is in
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% This program consists of the files fmp.ins and fmp.dtx
%%
\NeedsTeXFormat{LaTeX2e}[1995/05/16]
\ProvidesPackage{fmp}
[2001/11/19 v1.1a Support for Functional MetaPost]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}
\ProcessOptions
\@ifundefined{pdfoutput}{%
\RequirePackage{graphicx}[1999/02/16]%
\DeclareGraphicsRule{*}{eps}{*}{}}{%
\RequirePackage[pdftex]{graphicx}[1994/12/15]%
\DeclareGraphicsRule{*}{mps}{*}{}}
\RequirePackage{verbatim}
\newwrite\fmp@sourceout
\newwrite\fmp@scriptout
\newif\iffmp@sourceio
\fmp@sourceiofalse
\newif\iffmp@scriptio
\fmp@scriptiofalse
\newcounter{fmpfigure}
\newenvironment*{fmp}{}{}
\def\fmp{%
\begingroup
\@bsphack
\let\do\@makeother\dospecials
\catcode`\^^M\active
\def\verbatim@processline{\fmp@sourcewrite{\the\verbatim@line}}%
\verbatim@start}
\def\endfmp{%
\@esphack
\endgroup}
\def\fmp@sourcewrite#1{%
\iffmp@sourceio \else \global\fmp@sourceiotrue\fmp@sourceopen \fi%
\immediate\write\fmp@sourceout{#1}}
\def\fmp@sourceopen{%
\immediate\openout\fmp@sourceout\fmp@sourcefilename%
\edef\@tempa{\the\fmp@sourcepreamble}%
\immediate\write\fmp@sourceout{\@tempa}}
\newcommand*{\fmpsourcefilename}[1]{%
\gdef\fmp@sourcefilename{#1}}
\@onlypreamble{\fmpsourcefilename}
\def\fmp@sourcefilename{\jobname.hs}
\newtoks\fmp@sourcepreamble
\newcommand*{\fmpsourcepreamble}[1]{%
\global\fmp@sourcepreamble={#1}}
\@onlypreamble{\fmpsourcepreamble}
\newcommand*{\fmpaddtosourcepreamble}[1]{%
\fmp@sourcepreamble=\expandafter{\the\fmp@sourcepreamble#1}}
\@onlypreamble{\fmpaddtosourcepreamble}
\fmp@sourcepreamble={-- This is file `\fmp@sourcefilename',
created automatically. Do not edit!^^J}
\def\fmp@sourceclose{%
\iffmp@sourceio
\edef\@tempa{\the\fmp@sourcepostamble}%
\fmp@sourcewrite{\@tempa}%
\immediate\closeout\fmp@sourceout
\fi}
\AtEndDocument{\fmp@sourceclose}
\newtoks\fmp@sourcepostamble
\newcommand*{\fmpsourcepostamble}[1]{%
\global\fmp@sourcepostamble={#1}}
\@onlypreamble{\fmpsourcepostamble}
\newcommand*{\fmpaddtosourcepostamble}[1]{%
\fmp@sourcepostamble=\expandafter{\the\fmp@sourcepostamble#1}}
\@onlypreamble{\fmpaddtosourcepostamble}
\fmp@sourcepostamble={^^J-- End of file `\fmp@sourcefilename'}
\newcommand*{\fmpfigure}[2][]{%
\fmp@scriptwrite{%
generate "\fmp@figurebasename" \thefmpfigure\space #2}%
\fmp@includegraphics{#1}{\fmp@figurebasename}{\thefmpfigure}%
\refstepcounter{fmpfigure}}
\def\fmp@scriptwrite#1{%
\iffmp@scriptio \else \global\fmp@scriptiotrue\fmp@scriptopen \fi%
\immediate\write\fmp@scriptout{#1}}
\def\fmp@scriptopen{%
\immediate\openout\fmp@scriptout\fmp@scriptfilename%
\edef\@tempa{\the\fmp@scriptpreamble}%
\immediate\write\fmp@scriptout{\@tempa}}
\newtoks\fmp@scriptpreamble
\newcommand*{\fmpscriptpreamble}[1]{%
\global\fmp@scriptpreamble={#1}}
\@onlypreamble{\fmpscriptpreamble}
\newcommand*{\fmpaddtoscriptpreamble}[1]{%
\fmp@scriptpreamble=\expandafter{\the\fmp@scriptpreamble#1}}
\@onlypreamble{\fmpaddtoscriptpreamble}
\fmp@scriptpreamble={hugs \fmp@sourcefilename\space <<!}
\newcommand*{\fmpscriptfilename}[1]{%
\gdef\fmp@scriptfilename{#1}}
\@onlypreamble{\fmpscriptfilename}
\def\fmp@scriptfilename{fmpgenerate.sh}
\newcommand*{\fmpfigurebasename}[1]{%
\gdef\fmp@figurebasename{#1}}
\@onlypreamble{\fmpfigurebasename}
\def\fmp@figurebasename{fmpfigure}
\def\fmp@includegraphics#1#2#3{%
\leavevmode
\IfFileExists{#2.#3}%
{\includegraphics[#1]{#2.#3}}%
{\typeout{fmp: Could not find file #2.#3}}}
\def\fmp@scriptclose{%
\iffmp@scriptio
\edef\@tempa{\the\fmp@scriptpostamble}%
\fmp@scriptwrite{\@tempa}%
\immediate\closeout\fmp@scriptout
\fi}
\AtEndDocument{\fmp@scriptclose}
\newtoks\fmp@scriptpostamble
\newcommand*{\fmpscriptpostamble}[1]{%
\global\fmp@scriptpostamble={#1}}
\@onlypreamble{\fmpscriptpostamble}
\newcommand*{\fmpaddtoscriptpostamble}[1]{%
\fmp@scriptpostamble=\expandafter{\the\fmp@scriptpostamble#1}}
\@onlypreamble{\fmpaddtoscriptpostamble}
\fmp@scriptpostamble={:quit}
\endinput
%%
%% End of file `fmp.sty'.
|