Include Graphs 

Synopsis 

  • Convert to eps format
  • Use \includegraphics command in graphicx package to include it to latex:

    \usepackage[dvips]{graphicx} % for graphic handling
    ...
    \includegraphics{file.eps}

Explain 

Encapsulated PostScript (eps) is the easiest graphics format to import into LATEX. For example, eps files are inserted by specifying

\includegraphics{file.eps}

Optionally, the graphic can be scaled to a specified height or width

\includegraphics[height=4cm]{file.eps}
\includegraphics[width=3in]{file.eps}

Additionally, the angle option rotates the included graphic…

Horizontal Centering 

The placement of the graphic is controlled by the current text justification. To center the graphic, put it inside a center environment

\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}

If the \includegraphics command is inside an environment (such as minipage or figure), the \centering declaration centers the remaining output of the environment. For example

\begin{figure}
\centering
\includegraphics[width=2in]{graphic.eps}
\end{figure}

is similar to

\begin{figure}
\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}
\end{figure}

double vertical space above and below the figure due to the space produced by the figure environment and by the center environment. If extra vertical space is desired, the commands in Section 18.1 should be used.

Using Subdirectories 

When importing a large number of graphics files, it may be desirable to store the graphics files in a subdirectory. For example, when the subdirectory is named sub, one may be tempted to then include the file file.eps with the following command \includegraphics{sub/file.eps} While this syntax works for most Unix and dos T E X distributions, there are problems with such usage Inefficiency.

The best method is to modify the T E X search path. Another method is to specify sub/ in a \graphicspath command. However, this is much less efficient than modifying the T E X search path. Both of these options causing \includegraphics to automatically search the graphics subdirectory, allowing

\includegraphics{sub/file.eps}

to be replaced with

\includegraphics{file.eps}

TEX Search Path 

For web2c/teTeX Unix distributions, the T E X search path can be modified by setting the TEXINPUTS environment variable.

When using csh shells, setenv TEXINPUTS /dir1:/dir2:

Putting // after a directory causes all of its subdirectories to be searched. For example, setenv TEXINPUTS /dir1//:/dir2: causes all the subdirectories (and sub-subdirectories) of /dir1 to be searched. Be careful in using // as it may slow down the searching if the directory contains many files.

These examples also work for sh shells, although the syntax should be changed to TEXINPUTS=''/dir1:/dir2:''; export TEXINPUTS