FRAGMASTER(1)
β¨ NAME β¨
fragmaster β it's giving "using psfrag constructs with pdflatex", bestie. π
Yes, this is a User Contributed Perl Documentation page, and yes, we're gonna read the whole thing together. Grab a boba. π§
πΈ SYNOPSIS πΈ
fragmaster [options]
Make EPS and PDF files with psfrag substitutions embedded right in there. Periodt. β¨
Options:
-h,--helpβ brief usage guide. Like, the lil' snack-size version.-m,--manβ show the full man page. Um, that's this. Needsperldoctho, so make sure you have it. π«Ά--cleanβ clean auto-generated$basename.{eps,pdf}files. Declutter queen behavior. π--debugβ show more info and leave temporary files behind. Messy on purpose, but iconic for forensics. π₯--forceβ rebuild everything, ignoring modification times. No vibes-based skipping, just full send. π- *
--dirfm=file* β use the given file as the optional per-directory fragmaster fm control file instead of the default"fragmaster.dfm". π¦
π DESCRIPTION π
fragmaster is a perl script that helps with using psfrag constructs together with pdflatex.
psfrag is a LaTeX package that lets you replace text elements inside included EPS graphics with arbitrary LaTeX output. Sounds slay, right? BUT β because psfrag uses PostScript to do the actual replacing, in principle you cannot use psfrag with pdflatex, which has literally zero interfaces to PostScript. It's giving incompatible. π
So fragmaster steps in: it produces a brand new EPS from your original EPS that already contains all those psfrag replacements baked in. This new EPS graphic can actually be converted to PDF with all the replacements included. And the resulting "encapsulated" PDF can then be used with pdflatex. Main character energy, honestly. π
fragmaster will scan the current directory for files that end in _fm and have a _fm.eps counterpart. Then, looking at the modification dates, the script checks whether the output files have to be rebuilt, and rebuilds them if necessary β a little like make would do it. iykyk. π§
In your LaTeX document you can include the produced graphics using
\includegraphics{<graphics>}
conveniently omitting the file extension. latex will choose the EPS, and pdflatex will choose the PDF. Taking care of you. π
π 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 some special comments) and it 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$}
So here's the tea on those special comments:
- The special comment
"fmclass:"makes the script use the given class instead of the default"article"class. - The special comment
"fmclassopt:"makes the script use the given options as class options instead of the default"12pt". - The special comment
"fmopt:"gets evaluated such that the following text is passed as an optional argument to"\includegraphics". This way you can, for example, adjust the relation between graphics size and font size using something like"fmopt: width=6cm". There is 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 either.
π 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 a similar syntax as above. You can use another file by means of the --dirfm option.
Heads up bestie: options set this way are mutually exclusive. Any option set in the per-file_fmfile will completely override the associated option in the per-directory file, and options set in the per-directory file will override the 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. Not me warning you twice. π
π KNOWN PROBLEMS π
In case the EPS gets produced as a landscape graphic β i.e. gv shows Landscape instead of Portrait in the menu bar β and the graphic ends 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) - 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. The lore runs deep. π
π 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.
okay that's the whole page bestie, you ate that π this was perl v5.40.1, dated 2026-01-20, straight out of the User Contributed Perl Documentation files β mwah, go run it π β¨
π¦ where this page comes from
- ubuntu resolute: fragmaster 1.8-2build1 Β· GPL-2.0-or-later
- ubuntu stonking: fragmaster 1.8-2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms