man fig2sty (Commandes) - LaTeX Layout Generator


fig2sty - LaTeX Layout Generator


  fig2sty [-debug] [-baselineskip=..] [-fontsize=..]
          [-reference=(grid|upper|lower)] [-offset=..]
          [-figversion=..] [-nopipe] [-fig2dev=...] input-file

Show base lines in background picture Default values. May be overriden by tags. XFig format version which will be fed to CWfig2dev to generate background picture If your version of CWfig2dev does not accept piped input use this switch If you have installed several versions of CWfig2dev you can specify which version to use


fig2sty allows you to generate fancy layouts with LaTeX. The basic idea is to draw layout definitions interactively with XFig and transform this definition to a LaTeX style file. You can then use LaTeX to typeset your text into arbitrarily shaped polygons (frames) within the layout.

You can even add any graphical elements in the layout definition which will appear in the LaTeX output as a background picture.

How to draw the layout definition.

Any closed polygon or box may be a frame. But it must not have an area fill such that your coloured background boxes will not interfere with your frames. Tags are associated to each frame. A tag is simply a text CWkey=value marked as special and positioned within the bounding box of the respective frame. If there are any ambiguities, simply put your frame and its tags into a compound.

Several key words are interpreted by CWfig2sty: This tag is compulsory; a frame will not be detected as such if you don't provide a type tag. You can have several type tags in your layout, but you may as well have several frames associated with the same type tag. Text will then flow between all the frames of common type. The type tag must neither contain numerals nor any special characters, just plain alpha characters. If you care about the ordering of the text flow you can use the following tag: Text will flow between frames of common type in increasing size of CWn Text will be typeset in a fixed line grid. Baselineskip provides the distance between neighbouring lines. All frames of a certain type share the same baselineskip. If you provide several of them, the tag within the frame of lowest CWn will be used. If you have rectangular frames of equal widths only you may set CWbaselineskip=any. Text will then by set in ordinary horizontal mode. For any other kind of frame or multiple rectangulars with differing width CWbaselineskip=any is forbidden. Lines of all frames will be aligned if you assign the value CWgrid to this tag. Other possibilities are CWupper(CWlower) which will align to the upper(lower) boundary of your frame. Each frame has its private reference. You can shift your base lines by an arbitrary amount by providing the CWoffset tag. Each frame has its private offset. Used only as minimal distance from top baseline to the upper boundary of the frame. LaTeX code to be prepended to the text LaTeX code to be appended to the text

Default values to the tags are CWbaselineskip=12, CWreference=grid, CWoffset=0, but you can overwrite these defaults by the command line options. All dimensions are given in TeX pt.

How the baselines are chosen

First of all, you can't have lines split horizontally. Lines will always go from the leftmost intersection of the base line with the frame to the rightmost one. There is not really any technical reason for this (except for laziness, one of the virtues...). If you find this to be a major restriction, please let me know.

The baselines are chosen such that the distance to the reference point is a multiple of CWbaselineskip. CWfig2sty will ensure that no textual element of size CWfontsize will overlap the given frame. This is indeed the only use of the CWfontsize tag. CWfontsize=baselineskip is usually a good choice except when using small letters at wide vertical spacing. The choice of the reference point is based on the CWreference tag. The value CWgrid means that a global reference point (the upper-left corner of the layout) will be used. This allows text in different frames to be aligned. CWreference=upper means that text will touch the upper boundary of your frame. The analogous functionality is provided by the CWlower value.

How to use in your LaTeX document.

If you have two frames of type 'CWabstract' and 'CWtext' within the layout CWfancylayout you type:

\documentclass{article} \usepackage{figtosty} \usepackage{fancylayout}

        blah blah

        blah blah



You will need in your Perl Library path , figtosty.sty in your LaTeX search path and fig2sty in your binary search path.


list environments do not respect frame boundaries

some mysterious bug with splines

doesn't work with \sloppy


M. Rohner,


Thanks to Tobias Oetiker for his helpful comments