Sound and Fury

Signifying nothing

The LaTeX figure environment

with one comment

Instead of doing any proper work, I’ve been adding pictures to my dissertation. It’s a fiddly process. First, I find a Creative Commons or other free license picture (normally on wikimedia commons) in SVG format. Then I open it up in inkscape, and save as EPS. then I save another copy ar PDF. This is because latex and pdflatex like different picture formats. So, in the same folder as my mainfile.tex, I have npc.eps and npc.pdf So once I’ve done that I make my figure environment where I want the picture to appear. The environment looks like this:

\begin{figure}
\centering
\includegraphics[width=2in]{npc}
\caption{The nine point circle for a certain scalene triangle}
\label{fig:npc}
\end{figure}

If I latex-ify the document it looks for the EPS file. If I do pdflatex then it looks for the PDF file. I have discovered, through much experimentation and gnashing of teeth, that the order in which the things appear makes a great deal of difference. If the \caption is above the \includegraphics the caption appears above the figure. If below, the caption is below. Fairly straightforward. The \label has to be below the \includegraphics and \caption commands. If you put it anywhere else \ref{fig:npc} will reference the section or subsection containing the figure environment. The “fig:” thing is just a convention, it serves no functional role.

Was all this faffing about really worth it? Probably not, but it sure beats doing proper work!

Advertisements

Written by Seamus

August 21, 2008 at 11:51 am

Posted in LaTeX

Tagged with

One Response

Subscribe to comments with RSS.

  1. […] plug: another one of the hits for “LaTeX fig­ure envi­ron­ment is my own on-again-off-again blog, carp­ing on about the […]


Leave a Reply

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

%d bloggers like this: