summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/feynmp-auto/feynmp-auto.sty
blob: 0b051541dd1df7114e52a877d31afceb3d1ca4cf (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
%%
%% This is file `feynmp-auto.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% feynmp-auto.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2013 by Enrico Gregorio
%% <Enrico dot Gregorio at univr dot it>
%% -------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c 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.3 or later is part of all distributions
%% of LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Enrico Gregorio.
%% 
%% This work consists of the files
%%   feynmp-auto.dtx
%%   feynmp-auto.ins
%% and the derived file feynmp-auto.sty.
%% 
\NeedsTeXFormat{LaTeX2e}[2008/04/05]
\ProvidesPackage{feynmp-auto}
    [2013/03/12 v1.0 Automatic processing of feynmp graphics]
\@ifundefined{eTeXversion}
  {\PackageError{feynmp-auto}{LaTeX engine too old, aborting}
   {Please upgrade your TeX system}\@@end}{}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{feynmp}}
\ProcessOptions\relax
\RequirePackage{feynmp}
\RequirePackage{ifpdf,ifxetex}
\RequirePackage{pdftexcmds}
\ifnum\pdf@shellescape=\z@
  \PackageWarningNoLine{feynmp-auto}
    {The automatic feature can't be used\MessageBreak
     because `shell escape' is disabled}
\fi
\ifpdf
  \DeclareGraphicsRule{*}{mps}{*}{}
\fi
\ifxetex
  \DeclareGraphicsRule{*}{eps}{*}{}
\fi
\ifdefined\pdf@filemdfivesum
  \def\fnmpa@mdfivesum{0}
  \def\fnmpa@gethash{%
    \IfFileExists{\thefmffile.mp}
      {\edef\fnmpa@mdfivesum{\pdf@filemdfivesum{\thefmffile.mp}}}
      {}%
  }
  \def\fnmpa@processmp{%
    \IfFileExists{\thefmffile.mp}
      {\fnmpa@compare}
      {}%
  }
  \def\fnmpa@compare{%
    \ifnum\pdf@strcmp{\fnmpa@mdfivesum}{\pdf@filemdfivesum{\thefmffile.mp}}=\z@
      % do nothing, the files is unmodified
    \else
      \immediate\write18{mpost \thefmffile}%
    \fi
  }
\else
  \let\fnmpa@gethash\relax
  \def\fnmpa@processmp{%
    \IfFileExists{\thefmffile.mp}{\immediate\write18{mpost \thefmffile}}{}%
  }
\fi
\def\fmffile#1{%
  \def\thefmffile{#1}%
  \equaltojobname{\thefmffile}{%
    \PackageError{feynmp}
      {The argument of \fmffile MUST NOT be identical\MessageBreak
       to the name of your main input file!  I will use fmfdefault.mf\MessageBreak
       this time around, but you'd better fix your code now!}%
      {Invalid argument to \string\fmffile!}%
    \def\thefmffile{fmfdefault}}{}%
  \if@fmfio
    \fnmpa@gethash % Added
    \@ifundefined{ifmeasuring@}%
      {}%
      {\def\if@fmfio{\ifmeasuring@\else}}%
    \immediate\openout\@outfmf=\thefmffile.mp\relax
    \fmfcmd{\p@rcent\space \thefmffile.mp -- do not edit, %
            generated automatically by \jobname.tex^^J%
            input feynmp^^J%
            require_RCS_revision "\fmf@revision";}%
  \fi
  \setcounter{fmfgraph}{0}}
\def\endfmffile{%
  \fmfcmd{\p@rcent\space the end.^^J%
          end.^^J%
          endinput;}%
  \if@fmfio
    \immediate\closeout\@outfmf
  \fi
  \fnmpa@processmp % Added
  \let\thefmffile\relax
}
\endinput
%%
%% End of file `feynmp-auto.sty'.