blob: 29fd83da7c1fd0c6f3f0eccb62249845f88f1215 (
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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
%%
%% This is file `abc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% abc.dtx (with options: `package')
%%
%% Copyright 2006, 2008 Enrico Gregorio
%%
%% This program is provided under the terms of the
%% LaTeX Project Public License distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
%%
%% Author: Enrico Gregorio
%% Enrico dot Gregorio at univr dot it
%%
%% This work has the LPPL maintenance status "author-maintained".
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{abc}
[2016/05/15 v2.0b Enrico Gregorio]
\RequirePackage{ifluatex}
\newif\ifabc@shellescape
\newif\ifabc@generate
\newif\ifabc@warning
\newif\ifabc@saveall
\newif\ifabc@mup
\DeclareOption{mup}{\abc@muptrue}
\DeclareOption{noshellescape}{\abc@shellescapefalse\abc@warningtrue
\abc@savealltrue}
\DeclareOption{shellescape}{\abc@shellescapetrue}
\DeclareOption{nogenerate}{\abc@generatefalse}
\DeclareOption{generate}{\abc@generatetrue}
\DeclareOption{nosaveall}{\abc@saveallfalse}
\DeclareOption{saveall}{\abc@savealltrue}
\def\abc@epsext{eps}
\DeclareOption{ps2eps}{\def\abc@pscmd{ps2eps -f}}
\DeclareOption{ps2epsi}{\def\abc@pscmd{ps2epsi}\def\abc@epsext{epsi}}
\DeclareOption{ps2epsidos}{\def\abc@pscmd{ps2epsi}\def\abc@epsext{epi}}
\ExecuteOptions{generate,shellescape,nosaveall,ps2eps}
\ifluatex
\ExecuteOptions{saveall}
\fi
\ProcessOptions\relax
\RequirePackage{verbatim}
\RequirePackage{keyval}
\RequirePackage{graphicx}
\RequirePackage{ifpdf}
\newif\ifabc@unprocessedfiles
\newcounter{abc@count}
\ifabc@mup
\newcommand{\abc@cmd}{mup} % virtually no choice
\newcommand{\abc@parm}{-F} % -F MUST stay
\newcommand{\abc@epstopdfcmd}{epstopdf}
\newcommand{\abc@pdfext}{pdf}
\def\normalabcoutputfile{out-mup}
\def\normalmupoutputfile{\normalabcoutputfile}
\def\mup{\abc}
\def\endmup{\endabc}
\def\mupinput{\abcinput}
\def\abc@ext{.mup}
\def\abc@packagename{mup}
\else
\newcommand{\abc@cmd}{abcm2ps} % virtually no choice
\newcommand{\abc@parm}{-O= -c} % -O= MUST stay
\newcommand{\abc@epstopdfcmd}{epstopdf}
\newcommand{\abc@pdfext}{pdf}
\def\normalabcoutputfile{out-abc}
\def\abc@ext{.abc}
\def\abc@packagename{abc}
\fi
\def\abc@tempfile{\normalabcoutputfile}
\def\abc@opt{}
\let\abc@postopt\@empty
\ifpdf
\let\abc@finalext\abc@pdfext
\else
\let\abc@finalext\abc@epsext
\fi
\newif\ifabc@center
\abc@centertrue
\newcommand{\abcwidth}{\linewidth} % only fractions of \linewidth
\let\mupwidth\abcwidth
\newwrite\abc@out
\def\abc@startgen{%
\@bsphack
\immediate\openout\abc@out\abc@tempfile\abc@ext
\let\do\@makeother\dospecials
\catcode`\^^M\active \catcode`\^^I=12
\def\verbatim@processline{%
\immediate\write\abc@out
{\the\verbatim@line}}%
\verbatim@start}
\def\abc@finishgen{%
\immediate\closeout\abc@out
\@esphack
\abc@process
}
\ifluatex
\IfFileExists{shellesc.sty}
{\RequirePackage{shellesc}\let\abc@shell\ShellEscape}
{\def\abc@shell{\immediate\write18}}
\else
\def\abc@shell{\immediate\write18}
\fi
\def\abc@doshellcommand{%
\abc@shell{%
\ifabc@mup
\abc@cmd\space
\abc@opt\space
\abc@parm\space
\abc@tempfile\abc@ext\space
\else
\abc@cmd\space
\abc@parm\space
\abc@opt\space
\abc@tempfile\abc@ext\space
\fi
\ifx\abc@postopt\@empty
\else\space\abc@postopt\fi
}%
\abc@shell{%
\abc@pscmd\space\abc@tempfile.ps
}%
\ifpdf
\abc@shell{%
\abc@epstopdfcmd\space\abc@tempfile.\abc@epsext
}%
\fi
}
\def\abc@nodoshellcommand{%
\immediate\write\abc@outsh{%
\abc@cmd\space
\abc@parm\space
\abc@opt\space
\abc@tempfile\abc@ext\space
\ifx\abc@postopt\@empty
\else\space\abc@postopt\fi}%
\immediate\write\abc@outsh{%
\abc@pscmd\space\abc@tempfile.ps}%
\ifpdf
\immediate\write\abc@outsh{%
\abc@epstopdfcmd\space\abc@tempfile.\abc@epsext}%
\fi
}
\AtEndDocument{%
\ifabc@warning\ifabc@unprocessedfiles
\PackageWarningNoLine{\abc@packagename}{%
\ifabc@shellescape
You have set the `shellescape' option, but you ran%
\MessageBreak
(pdf)latex without the `-shell-escape' command line%
\MessageBreak
option. Fix it either with the `noshellescape' option%
\MessageBreak
in your document or the correct call of (pdf)latex%
\else
Remember to generate the [eps,pdf] files before compiling%
\MessageBreak
again. Use the file \abc@tempfile.sh for a list or as a script%
\fi}%
\fi\fi}
\ifabc@shellescape
\let\abc@process\abc@doshellcommand
\else
\newwrite\abc@outsh
\immediate\openout\abc@outsh\abc@tempfile.sh
\AtEndDocument{\closeout\abc@outsh}
\let\abc@process\abc@nodoshellcommand
\fi
\ifabc@generate
\let\abc@start\abc@startgen
\let\abc@finish\abc@finishgen
\else
\let\abc@start\comment
\let\abc@finish\endcomment
\fi
\def\abc{\@makeother\%\@ifnextchar[\abc@grab{\abc@grab[]}}
\define@key{abc}{name}[]{%
\if!#1!\stepcounter{abc@count}%
\edef\abc@tempfile{\normalabcoutputfile-\@arabic\c@abc@count}%
\else
\def\abc@tempfile{#1}%
\fi
}
\define@key{abc}{options}{\def\abc@opt{#1}}
\define@key{abc}{postoptions}{\def\abc@postopt{#1}}
\define@key{abc}{program}{\def\abc@cmd{#1}\let\abc@parm\@empty}
\define@key{abc}{width}{\def\abc@width{#1}}
\define@key{abc}{center}[true]{\csname abc@center#1\endcsname}
\define@key{abc}{extension}{\def\abc@ext{.#1}}
\def\abc@grab[#1]{\let\abc@width=\abcwidth
\ifabc@saveall
\setkeys{abc}{name,#1}%
\else
\setkeys{abc}{#1}%
\fi\abc@start}
\def\endabc{%
\abc@finish
\trivlist\item[]\ifabc@center\centering\fi
\IfFileExists{\abc@tempfile.\abc@finalext}
{\includegraphics[width=\abc@width]{\abc@tempfile.\abc@finalext}}%
{\global\abc@warningtrue\fbox{\abc@tempfile}%
\global\abc@unprocessedfilestrue}%
\endtrivlist
}
\def\abcinput{\@ifnextchar[\abc@grabinput{\abc@grabinput[]}}
\def\abc@grabinput[#1]#2{\let\abc@width=\abcwidth\setkeys{abc}{#1}%
\begingroup\def\abc@tempfile{#2}%
\IfFileExists{\abc@tempfile\abc@ext}
{%
\abc@process
\begin{center}
\IfFileExists{\abc@tempfile.\abc@finalext}
{\includegraphics[width=\abc@width]{\abc@tempfile.\abc@finalext}}%
{\fbox{\abc@tempfile}}%
\end{center}%
\endgroup
}
{\PackageWarning{\abc@packagename}{No file \abc@tempfile\abc@ext\space found}}%
}
\endinput
%%
%% End of file `abc.sty'.
|