Debian Codegraph @

texmf-dist/tex/latex/feynmp-auto/feynmp-auto.sty

raw
1 %%
2 %% This is file `feynmp-auto.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% feynmp-auto.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2013 by Enrico Gregorio
12 %% <Enrico dot Gregorio at univr dot it>
13 %% -------------------------------------------------------
14 %%
15 %% This work may be distributed and/or modified under the
16 %% conditions of the LaTeX Project Public License, either
17 %% version 1.3c of this license or (at your option) any
18 %% later version. The latest version of this license is in
19 %% http://www.latex-project.org/lppl.txt
20 %% and version 1.3 or later is part of all distributions
21 %% of LaTeX version 2005/12/01 or later.
22 %%
23 %% This work has the LPPL maintenance status `maintained'.
24 %%
25 %% The Current Maintainer of this work is Enrico Gregorio.
26 %%
27 %% This work consists of the files
28 %% feynmp-auto.dtx
29 %% feynmp-auto.ins
30 %% and the derived file feynmp-auto.sty.
31 %%
32 \NeedsTeXFormat{LaTeX2e}[2008/04/05]
33 \ProvidesPackage{feynmp-auto}
34 [2013/05/03 v1.1 Automatic processing of feynmp graphics]
35 \@ifundefined{eTeXversion}
36 {\PackageError{feynmp-auto}{LaTeX engine too old, aborting}
37 {Please upgrade your TeX system}\@@end}{}
38 \newif\iffnmpa@force
39 \DeclareOption{force}{\fnmpa@forcetrue}
40 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{feynmp}}
41 \ProcessOptions\relax
42 \RequirePackage{feynmp}
43 \RequirePackage{ifpdf,ifxetex}
44 \RequirePackage{pdftexcmds}
45 \ifnum\pdf@shellescape=\z@
46 \PackageWarningNoLine{feynmp-auto}
47 {The automatic feature can't be used\MessageBreak
48 because `shell escape' is disabled}
49 \fi
50 \ifpdf
51 \DeclareGraphicsRule{*}{mps}{*}{}
52 \fi
53 \ifxetex
54 \DeclareGraphicsRule{*}{eps}{*}{}
55 \fi
56 \ifdefined\pdf@filemdfivesum
57 \def\fnmpa@mdfivesum{0}
58 \def\fnmpa@gethash{%
59 \IfFileExists{\thefmffile.mp}
60 {\edef\fnmpa@mdfivesum{\pdf@filemdfivesum{\thefmffile.mp}}}
61 {}%
62 }
63 \def\fnmpa@processmp{%
64 \IfFileExists{\thefmffile.mp}
65 {\fnmpa@compare}
66 {}%
67 }
68 \def\fnmpa@compare{%
69 \ifnum\pdf@strcmp{\fnmpa@mdfivesum}{\pdf@filemdfivesum{\thefmffile.mp}}=\z@
70 % do nothing, the files is unmodified
71 \else
72 \immediate\write18{mpost \thefmffile}%
73 \fi
74 }
75 \else
76 \let\fnmpa@gethash\relax
77 \def\fnmpa@processmp{%
78 \IfFileExists{\thefmffile.mp}{\immediate\write18{mpost \thefmffile}}{}%
79 }
80 \fi
81 \iffnmpa@force
82 \let\fnmpa@gethash\relax
83 \def\fnmpa@processmp{%
84 \IfFileExists{\thefmffile.mp}{\immediate\write18{mpost \thefmffile}}{}%
85 }
86 \fi
87 \def\fmffile#1{%
88 \def\thefmffile{#1}%
89 \equaltojobname{\thefmffile}{%
90 \PackageError{feynmp}
91 {The argument of \fmffile MUST NOT be identical\MessageBreak
92 to the name of your main input file! I will use fmfdefault.mf\MessageBreak
93 this time around, but you'd better fix your code now!}%
94 {Invalid argument to \string\fmffile!}%
95 \def\thefmffile{fmfdefault}}{}%
96 \if@fmfio
97 \fnmpa@gethash % Added
98 \@ifundefined{ifmeasuring@}%
99 {}%
100 {\def\if@fmfio{\ifmeasuring@\else}}%
101 \immediate\openout\@outfmf=\thefmffile.mp\relax
102 \fmfcmd{\p@rcent\space \thefmffile.mp -- do not edit, %
103 generated automatically by \jobname.tex^^J%
104 input feynmp^^J%
105 require_RCS_revision "\fmf@revision";}%
106 \fi
107 \setcounter{fmfgraph}{0}}
108 \def\endfmffile{%
109 \fmfcmd{\p@rcent\space the end.^^J%
110 end.^^J%
111 endinput;}%
112 \if@fmfio
113 \immediate\closeout\@outfmf
114 \fi
115 \fnmpa@processmp % Added
116 \let\thefmffile\relax
117 }
118 \endinput
119 %%
120 %% End of file `feynmp-auto.sty'.