# FAQ

How can I combine WinFIG and LaTeX.

There are several ways. The most recommended are either using PSTeX or PSTricks export.

How can I include LaTeX formula?

If you create text objects in WinFIG for LaTeX formula you have to take care of the “LaTeX” flag. That is a button in the tool bar visible on the right, when the text tool is activated.

If the LaTeX flag is not set, some characters are escaped e.g. "$just_a_test" is exported as "\$ just\_a\_test", which is suitable for LaTeX text to output the special characters correctly, but if you want to enter a formula, the $and some other characters must not be escaped. So, set the LaTeX flag for a formula. The LaTeX flag prevents characters like _ or$ from being escaped. You can then enter formula the same way as in a LaTeX document e.g. $(x_i)^2$ will create a formula with a subscript i and a superscript 2 when you create the dvi-file from the LaTeX file.

How can I create a LaTeX file with PSTeX or PDFTeX?

You can mix PostScript an LaTeX with the PSTeX or PDFTeX export. The following explains the necessary steps for PSTeX, but it applies similarly to PDFTeX.

The PSTex export creates two files out of one FIG file, one with the suffix pstex_t and one with the suffix ps (or pdftex_t and pdf for PDFTeX export).

Example: If you have a file foo.fig, you get the files foo.pstex_t and foo.ps where the PS file contains PostScript code for the graphics part while the pstex_t file contains LaTeX code for the text objects (those with the “LaTeX” flag set). The pstex_t file also contains an include directive for the PostScript file like that:

\begin{picture}(0,0)%
\includegraphics{foo.ps}%
\end{picture}%

You still have to reference the pstex_t file within your LaTeX document. A minimal LaTeX file could like like this:

\documentclass[11pt]{article}
\usepackage{color}
\usepackage{graphicx}
\begin{document}

\input{foo.pstex_t}

\end{document}

Then use a LaTeX processor to convert that file to DVI (or pdflatex for PDF). The processor will also take care of the included PostScript (or PDF) graphics. So, the document structure is like that: maindocument.tex references foo.pstex_t references foo.eps.

WinFIG can create the main document for you if you activate the check mark at “Export both parts and create a PDF document via pdftex” in the PDFTeX export. This is useful for quickly checking the result or when you don’t intend to include the drawing in an existing main document.

I was unable to export any files from WinFIG.

Check if you dragged the WinFIG.exe on your desktop. In that case WinFIG is not anymore in the same folder like fig2dev.exe, which is called when exporting a file. If that is the case, put WinFIG.exe back in its folder and create a shortcut instead. There is a help topic in the Windows help named “Put a shortcut on the desktop”.

My exported files are empty and have 0 size.

Some formats require a GhostScript installation (PDF and all bitmap formats except GIF). You get GhostScript here. GIF requires ppmquant, which you can get as part of the netpbm package.

I tried to install WinFIG onto one of my machines, and put in the registration through “help” button and was given an error saying — Licence key confirmed, but the key could not be written to

This probably occurs on Windows 7 or 8 installations. WinFIG could not write the keyfile due to lack of permissions. You have to run WinFIG with administrator privileges.

• Right-click the program icon or shortcut, and then click “Run as administrator”.
• Or press and hold Ctrl+Shift while opening the program.

When exporting via fig2dev I get an error dialog reporting “error code 2”

fig2dev was not found. Check the previous item. If that didn’t help, add the WinFIG folder to the path environment variable If that does not work or if you do not get an error dialog, try calling fig2dev with the same parameters from the command prompt e.g. fig2dev -L ps infile.fig outfile.ps

Drawings that were created with Xfig using metric units (cm) are slightly smaller in WinFIG.

FIG drawings store coordinates based on 1200 dpi. The input device (the screen) is naturally using a smaller resolution i.e. 80 dpi. Therefore WinFIG/Xfig must convert mouse clicks from the display resolution to the higher file resolution. Xfig uses different display resolutions depending on the unit that is being used. If the figure is using imperial (Inches), the input device is assumed to have fixed 80 dpi.

If the figure is using metric units, the input device is assumed to have 76.2 dpi, but the translation into 1200 dpi is the same for both.

Example: If you draw a 4cm long line using Inches you get p1(0, 0) p2(1890, 0):

4cm == 1.575in == 1890pixels at 1200 dpi

When you draw the same line using metric unit, the line extends from p1(0, 0) to p2(1800, 0), which is not correct. The second coordinate is by the factor 80/76,2 smaller: 1890 / (80/76,2) = 1800. I think this is a bug.

When Xfig displays or exports metric figures it scales up by the factor 80/76.2 = 1.0499 to get correct coordinates.

WinFIG gets the display resolution dynamically from the graphics driver and uses that resolution for both units i.e. 80 dpi or 96 dpi. Therefore it produces correct coordinates for both units. My Windows version of fig2dev does not multiply metric coordinates with 1.0499. If you want to use it for converting Xfig created metric drawings you have to use the option -m 1.0499.

Exchanging files between Xfig and WinFIG:

