# Graphics, graphicx, and Texlive2014

I am setting up my install of texlive2014 and working on my first document.

I want to insert a small graphic on a page, and have the following:

\documentclass[a4paper,12pt]{letter}
\usepackage{graphicx}
\begin{document}
\newcommand{\collegename}{TK}

\begin{figure}
\includegraphics[width=10mm]
{/home/steven/doc/app/assets/image/s-stamp.tif}
\centering
\end{figure}


When I run latex I get this error:

ERROR: LaTeX Error: Environment figure undefined.


My first suspicion was that I've made a mistake with my markup. My second suspicion is that maybe Texlive2014 doesn't come with Graphicx installed? I am not sure how to check whether I have it, but trying

tlmgr install graphicx


results in

package graphicx not present in package repository.


I'd appreciate any advice, framed at an introductory level.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarise yourself further with our format. Your figure undefined error is caused by using the letter document class; try article instead. You most likely have graphicx installed, but if not, it is known to tlmgr as graphics, as listed here. (Common packages are often uploaded to CTAN in lots of multiple packages which must be installed together.) – ChrisS Feb 6 '15 at 5:04
• I think the error says that the figure environment is undefined, nothing about graphics. I'd suppose that letter.cls doesn't have a figure environment. Do you need one? You could do \begin{center} ... \end{center} instead. (Two other things: what's with the weirdly placed \centering command? and your example file is missing the \end{document}.) – jon Feb 6 '15 at 5:27
• Thank you! Changing "letter" to "article" fixed the problem. I don't know if I can mark your comment as a "solution," but it worked. I'll also spend some time looking at the starter guide. I am enjoying using LaTeX a lot so far. – Steven Arntson Feb 6 '15 at 5:30
• I don't think you will be able to use tif files. pdflatex can handle jpeg, png and PDF. – Uwe Ziegenhagen Feb 6 '15 at 5:32
• @UweZiegenhagen I did discover that my tif file from my question produced an error---I switched over to a png file to solve that. I'm new to SE ... should I change that in the original question to prevent it being a red herring? – Steven Arntson Feb 6 '15 at 7:45

The error

ERROR: LaTeX Error: Environment figure undefined.

is caused by the fact that the letter document class does not have a figure environment. Changing the document class to article solves this problem.

Your documentclass letter does not define the environment figure.

This environment figure is in the most documentclasses a floating object, that means LaTeX has some freedom of where to place the content of figure. However, floating objects do not make much sense in short documents like letters, that's why fugure is not defined in letter.

If you want to include a graphic, you could do it like this:

\documentclass{letter}

\usepackage{graphicx}

\begin{document}
\begin{center}
\includegraphics{example-image-a}
\end{center}
\end{document}


If you really want a floating figure environment in a letter, you can use the float and caption package:

\documentclass{letter}

\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}

\newfloat{figure}{htbp}{figs}

\begin{document}
\begin{figure}
\includegraphics{example-image-a}
\caption{Test}
\end{figure}
\end{document}

• This is excellent info, but I'm promoting the simpler submission as my answer---as a beginner I'm just trying to get things to work, and the quickest, most-easily-implemented course is all I can manage right now. – Steven Arntson Feb 6 '15 at 17:26
• the question is, do you want to write an article or a letter? If you want to write a letter, you should use a documentclass that suites it, so letter or maybe scrlettr2 from komascript which is more suited for european tastes. – MaxNoe Feb 6 '15 at 18:01