Example LaTeX and Visio for introductory theoretical computer science
(Back to my home page).
Disclaimer: I am not a LaTeX or a Visio guru. But, the following files might be
helpful if you're getting started with LaTeX and want to see some examples.
On this page is:
Other resources
For some other resources, a
good list of LaTeX resources, a quick list of lots of
symbols in LaTeX and
Essential LaTeX, which has a great section on math stuff, and general
text LaTeXing.
My example files
Files:
-
latexvisio.tgz. All of the below files, tar'd
and gzip'd.
-
demo_latex.tex. The example LaTeX source file.
-
demo_latex.dvi. The example file processed
into DVI format.
-
demo_latex.ps. The example file processed into
(the final) Postscript format.
-
problemY.vsd. An example Visio file.
-
problemY.eps, same as above, exported into
Encapsulated Postscript format.
-
problemZ.vsd. Another example Visio file.
-
problemZ.eps, same as above, exported into
Encapsulated Postscript format.
-
r.bat, and MS-DOS/Windows batch file containing the two
commands to make the LaTeX into Postscript. Could easily be in another
scripting language. Some command line formats of different versions of the
tools have minorly different syntax.
-
algorithmic.sty. The LaTeX algorithmic style file
(which does pseudocode). Some systems may not have this installed already, in
which case you can just put it in the same directory as your LaTeX file (as I
recall).
As usual, LaTeX will give tons of warnings and info, most of which baffle me.
The one thing is that you'll have to run latex twice to make it figure out
references (to figure numbers) correctly.
How to save Visio files for use with LaTeX (Procedure prior to Microsoft Visio
2002)
Visio allows you to save as Enscapsulated PostScript (which will make LaTeX
happy), however its default parameters lead to something that LaTeX doesn't
like. Here's a procedure that's worked for me (on Visio Technical 5.0):
-
Select File/Save As...
-
Save as Encapsulated PostScript (.eps)
-
Create a new "AI/EPS output filter setup profile", or just modify the existing
one.
-
Make it look like this (if you want color, you'll have to fiddle with the
params more...):

(The "Darth Wolfman" bit is an in joke with
Steve Wolfman, from whom I copied this setup).
How to save a Visio file for LaTeX in Microsoft Visio 2002
Amazingly, Visio's exporting to eps has gotten worse since Visio was
incorporated into Microsoft Office. Curses! The resulting EPS looks
amazingly crappy, with circles becomes polygons that have lines in random
directions; I have no idea how this feature seemed to Microsoft to be
functioning correctly.
Fortunately, it is still possible (though a hassle) to export using a
print-to-file strategy. Here's what I did:
-
Install the
Adobe Generic Postscript Driver. Link it to a dummy port that
you don't have a printer on.
-
Once you've installed it, open the printer (from Start/Settings.../Printers and
Faxes), and from the File menu, select Printer Preferences. Click the
Advanced button, and open Document Options, then PostScript Options.
Under PostScript Output Option, select "Encapsulated PostScript (EPS)", like in
this screenshot:
-
Now, in your Visio drawing, select Print... from the File menu. In the
print dialog box, check the "Print to File" option. Then click OK, and
enter a file name (I know, it's annoying that it doesn't supply a
default. Don't worry; if Microsoft's treatment of Visio is anything like
my experience after they bought SourceSafe, in several years from now, Visio
will be about as good as it was before Microsoft bought it.).
-
Now, for more annoyances, because you printed, Visio makes the bounding box in
the EPS file equal to the page size, instead of your drawing size. I
wrote a perl script called TightBoundingBox.pl
that fixes this (it requires the 'gs' command, and I've only tested
GNU ghostscript, which comes with cygwin).
If you saved your eps file as visio.eps, then you'd run (in the cygwin bash
shell) perl TightBoundingBox.pl visio.eps, and then if everything goes
well, visio.eps will be properly clipped, and ready for LaTeX. (Warning:
I've hardly tested the perl script, so (1) don't expect miracles, (2) it'd be a
miracle if it works.)
Bug in Visio: changing fonts in a PostScript file
You can't change fonts or use Greek letters in Visio documents that you
export to Encapsulated PostScript. That is, once you do, Visio will change
everything to its standard font (and epsilons will become e's, sigmas will
become s's, etc). This is a bug in Visio, and one that they apparently don't
assign particularly high priority to. Oh well.
This just in: I'm cautiously optimistic that this will work if you produce the
EPS files using the print-to-file strategy, above.