FIG2PS(1)
π FIG2PS π β okay bestie, this is the fig2ps(1) manual page
so you know how XFig makes cute little figures but the text inside them is, like, actual LaTeX? yeah. this whole thing is about making that render properly. it's giving "trust the process" and the process is a whole pipeline. π
β¨ NAME β¨
fig2ps, fig2eps, fig2pdf β converts xfig files into ps|pdf, processing all the text marked as special with LaTeX. periodt. πΈ
π¦ SYNOPSIS π¦
fig2ps [-h|--help]
fig2ps [ options ] file1.fig [file2.fig ...]
fig2pdf [ options ] file1.fig [file2.fig ...]
π DESCRIPTION π
okay so fig2ps takes the figures that XFig produced and turns them into postscript or PDF, and while it's at it, it processes the text with LaTeX. the whole slay here is that it takes advantage of the pstex and pstext_t export formats of fig2dev. chef's kiss. π
fig2ps converts all the files you hand it as arguments, one after another, successively. its behaviour is governed by quite a few options. and here's the little trick that lowkey makes life easier: in all the options, the = sign is optional, so this
fig2ps --bbox=dvips file.fig
and this
fig2ps --bbox dvips file.fig
are literally the same thing. you're welcome. π
π EXAMPLES π
to convert file.fig to PS:
fig2ps file.fig
to convert it to PDF:
fig2pdf file.fig
or, alternatively,
fig2ps --pdf file.fig
and if the XFig file you're converting to PDF contains included images, you might wanna try:
fig2pdf --manual-ps2pdf file.fig
bestie, that last one is the move for embedded pictures. remember it. π«Ά
π OPTIONS π
--gv,--nogvβ if this is on,fig2psrunsgvon every file right after it gets produced. it's on by default iffig2psthinks it's talking to a terminal (i.e. not coming from a pipe). if you're processing a whole pile of files, you might wanna switch that off. π--xpdfβ views the produced files withxpdfinstead ofgv. obviously that's not gonna be really useful if you're producing PS files... you've been warned. π--viewer=commandβ runscommandinstead ofgvon the produced files.--keepβ tellsfig2psto keep the temporary directory where the temporary files live. useful for debugging. and if this option is on,fig2psprints the name of the directory once it's finished its job, so you know exactly where to go look. β¨--packages=pack1,pack2,...β sets the package list topack1,pack2,.... this resets any package given by the--addcommand-line option. for more info about packages, see the PREAMBLE section below.--add=pack1,pack2,...β addspack1,pack2,...to the existing list of packages. see the PREAMBLE section below. this option is cumulative.--bbox=dvips|gs|a,b,c,dβ chooses the method used to determine the bounding box of the files. see the BOUNDING BOX section below for more info.--input=fileβ usesfileas a template for the LaTeX file. more on that in the PREAMBLE section below. ngl this option was written for a private use, though you can of course profit from it. however, most of the time, what you really want is--add=file.filewill be looked for usingkpsewhich.--pdf,--nopdfβ whether the final output offig2pswill be PDF or postscript. this option is automatically applied when the program is called asfig2pdf. note that in any case,fig2pshas to go through Postscript output to produce a PDF file.--epsβ changes the output default extension from.psto.eps. this is on by default when the program is called asfig2eps. it has no other effects.--manual-ps2pdfβ when producing PDF files,fig2psusesepstopdfto do the conversion. that may lead to bad quality output when you have embedded pictures. using this option disables PDF production byepstopdfand letsps2pdfproduce the final output PDF (but after tweaking the PS file usingepstopdf). in general, this produces much better results. π₯--ps2pdf-optionsβ when--manual-ps2pdfdoesn't produce output of decent quality, you can use this option to manually feed options tops2pdf. using this option implies--manual-ps2pdf.--keeppsβ when producing a PDF file, asksfig2psto keep the intermediary Postscript file.--forcespecial,--noforcespecialβfig2psonly processes with LaTeX the text which is marked as special in the Fig file. when this option is on, all text is treated as if it was marked with the special flag.--dvips=stringβ passesstringas options fordvips.--fig2dev=stringβ passesstringas options forfig2dev.--preamble=stringβ addsstringin the preamble of the LaTeX file generated, just before the\begin{document}stanza. effects are cumulative.-V,--versionβ prints the version offig2psand exits. π
π§ CONFIGURATION FILES π§
so many of the command-line options can be set in either the system-wide config file (in /etc) or the user configuration file (in the user's home directory). and some more details can be configured in the configuration files too. here's the hierarchy bestie: global configuration is overridden by the users' configuration, which in turn is overridden by the command line options. the command line always wins. main character energy. π
here's the list of variables you can define:
PACKAGES=pack1,pack2...β defines the basic list of packages. see the PREAMBLE section.ADD=pack1,pack2β has the same effect as the--addcommand-line option. doesn't make too much sense in the global configuration file, but you might wanna use it in a personal one.DOC_CLASS=classβ sets the document class used by LaTeX.DOC_OPTIONS=Ioptionsβ sets the options for the document class.FORCE_SPECIAL=0|1β sets the default for option--forcespecial.GV=0|1β sets the default for option--gv.GV=fileβ has the same effect as the--inputcommand-line option.PREAMBLE=stringβ identical to the--preambleoption, with the slight difference that in configuration files it is not cumulative: the last assignment seen is the only one taken into account. πKEEP_PS=0|1β sets the default for option--keepps.
π PREAMBLE π
the preamble of the LaTeX file is built like this:
- if a
--inputfile is specified, it will be used directly with a\inputstatement. a\documentclassstatement will be added if the input file doesn't contain any. - else, a preamble is made based on the values of
DOC_CLASS,DOC_OPTIONS, andPACKAGES(the latter is overridden by the--packagescommand-line option). see below for the format of the package variables.
then, the packages specified using the ADD variable and the --add command-line options are added to the preamble, followed by the geometry package that deals with setting the size of the output (tweaked for fig2ps's purposes), and finally the contents of the PREAMBLE variable and the --preamble command-line options.
the --packages and --add options, and the corresponding variables, take a comma separated list of packages. options for the packages can be specified in two ways:
[option]packageβ in which you can only specify one option;option1:option2:...:packageβ in which you can specify an arbitrary number of options, as long as you don't need a comma inside an option. should the need arise, use--preamble. π
β BOUNDING BOX β
one of the delicate jobs of fig2ps is setting the bounding box of the produced file β that's the rectangle that holds the figure. there are basically three ways for fig2ps to get them:
dvipsβ in this mode,fig2psrunsdvipswith the-Eoption. it works reasonably fine most of the time, but it will produce incorrect results if you have rotated text near the edge of the graph. πgsβ asksgsto tell the bounding box of the figure. it used to produce systematically perfect results, but the quality has degraded somehow recently. it still works in most of the cases, and that is why it is the default. it fails on very large pictures.a,b,c,dβ specify your bounding box by hand.
the benefit of using the last two methods is that fig2ps tells you how big the picture is (in centimeters). π
π FILES π
/etc/fig2ps/fig2ps.rc, $HOME/.fig2ps.rc
the examples/ directory in the source tarball contains some examples. check fig2ps on them to see if it works fine, but keep in mind that fig2ps will choke on examples/Large-example.fig! π
π SEE ALSO π
xfig(1), fig2dev(1), latex(1), gv(1), gs(1), kpsewhich(1)
the Sourceforge project page at:
http://sourceforce.net/projects/fig2ps
πΈ AUTHOR πΈ
this script was written by Vincent Fourmond, from an original idea of Seb Desreux (the first script is for private use, and used the eepic export of xfig, which is severely limitated), improved by a few others... π«Ά
π₯ BUG REPORT AND FEATURE REQUESTS π₯
please use the tracker from the Sourceforge project page:
https://sourceforge.net/tracker/?group_id=125824
okay that's literally the whole thing, bestie. go forth and convert. β¨
Version 1.4 β dated 2009-01-01, and yeah that's the version and the date right there, so you know exactly what you're working with π
π¦ where this page comes from
- debian bookworm: fig2ps 1.5-7 Β· GPL-2.0-or-later
- debian trixie: fig2ps 1.5-7 Β· GPL-2.0-or-later
- fedora 43: fig2ps 1.5-28.fc43 Β· GPL-2.0-or-later
- fedora 44: fig2ps 1.5-29.fc44 Β· GPL-2.0-or-later
- ubuntu jammy: fig2ps 1.5-7 Β· GPL-2.0-or-later
- ubuntu noble: fig2ps 1.5-7 Β· GPL-2.0-or-later
- ubuntu resolute: fig2ps 1.5-7build1 Β· GPL-2.0-or-later
- ubuntu stonking: fig2ps 1.5-7build1 Β· GPL-2.0-or-later
- Copyright 2004,2005,2006,2009 by Vincent Fourmond
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms