← Previous | ↑ Home | ↑ Programs | → Next |
For the impatient: See the Examples section below.
fig2lat [-l _driver_[,_key_=_value_...]] [_options_] _file_
Fig2lat converts Fig drawings created in XFig, jFig or WinFIG to vector graphics formats used by LaTeX/pdfLaTeX.
Fig2lat uses curved arrowheads on spline and arc ends.
All arrowheads introduced in Xfig 3.2.5 are supported.
Fig2lat uses smaller gaps in dotted, dashed and dash-dotted lines. The minimum of the following two values is used:
The example images below show a line bundle converted by fig2lat and the same line bundle converted in backward compatibility mode.
Converted by fig2lat
Converted in backward compatibility mode
Fig2lat allows to specify a base line width (object line widths are multiples of the base line width) differing from 1/80 inch (0.9bp) specified in the Fig file format specification.
Guidelines for illustrating books (/Tsch1960/ and /Ta2007/) recommend to use the line width of vertical lines in characters like "H" or "T" for lines in illustrations — typically 0.4pt.
Fig2lat allows you to configure a base line with, either in bp, pt, in, cm, or mm. Alternatively you can choose "auto" using 0.4pt for a text size of 10pt and scaling for other text sizes.
Fill patterns use vector graphics operations.
X-splines are drawn as a sequence of Bezier splines, not as polylines like some other programs do.
Fig2lat uses the correct formula q=-0.5s for interpolated splines (unlike other programs using q=-s), see /BS1995/.
Here is a spline example as shown in /BS1995/.
For comparison here is the same spline converted in backward compatibility mode:
Driver | Output |
---|---|
pdf.tex | PDF+TeX file pair for inclusion in pdfLaTeX documents. |
eps.tex | EPS+TeX file pair for inclusion in LaTeX documents. |
pgf | PGF file for inclusion in LaTeX/pdfLaTeX documents. |
tex.pdf | TeX file for direct processing using pdfLaTeX, supporting PDF file. |
tex | TeX file for direct processing using pdfLaTeX. |
eps | Obsoleted. |
svg | Obsoleted. |
Option | Purpose |
---|---|
-l driver[,key=version…] | Output driver, optionally key=value pairs for detailed configuration. |
-o key=value | Key=value pair for detailed configuration. |
-m | Make mode, when processing directories avoid unnecessary conversions if a destination file already exists and is up to date. |
-h --help |
Show help text. |
-v --version |
Show version information. |
-L --license-terms |
Show license information. |
Group | Key | Type | Purpose |
---|---|---|---|
General options | lw | String | Base line width:
|
Text handling | tf | String | Text font Normal (non-special) text handling, either "similar" to use a font with similar features or "fig" to use the font exactly as specified in the Fig file. |
ts | String Float |
Text size Font size for normal (non-special) text, either "none" to not write any font size instruction (use the default LaTeX font size) or a floating point number applied as scale factor to the text size specified in the Fig file. |
|
bbts | Boolean | Bounding box text size Use text size specifications when calculating the bounding box. |
|
smash | Boolean | Controls the use of \smash when writing text objects to LaTeX output. | |
mbox | Boolean | Controls the use of \mbox when writing text objects to LaTeX output. | |
reset@font | Boolean | Controls the use of \reset@font when writing text objects to LaTeX output with font selected by features (tf=similar). | |
ste | String | Encoding used in special text, either "plain" or "utf-8". | |
X-splines | xsss | Integer | X-spline sub segments Number of Bezier spline segments to draw for each X-spline segment. |
Compatibility | cosp | Boolean | Compatible splines Use wrong formula q=-s as XFig and fig2dev do. |
coah | Boolean | Compatible arrowheads Do not draw curved arrowheads, do not cut line ends to have the arrowhead ending in the specified line end point. |
|
xsah | Boolean | X-splines for arrowheads Use X-splines to implement the curved arrowheads. Since version 3.10.0 fast splines are used by default. |
|
cols | Boolean | Compatible line style Use large gaps in dotted and dash-dotted lines. |
|
cofop | Boolean | Compatible fill open paths | |
Driver tex, tex.pdf | dcts | Number | Document class text size Font size to use in the \documentclass instruction. |
Driver eps.tex | showpage | Boolean | Controls the use of the showpage operator for EPS output. |
level | Integer | PS language level, 2 or 3. | |
Source type | xfig | Boolean | Fig file was produced by XFig. The keys xfig, jfig and winfig are mutually exclusive. Fig2lat attempts to recognize the source type automatically if no source type is specified. It uses attributes of the bounding box rectangle — if any — to find the source type, see FAQ: What is a bounding box rectangle? below. |
jfig | Boolean | Fig file was produced by jFig. | |
winfig | Boolean | Fig file was produced by WinFIG. | |
Arrowheads | ahas | Integer | Arrowhead arc segments Number of arrowhead X-spline segments to produce for a 90 degree arc. |
ahss | Integer | Arrowhead spline segments Number of arrowhead X-spline segments to produce per original X-spline segment. |
|
ahms | Integer | Arrowhead minimum segments Minimum number of arrowhead X-spline segments per arrowhead edge. |
|
ahip | Float | Arrowhead iteration precision Precision for iterations when applying arrowheads to X-splines. The default 0.04 calculates arrowhead X-spline points to a precision of 1/100 mm. Lowering the precision might increase the computation time significantly. |
|
ahbs | Boolean | Use simple bisection algorithm for iterations to calculate arrowheads on X‑splines. In version 4.17.0 and above the Anderson‑Björck variant of regula falsi is used by default. The simple algorithm is still available as fallback. | |
Output | codi | Integer | Color digits Number of digits after decimal dot for color specifications. |
The default values for the keys above depend on the driver:
Option | pgf | tex | tex.pdf | eps.tex | pdf.tex |
---|---|---|---|---|---|
lw | 1/80 inch | 1/80 inch | 1/80 inch | 1/80 inch | 1/80 inch |
tf | similar | fig | fig | similar | similar |
ts | -1 | -1 | -1 | -1 | -1 |
ste | plain | plain | plain | plain | plain |
bbts | off | off | off | off | off |
dcts | 12 | 12 | |||
smash | on | on | on | on | on |
mbox | off | off | off | off | off |
reset@font | off | off | off | off | off |
xsss | 8 | 8 | 8 | 8 | 8 |
cosp | off | off | off | off | off |
coah | off | off | off | off | off |
xsah | off | off | off | off | off |
cols | off | off | off | off | off |
cofop | on | on | on | on | on |
ahas | 4 | 4 | 4 | 4 | 4 |
ahss | 4 | 4 | 4 | 4 | 4 |
ahms | 4 | 4 | 4 | 4 | 4 |
ahip | 0.04 | 0.04 | 0.04 | 0.04 | 0.04 |
codi | 3 | 3 | 3 | 3 | 3 |
showpage | on | ||||
level | 3 |
0 on success, all other status codes indicate an error.
When producing a full LaTeX file using the tex or tex.pdf driver the following files from the current working directory are used if found:
f2lfonts.tex
Packages for font setup. The contents of the file replaces the default font selection instructions.
f2lother.tex
Other setup instructions. The contents of the file replaces the other setup section.
This program uses DK libraries version 3.
To convert a Fig file x.fig into a PDF+TeX file pair for inclusion in a LaTeX document:
fig2lat -l pdf.tex x.fig
In the LaTeX document write:
\begin{figure}%
{\centering%
\input{x.tex}\caption{My image}\label{fig:my-image}%
}%
\end{figure}
To convert a Fig file x.fig into a EPS+TeX file pair for inclusion in a LaTeX document:
fig2lat -l eps.tex x.fig
In the LaTeX document write:
\begin{figure}%
{\centering%
\input{x.tex}\caption{My image}\label{fig:my-image}%
}%
\end{figure}
To convert a Fig file x.fig into a PGF file for inclusion in a LaTeX document:
fig2lat -l pgf x.fig
In the LaTeX document write:
\begin{figure}%
{\centering%
\input{x.pgf}\caption{My image}\label{fig:my-image}%
}%
\end{figure}
To create a PDF file from a Fig file x.fig:
fig2lat -l tex.pdf x.fig
pdflatex -interaction=nonstopmode x
To create an EPS file from a Fig file x.fig:
fig2lat -l tex.pdf x.fig
pdflatex -interaction=nonstopmode x
pdftops -eps -paper match x.pdf x.eps
Note: The final command uses the pdftops program from poppler/xpdf, not pdf2ps from Ghostscript.
To create an SVG file from a Fig file x.fig:
fig2lat -l tex.pdf x.fig
pdflatex -interaction=nonstopmode x
pdf2svg x.pdf x.svg
Find more information about the pdf2svg program used in the final stop on http://www.cityinthesky.co.uk/opensource/pdf2svg. Sources are available in a GIT repository. For windows binaries there is another GIT repository.
The Wiki of the Graphics conversion hints project shows procedures how to convert Fig files to various file types.
A bounding box rectangle is a box (object type 2, subtype 2) which is only used to calculate the bounding box of the image. It is not drawn to output files.
If no source type was specified when starting fig2lat the bounding box rectangle is also used to recognize the source file type.
Depending on your drawing program you should set the following attributes on a bounding box rectangle:
Property | Xfig | jFig | WinFIG |
---|---|---|---|
Layer | 999 | 999 | 999 |
Line width | 0 | 0 | 0 |
Pen color | Default (-1) | White (7) | White (7) |
Fill style | None (-1) | None (-1) | None (-1) |
If a background rectangle was found and the source type is not yet known the pen color is used to separate files created by XFig from files created by jFig.
Files created by WinFIG are recognized by the METADATA lines in the file.
Fig2lat uses the correct formula q=-0.5*s from /BS1995/, fig2dev uses q=-s. /BS1995/ requires 0 <= q <= 0.5 to avoid unwanted oscillations.
Near the top of this page there is a Interpolated splines example showing the different outputs for an X-spline example from /BS1995/.
There you can see the difference, especially the stronger curvature between points 4,5 and 6,7 and an unwanted oscillation between points 3 and 4.
If you insist on using fig2dev behaviour, add
-o cosp=true
to the fig2lat command (compatible splines).
Create or modify a dk3pref.conf file either in the /etc/dk3app-site directory to set the default for all users or in the ${HOME}/.dk3app directory to set the default just for the current user.
Add a text section:
[application=fig2lat]
/print/ps/level=2
or
[application=*]
/print/ps/level=2
\documentclass[12]{article}
% begin font setup
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
\usepackage{courier}
% end font setup
% begin other packages
\usepackage{textcomp}
\usepackage[intlimits]{amsmath}
% end other packages
\usepackage{graphicx}
\usepackage{color}
\setlength{\paperwidth}{widthbp}
\setlength{\paperheight}{heightbp}
\pagestyle{empty}
\setlength{\voffset}{-1in}
\setlength{\topmargin}{0bp}
\setlength{\headheight}{0bp}
\setlength{\headsep}{0bp}
\setlength{\topskip}{0bp}
\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{0bp}
\setlength{\evensidemargin}{0bp}
\setlength{\marginparwidth}{0bp}
\setlength{\marginparsep}{0bp}
\setlength{\textwidth}{\paperwidth}
\setlength{\textheight}{\paperheight}
\setlength{\parskip}{0bp}
\setlength{\parindent}{0bp}
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
\begin{document}%
\begin{picture}(0,0)
\includegraphics{image.pdf}
\end{picture}%
\setlength{\unitlength}{1bp}%
\newfont{\FigToLatFontA}{ptmr at 12pt}%
\begin{picture}(163,96)
text output instructions
\end{picture}%
\end{document}
Font size in the \documentclass instruction
Use the dcts option.
Font setup
Modify the f2lfonts.tex file.
Other packages
Modify the f2lother.tex file.
See the [gxhints:wiki:Home] page. Conversion from fig to eps, pdf, svg, png, jpeg, ico, and xpm is shown here.
/BS1995/ | Carole Blanc, Christophe Schlick: X-Splines: A Spline Model Designed for the End-User Proceedings of the SIGGRAPH 1995 |
/Ta2007/ | Till Tantau TikZ & PGF manual CTAN://graphics/pgf/base/doc/pgfmanual.pdf |
/Tsch1960/ | Jan Tschichold Erfreuliche Drucksachen durch gute Typographie MaroVerlag Augsburg ISBN 3-87512-413-8 |
← Previous | ↑ Home | ↑ Programs | → Next |
Wiki: fig2lat
gxhints - Graphics conversion hints: Wiki: Home