Creating multiple PDF or EPS figures for overlaying

fig2mpdf is an universal tool for creating figures to include either in PDF or in PostScript documents. Regardless the output type which is selectable by just one switch, the resulting document has exactly the size of the figure designed by xfig. In contrast to other tools fig2mpdf uses pdflatex in PDF mode for typesetting special texts of the figure so that the resulting documents never looks like the one shown in figure 1. But the most important feature of this tool is the capability to create multiple figures of one Fig file which might be overlayed in a presentation e.g created by the powerful beamer package.

Main features

   
  Fig. 1: PDF results using fig2ps --pdf with fontenc:T1 on the left side and using fig2mpdf on the right side.    

Overlay techniques for presentations with xfig

As mentioned in the projects overview page in these PowerPoint days it's really common to do beamer presentations instead of using the good old foil hardware. In contrast to PowerPoint presentations you can run PDF presentations, probably created with the beamer package and pdflatex, on nearly every computer of the world.

With beamer presentations you can insert effects for example to lead the attention to a specific part of an figure e.g. if you are presenting a system in your figure and you are just talking about a part of this system. The pdflatex-beamer user has to produce a set of figures who are overlayed step by step by using the \multiinclude macro. Figure 2 shows a simple sample presentation.

   
  Fig. 2: Sample: Overlay technique created with LaTeX beamer package and fig2mpdf    

xfig is one powerful tool for creating figures. You can bind images of all types into your figures and there are all export filters you may ever need. But it's a hard work to build all necessary figure documents separately because they all have to have the same size and all items who occur in more than one document have to be placed identically to avoid any unwanted movements of these items. Furthermore it's nearly a mission impossible to maintain all these figures e.g. if you want to change a position of one element which is present in more than one figure file.

fig2mpdf can do this work for you! The overlay figures are split by the depths of their elements. Elements of consecutively used depths can be put into an own overlay document i.e. if there is a gap of at least one in the used depths this gap splits the figure (you can specify a maximum gap width which does not split the figure). Since xfig 3.2.4 you have the possibility to hide unwanted layers (depths) while editing the fig file. With this feature the production of overlay figures is really more comfortable. fig2mpdf examines the Fig file and gets a list of consecutive depths, I call ranges. If you want to define ranges by hand, you can do so. These ranges are atoms for the following operations.

There are two main types of how the contents of the document files are assembled. Figure 3 depicts these two types as an example of a figure with several ranges. Examine the Fig file and you will find the following depths used: 53, 52, 50, 49, 46, 45, 44, 41, 40, 38, 37. This usage result into the five ranges: (1) 53, 52   (2) 50, 49   (3) 46, 45, 44   (4) 41, 40 and (5) 38, 37.
The upper row shows the five resulting documents in default mode. Here each document contains the stuff of the concerning range. The presentation starts with the leftmost figure, the other documents are to put successively on top. The second row show the pyramid mode of fig2mpdf where the documents additionally contains the stuff of the ranges of higher depth. Here each document can stay alone.

   
  Fig. 3: Example: The two modes of fig2mpdf. The upper row shows the figures generated in default mode where each figure contains all elements of the concerning range (the number(s) below each subimage represents the included ranges). In pyramid mode the figures are containing the elements of the higher depths ranges too (here: the contents left neighbor figure). Click the image for getting the xfig source of that figure.    

If the overlayed figure has a transparent background as shown in figure 3 you can add some new elements in the next displayed range. But if you want to change an already displayed part of the figure (like the red arrows in the example) you have to put a frameless opaque square or whatsoever onto the part and place some new elements on top of it if desired.

For further information about the capabilities of the tool I refer to the man page of fig2mpdf which is part of the package.

Using LaTeX for typesetting the figure texts

There are many reasons for using LaTeX for typesetting your articles or even books --- compatibility, reusability and complex formulas to mention just three of them. Once the decision is taken to use LaTeX you might or probably should want to have the same typesetting in your figures. This is for having exactly the same symbols in the text an the figures or you might want to have some formulas in your figures.

To achieve this you have to set the special flag of these texts LaTeX should typeset (normally all texts but keep in mind that this flag isn't set by default) and select the right output languages of fig2dev. Figure 4 shows how the procedure works. The first driver (pstex) creates an EPS file containing everything which can be done by the fig2dev itself e.g. rectangles, circles, etc. The second export with pstex_t creates a body of a LaTeX document which includes the just mentioned eps graphics file. This eps document is included in that way that all LaTeX texts are put on top of it. Because of this isn't always useful, i.e. if you have overlayed texts in the figure, I have created the two drivers pstex_p and pdftex_p who are used by fig2mpdf.

 
 
  Fig. 4: Normal procedure using fig2dev languages pstex and pstex_t to let latex set all texts in the figure. On the left you can see the two layers who result into the image on the right side, where the text layer was put on top of the remaining stuff.    

Examples

 
Just a figure Overlay sample with beamer package. Click for the LaTeX document