• No problem with drawings using imperial units
• Xfig created metric drawings must be scaled up by 1.0499 to get correct size in WinFIG. It is easier to save from Xfig using imperial units.
• If saving from WinFIG using Metric units you may edit the FIG file and replace Metric by Imperial (int the 4th line) before loading the file into Xfig. This will prevent Xfig from scaling the figure by 80/76,2

Using fig2dev on Windows to convert figures:

• No problem with drawings using imperial units
• Xfig created metric drawings must be scaled up using “-m 1.0499”
• No problem with WinFIG created metric drawings

You can avoid all that trouble by using imperial units only.

I cannot export figures containing 24 bit PNG images to PostScript.

fig2dev uses the CImage class for reading PNG and GIF files. That class has a bug when reading 24 bit PNG images. It converts to 8 bit, but does not provide the color map, therefore those images cannot be read. Use JPEG instead.

fig2dev does not create GIF files

fig2dev creates by first creating PPM and converting this to GIF using a tool called ppmtogif. I did not check whether ppmtogif is available for Windows. If so, you have to install it, if not, try creating PNG. It is a much better format anyway.

I’m exporting to EPS using the option “Relative to screen (upper left corner)” with values in (X0, Y0) and (Wx, Wy), but it produces strange results.

I’m not sure that fig2dev implements this feature correctly. It seems X0 refers to the upper left edge of the screen, but Y0 refers to the upper bound of the figure. Try using thw “Relative to figure (lower left corner)” option.

How can I include EPS files in LaTeX?

There are several ways to do this, e.g. use the graphicx package. See http://www.math.nwu.edu/comp-help/including_graphics.html

I cannot associate .fig files with WinFIG.exe.

Please check if you have Symantec Antivirus software installed. There is a worm named winfig.exe and therefore Symantec may prevent creating a file association. Rename to WinFIG17.exe (or some other name),

How can I edit text objects?

You can edit text by selecting the text object, so that the markers turn red and then clicking on the button “Edit object attributes” in the upper toolbar. That will open the text enter dialog with the text you selected.

How can I change object attributes like line width, color etc?

How can I change object attributes like line width, color etc? You first select the “Edit” tool on the left toolbar, then click on the object you want to modify. Upon that a context toolbar opens on the right side. You can change all attributes there.

I would like to be able to include greek characters in my figures to denote angles for example.

You can either use the Symbol font or you use LaTeX syntax and export your figure using the pstex export.

The built-in printing function delivers odd results.

WinFIG renders graphics for a fast display on the screen. That does not give you the same quality as rendering for a printer device. I really encourage exporting to PostScript and printing the resulting PS file via GhostScript. That will give you a much better quality.

Is there more documentation?

There is only the manual of fig2dev and this faq. You could try looking at the Xfig documentation under www.xfig.org. Both programs are still similiar enough for that docs to be useful even for WinFIG.

How do I move objects?

You select the “Move” tool from the toolbar, click an object or select many at once by catching them in a rectangle. Then you click on one of the selected object(s) and drag it around while holding the mouse button pressed. Release the button at the desired position. You can also use the arrow keys to move a selected object.

How can I rotate an object using a specific anchor.

Hold the shift key down and click at where you want the rotation center to be.

My figure does not show dashed lines.

This happens sometimes to figures, which were created in Xfig. The problem is that the figure is not correct. The value for the dash length is set to 0.0000. This means, there are no gaps between dashes. The solution is to either correct the dash length in Xfig or edit the FIG file manually. Replace 0.0000 by some other value that you like. The default is 4.

5 1 1 1 18 0 100 0 0 0.000 0 1 0 0 1329.000 771.400 685 1472 1373 1722 1973 1472
5 1 1 1 18 0 100 0 0 4.000 0 1 0 0 1329.000 771.400 685 1472 1373 1722 1973 1472

The number corresponds to the dash len/dot gap value that is editable as an object attribute.

I am having difficulty with the Move function. I cannot find it or it is not working anymore.

Since version 1.6 the “move” functionality is different from Xfig. Use the “Select” tool (arrow in the upper left) to drag&drop objects like in many other applications. It is possible to select multiple objects by catching them in a rectangle or by holding the shift key. This is much more convenient than before. Ctrl-a selects all objects.

WinFIG shows a Windows error message at startup (DLL is missing, configuration error or similar).

WinFIG requires some DLLs, which contain the MFC (Microsoft Foundation Classes). Usually these are already on your computer, but possibly of an outdated version. Download and install a newer version, which you can get from Microsoft here.

I downloaded and installed GhostScript, but WinFIG says I haven’t got GhostScript.

On Windows WinFIG consults the registry to find the GhostScript installation. Sometimes that doesn’t work, for instance when obsolete entries exist in the registry, which happens when GhostScript was not uninstalled properly before installing a newer version. There can also be other circumstances that prevent the automatic detection. You can still manually configure the path to the GhostScript binary in the “Preferences” dialog (Other tab). Enter the full path to gswin32c.exe or gswin64c.exe.