FIG2PS(1)

πŸ“¦
version 1.5 Β· 2 versions
, in debian bookworm, debian trixie, fedora 43, fedora 44, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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, fig2ps runs gv on every file right after it gets produced. it's on by default if fig2ps thinks 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 with xpdf instead of gv. obviously that's not gonna be really useful if you're producing PS files... you've been warned. πŸ™ˆ
  • --viewer=command β€” runs command instead of gv on the produced files.
  • --keep β€” tells fig2ps to keep the temporary directory where the temporary files live. useful for debugging. and if this option is on, fig2ps prints 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 to pack1,pack2,.... this resets any package given by the --add command-line option. for more info about packages, see the PREAMBLE section below.
  • --add=pack1,pack2,... β€” adds pack1,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 β€” uses file as 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. file will be looked for using kpsewhich.
  • --pdf, --nopdf β€” whether the final output of fig2ps will be PDF or postscript. this option is automatically applied when the program is called as fig2pdf. note that in any case, fig2ps has to go through Postscript output to produce a PDF file.
  • --eps β€” changes the output default extension from .ps to .eps. this is on by default when the program is called as fig2eps. it has no other effects.
  • --manual-ps2pdf β€” when producing PDF files, fig2ps uses epstopdf to do the conversion. that may lead to bad quality output when you have embedded pictures. using this option disables PDF production by epstopdf and lets ps2pdf produce the final output PDF (but after tweaking the PS file using epstopdf). in general, this produces much better results. πŸ”₯
  • --ps2pdf-options β€” when --manual-ps2pdf doesn't produce output of decent quality, you can use this option to manually feed options to ps2pdf. using this option implies --manual-ps2pdf.
  • --keepps β€” when producing a PDF file, asks fig2ps to keep the intermediary Postscript file.
  • --forcespecial, --noforcespecial β€” fig2ps only 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 β€” passes string as options for dvips.
  • --fig2dev=string β€” passes string as options for fig2dev.
  • --preamble=string β€” adds string in the preamble of the LaTeX file generated, just before the \begin{document} stanza. effects are cumulative.
  • -V, --version β€” prints the version of fig2ps and 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 --add command-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 --input command-line option.
  • PREAMBLE=string β€” identical to the --preamble option, 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 --input file is specified, it will be used directly with a \input statement. a \documentclass statement 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, and PACKAGES (the latter is overridden by the --packages command-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, fig2ps runs dvips with the -E option. 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 β€” asks gs to 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 πŸ’–