fragmaster is a perl script that helps using psfrag constructs with pdflatex.
psfrag is a LaTeX package which allows one to replace text elements in included EPS graphics by arbitrary
LaTeX output. Because psfrag uses PostScript for making the replacements, in principle you can't use
psfrag with pdflatex which doesn't have any interfaces to PostScript.
fragmaster produces a new EPS from your original EPS which already contains all those psfrag
replacements. This new EPS graphic actually can be converted to PDF including all replacements. The
resulting "encapsulated" PDF can then be used with pdflatex.
fragmaster will scan the current directory for files which end in _fm and have a _fm.eps counterpart.
Looking at the modification dates, the script checks if the output files have to be rebuilt and does so
if necessary (a little like "make" would do it).
In your LaTeX document you can include the produced graphics using
\includegraphics{<graphics>}
conveniently omitting file extension. latex will choose the EPS, pdflatex will choose the PDF.
fragmastercontrolfileandotherrelatedfiles.
To use the script you have to create two files per graphic:
* <graphics>_fm.eps: the EPS file itself,
* <graphics>_fm: a fragmaster control file.
From these files the psfragged graphics will be created:
* <graphics>.eps,
* <graphics>.pdf
The _fm control file is basically a LaTeX file (with optionally special comments) and can look like this:
% Just an ordinary comment
%
% Some special comments:
% fmclass: book
% fmclassopt: 11pt
% fmopt: width=6cm
%
% Another special comment:
% head:
% \usepackage{amsmath}
% end head
% psfrag commands:
\psfrag{x}{$x$}
\psfrag{y}{$y = x^2$}
Special comment "fmclass:" will make the script use given class instead of default "article" class.
Special comment "fmclassopt:" will make the script use given options as class options instead of default
"12pt".
The special comment "fmopt:" will be evaluated such that the following text will by passed as optional
argument to "\includegraphics". This way you can e.g. adjust the relation between graphics size and font
size using something like "fmopt: width=6cm". No global default for this.
The special comment construct "head:/end head" causes the lines in between to be included in the preamble
of the LaTeX temporary document after having the leading comment characters "%" stripped off. This way,
you can include LaTeX packages, as in "\usepackage{amsmath}". No global default for this.
Per-directoryfragmasterdircontrolfile.
You can set per-directory "fmclass:", "fmclassopt:", "fmopt:" and "head:/end head" options by means of a
per-directory fragmaster control file fragmaster.dfm with similar syntax as above. You can use another
file by means of the --dirfm option. Note that options set this way are mutually exclusive, any option
set in per-file _fm file will completely override associated option in per-directory file, and options
set in per-directory file will override initial defaults ("\documentclass[12pt]{article}"). Empty
options are ignored.
This is work in progress and still needs extensive checking. Double-check that modification date based
rebuilds are working properly.