Inserting graphics in to your LaTeX document

Here are some quick instructions for inserting graphics in to your LaTeX document.

First, you need to make sure that you have

\usepackage{graphicx}

as part of the list of packages being loaded.

Second, place the graphic file (preferable saved in some nice format, like pdf) in the same folder as your tex file.

Next, a bit of philosophy: LaTeX will make some executive decisions about where to place the graphic. As a beginner, do not try to over-ride LaTeX’s omniscient protocols. I strongly encourage you to write your prose in such a way that it does not matter where the graphic appears. This is actually easy to do, with a bit of thought. For example, rather than writing “looking at the graphic here:” you can write “looking at the graphic in Figure 3.”

With that philosophy in mind, choose a location in your tex code close to where you want to graphic to be. Then insert the following:

\begin{figure}[h]
\centering
\includegraphics[width=3in]{GrapicFileName}
\caption{Write a nice caption here.}
\label{GraphicLabel}
\end{figure}

Here you should, of course, replace “GraphicFileName” with the graphic file name, and give it an appropriate label. The label is important, because then you can write “looking at the graphic in Figure \ref{GraphicLabel}” in order to reference your graphic.

That’s it! You now can put pretty pictures in your LaTeX documents!

Advertisements
This entry was posted in LaTeX. Bookmark the permalink.

Leave a comment here

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s