Producing Graphs in LATEX using Arc

Sanford Weisberg, Work supported by National Science Foundation DUE 93-54678.

June 26, 2001, slightly revised July 16, 2004

This document describes how to save graphs created by Arc as LATEX files. These files can be edited, incorporated into other LATEX documents, compiled by LATEX as .dvi files, and the .dvi files can be compiled by dvips as either PostScript or Encapsulated PostScript files.

What you need

You will need the following resources:
The lisp file
Get the file getpic.lsp for Windows or Linux/Unix, or for Macintosh. This is a file of lisp code that needs to be loaded into Xlisp-Stat after loading Arc. This file should be put in the Extras directory, and it will then be loaded automatically whenever you start Arc.
The LATEX style file
Get the file arc.sty, which is a LATEX style sheet that you need to put in your TeX search path. With Miktex on Windows, the usual place to put this style file, and any others that you need to add, is C:/Local TeXMF/tex/latex. You may then need to run the program ``MiKTeX options'' and from the ``General'' tab refresh the file name database.
Other style sheets
You will need the LATEX ``package'' eepic that you may not have on your system. If you are using MikTex on a Windows machine, from the start menu, select Programs -> MikTeX -> MikTeX options, and then select the ``Packages'' tab. At the top of the Window, if nothing is shown in the ``Download site'' area, press the ``Change'' button, and select a site near you from the list given. After a while, a list of packages will appear as a list in the left-part of the window. Scroll down to ``Graphics," and click on the minus-sign to get more packages. Click the mouse in the checkbox for ``eepic'' and then ``Apply.'' The package will be correctly downloaded. You can also download the package manually by going to www.ctan.org. From the welcome page, select the link Search, and then on the search page, type the name of the package you need. Instructions for installation are given on the site.

Alternatively, get the files you need in a zip file here. Put the unzipped files in your local tex directory, possibly C:/Local TeXMF/tex/latex.

If you are using the workstations at the University of Minnesota's School of Statistics, all the needed style sheets are present on the system and you do not need to retrieve them.

Saving a Plot

Be sure that getpic.lsp is in your Extras directory. Start Arc. Every plot's menu will have two new menu items. ``LATEX Settings" produces a dialog to select features of the plot, like its size, shape and font size. The second menu item ``Save LATEX file..."; allows saving the file; use a name ending in .tex, such as graph1.tex.

The Stand-alone Version

Unless you change the setting, the stand-alone file you create can be typeset with any version of LATEX 2e; it has not been tested with version 2.09. For example, OzTeX on the Macintosh can be used, or miktex on Windows. This will produce a dvi file. All the style sheets described above must be in the tex search path for this to work. The final task is to create the Encapsulated PostScript file. Suppose that your file is called graph1.tex, and after running LATEX, you have a file called graph1.dvi.

With Linux/Unix, or from a DOS command window, simply type

dvips -o graph1.eps -E graph1
This will produce a file called graph1.eps that can be used as any other such file. The same command is used with miktex on Windows by typing the above command into a DOS window in the same directory as the file graph1.dvi. With OzTex on a Macintosh, Select DVIPS from the Tools menu, select the file graph1.dvi, and in the next dialog type ``-E" in the text area.

The Non-stand-alone Version

The non-stand-alone version differs from the stand alone version only by the omission of a few lines at the beginning and end of the file. The omitted lines at the beginning are:

\documentclass{article}
\usepackage{arc} 
\begin{document}
\pagestyle{empty}
and at the end of the file, the missing line is
\end{document}
These lines actually appear in the file, but they have a comment character ``%" as the first character on each line. Thus, you can convert a non-stand-alone file to stand-alone by deleting a few comment characters.

If graph1.tex is not a stand-alone file, it can be incorporated into a document using an \input statement. For example, your main document might look something like this:

\documentclass{article}
\usepackage{arc} 
\begin{document}
This is some text.  It refers to Figure~\ref{graph1}, which is 
the first figure in the paper.
\begin{figure}
   \caption{This is the caption for the figure.}
   \input{graph1}
\end{figure}
\end{document}

Editing Files

The figure files created in this way are fairly easy to read and to edit, as the file includes many comments. Most of the statements in the file are discussed in Goossens, Mittenbach and Samarin (1994), The LATEX Companion, Addison-Wesley, particularly Chapter 10. In particular, it is easy to edit labels, change fonts and colors, and not too hard to add additional annotation to the plot.

Problems

Some of these LATEX files can be very large (for example, a scatterplot matrix with 5 variables and 200 points is really 20 scatterplots each with 200 points), and your version of LATEX may not have enough memory to process the file. The only option is to increase the size of your LATEX but this is not particularly easy to do, and will in any case require the assistance of a LATEX wizard. Miktex on Windows and OzTeX on Macintosh seem better able to work with large files without any modification than do standard implementations of LATEX on Linux/Unix.



S Weisberg
2004-07-16