OnWorks favicon

fragmaster - Online in the Cloud

Run fragmaster in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command fragmaster that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



fragmaster - Using psfrag constructs with pdflatex


fragmaster [options]

Create EPS and PDF files with embedded psfrag substitutions.

-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 is a perl script that helps using psfrag constructs with pdflatex.

psfrag is a LaTeX package which allows 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

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


conveniently omitting file extension. latex will choose the EPS, pdflatex will choose the

fragmaster control file and other related files.
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{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

This is work in progress and still needs extensive checking. Double-check that
modification date based rebuilds are working properly.


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

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

@ custom 0pt 0pt

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


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


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 (C) 2004 Tilman Vogel
Copyright (C) 2011-2015 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.

Use fragmaster online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    ExpressLuke GSI
    ExpressLuke GSI
    This SourceForge download page was to
    grant users to download my source built
    GSIs, based upon phhusson's great
    work. I build both Android Pie and
    Android 1...
    Download ExpressLuke GSI
  • 2
    PyQt is the Python bindings for
    Digia's Qt cross-platform
    application development framework. It
    supports Python v2 and v3 and Qt v4 and
    Qt v5. PyQt is avail...
    Download PyQt
  • 3
    Gambas3* coding tools and examples for
    use in SMB or other organizations that
    make internal programs. E.g. from
    database fields to class sourcecode with
    Download garlic3
  • 4
    Sardi is a complete restyling and
    optimisation of svg code. 6 choices for
    your applications and 10 kind of folders
    to use in your file manager. The sardi
    Download Sardi
  • 5
    LMMS Digital Audio Workstation
    LMMS Digital Audio Workstation
    LMMS is a free cross-platform software
    which allows you to produce music with
    your computer. If you like this project
    consider getting involved in the project
    Download LMMS Digital Audio Workstation
  • 6
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS is a market-leading real-time
    operating system (RTOS) for
    microcontrollers and small
    microprocessors. Distributed freely
    under the MIT open source lice...
    Download FreeRTOS Real Time Kernel (RTOS)
  • 7
    Avogadro is an advanced molecular
    editor designed for cross-platform use
    in computational chemistry, molecular
    modeling, bioinformatics, materials
    science and ...
    Download Avogadro
  • More »

Linux commands