Scroll to navigation

FRAGMASTER(1) User Contributed Perl Documentation FRAGMASTER(1)

NAME

fragmaster - Using psfrag constructs with pdflatex

SYNOPSIS

 fragmaster [options]
 Create EPS and PDF files with embedded psfrag substitutions.
 Options:
  -h,--help          Brief usage guide.
  -m,--man           Show full man page (needs perldoc)
  --clean            Clean auto-generated $basename.{eps,pdf} files.
  --debug            Show more info and leave temporary files behind.
  --force            Rebuild everything ignoring modification times.
  --dirfm=file       Use given file as optional per-directory
                     fragmaster fm control file instead of default
                     "fragmaster.dfm".

DESCRIPTION

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.

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-directory fragmaster dir control file.

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.

KNOWN PROBLEMS

In case the EPS will be produced as landscape graphics, i.e. gv shows Landscape instead of Portrait in the menu bar, and the graphic will end up turned around 90 degrees in your document, then it is likely that your original EPS is wider than it is tall. In this case some (more recent) versions of dvips make the "smart" assumption that your graphic is landscape, even though the graphic's proportions don't tell anything about the orientation of its contents... This still can happen in case your input EPS matches a standard paper size.

Anyway, you can make dvips behave nicer by specifying the following line in /usr/share/texmf/dvips/config/config.pdf (or a local equivalent inside /usr/local/share/texmf):

@ custom 0pt 0pt

In the likely case that you're wondering why, I'd recommend the dvipsk sources warmly to you...

AUTHORS

Tilman Vogel <tilman vogel web de> (dot at dot) and Agustin Martin <agustin6martin gmail com> (at dot)

HISTORY

This script was inspired by a posting from Karsten Roemke <k roemke gmx de> (dot at dot) with subject "psfrag pdflatex, lange her" in de.comp.text.tex on 2003-11-11 05:25:44 PST.

Karsten Roemke was inspired for his solution by postings from Thomas Wimmer.

COPYRIGHT

 Copyright (C) 2004 Tilman Vogel
 Copyright (C) 2011-2023 Agustin Martin

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

2024-06-17 perl v5.38.2