Note: the above is true for Visio 4.0; feedback I get from correspondants
unfortunately seems to indicate that things haven't improved with more recent
versions.
With the later versions of Visio (I use Visio Professional 2002 now), it seems that setting the "Include AI format" checkbox (include Adobe Illustrator code) allows direct saving of .eps files that LyX and LaTeX can read. The files have errors (e.g. "The number of Begin and End comments do not match"), but (at least) that error doesn't appear to be fatal. You may need the latest .eps viewing tools, e.g. gsview32.exe version 4.0 or later. Therefore, if you have a later version, use the below as a last resort only. |
The best workaround that I have found is to print to a suitable printer
driver that has an EPS option, and then hack the bounding box manually.
The trick is to find the right postscript printer driver; many don't have
an EPS option, and EPS is NOT just Postscript with a special header. (See
the FAQs from sites like Internet
resources for Postscript & Ghostscript" for details). A good driver
is available from Adobe. It is most unlikely
that typical drivers (like HP laserjet drivers) will work! The Adobe
download page (at present!) is http://www.adobe.com/support/downloads/main.html;
look for Printer Drivers then Macintosh or Windows
as appropriate, and look for a driver with a name like Adobe Universal
PostScript Windows Driver Installer 1.0.6 (for Windows 95, 98, Me, NT 4.0,
and 2000) - English. As of June 2002, the direct link (for Windows) is
this,
but it can change very quickly.
When the printer is set up, make sure that the options are set correctly; in particular, use Settings/Printers and right click on the new printer. (These instructions are for Windows NT; it may differ for Windows 95/98/etc). Under "Document Defaults" choose the "Advanced" tab, and under "Document Options" expand "Postscript Options". Under "Postscript Output Option" select "Encapsulated Postscript (EPS)". In may as well also change some Properties (on the popup menu), "Ports" tab, and choose the "FILE:" port. In fact, this is just in case you forget to check the "print to file" option when printing; this allows you to choose the path more sensibly. Save the file as ".ps", since you still have to modify the bounding box (see below) to make a true .eps file.
When this is all set up, then you can output anything (including but not limited to Visio drawings) to an EPS file by printing to that special "printer". (Just ignore the "Save as" option in Visio).
To use the EPS file as saved above with Latex, you still need to change the bounding box of the EPS file (Visio always seems to print the whole page, so the bounding box is set to whatever page you set up in Visio). That means that diagrams will wipe out all the other text on the LaTeX page. This can be done most readily by using gsview for Windows. (Note: you also need ghostscript, fonts, and another file; read the notes on those pages carefully). It has the facility for calculating a tight bounding box and saving the file with the new bounding box (under File PS->EPS). (The file still has to be EPS suitable, so it is still important to use the right printer driver to generate good EPS).
You can also do this manually; you will find it easier if you put your diagram in the bottom left corner of the page, about a centimeter from the edges. Then just edit the EPS file; about the fifth line should read something like
%%BoundingBox: 17 22 578 820These dimensions are in points (approx. 1/72"), and represent the x and y co-ordinates of the bottom left and top right corners of the drawing. I measure with a ruler, add 10% or so, and put in the appropriate figures in the third and fourth numbers, then use Ghostscript to check that I have not cut off too much or too little. For example, suppose the diagram is 75mm wide by 100mm high; that's about 3" x 4". You could start with 225 and 300 for the second and third numbers. Leave the first two numbers alone.
I should add that Visio is otherewise a very good product, and I really hope that the EPS exporting is fixed in the next version (version 5 still has the problem).
Last modified 06 Jun 2002: Updated Adobe Universal postscript
driver links, gsview links