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.


My exported PostScript or PDF files don’t contain LaTeX formatted texts.

The PS and PDF export do not apply LaTeX processing. That’s why the LaTeX texts appear with raw LaTeX syntax. To obtain PS or PDF files with LaTeX formatting you need to use the pstex or pdftex export, import the resulting pstex_t (or pdftex_t) file into a main LaTeX document and run the main document through latex (and dvips) or pdflatex. WinFIG contains a convenience function that creates the main document on the fly and executes all necessary steps.

For PostScript:Choose PostScript export and set the checkbox “Use LaTeX for rendering LaTeX formatted texts”.

For EPS:Choose EPS export and set the checkbox “Use LaTeX for rendering LaTeX formatted texts”.

For PDF:Choose PDF export and set the checkbox “Use LaTeX for rendering LaTeX formatted texts”. If you want the output to be cropped to its content, see the question below.

You can edit the temporary main document by clicking on the button “Edit TeX envelope”.


How can I export to PDF, but crop the output to the content?

Edit the TeX envelope and set the “standalone” document class. Also remove the declaration of the gemoetry package. This is a working example:

\documentclass[tightpage]{standalone}
\usepackage{color}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{mathrsfs}
\thispagestyle{empty}

\begin{document}

\input{"INPUTTEXFILETOKEN"}

\end{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


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…” in the toolbar on the right side. 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.


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?

Use the “Select” tool (arrow in the upper left) to drag&drop objects like in many other applications. Click an object and drag it around while holding the mouse button pressed. Release the button at the desired position. 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.


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.


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.


How can I make WinFIGs user interface bigger on a 4k display?

You can scale the user interface by setting a scale factor in an environment variable. Create a text file with a name for instance StartWinFIG.bat and enter the following lines:

set QT_SCALE_FACTOR=2
cd c:\Program Files (x86)\WinFIG\
WinFIG.exe

Start WinFIG through running that batch file.

You find more information here: Qt Documentation: High DPI Displays