Graphics, Figures & TablesWhy can't I use \begin{figure}?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
subjugater
Posts: 7
Joined: Sat Nov 28, 2009 8:46 pm

Why can't I use \begin{figure}?

Post by subjugater »

Code: Select all

\documentclass[a4paper,12pt]{letter}
\usepackage{fullpage}
\usepackage{latexsym,amsmath,amssymb}    % need for subequations
\usepackage{graphicx}   % need for figures
\begin{document}
......
\begin{figure}
\includegraphics[totalheight=0.8\textheight,viewport=50 300 1000 1200,clip]{shear.pdf}
\caption{\emph{caption here}}
\end{figure}
......
\end{document}
When compiling the above script, I was bounced back by the following error message:

Code: Select all

./research.tex:207:Environment figure undefined. \begin{figure}
./research.tex:210:\caption outside float. \caption
./research.tex:212:\begin{document} ended by \end{figure}. \end{figure}
Why can't I use \begin{figure}here? BTW, I use kile in Ubuntu.
Last edited by cgnieder on Thu May 03, 2018 2:14 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Why can't I use \begin{figure}???

Post by frabjous »

Seems to be an incompatibility with the letter document class. It works if you change it to article. I'm not sure if there's a way around it, if you're set on using the letter class.
subjugater
Posts: 7
Joined: Sat Nov 28, 2009 8:46 pm

Why can't I use \begin{figure}?

Post by subjugater »

frabjous wrote:Seems to be an incompatibility with the letter document class. It works if you change it to article. I'm not sure if there's a way around it, if you're set on using the letter class.
Thanks, man. You answer is almost what I have thought. It seems that there isn't a way to get around this other than change [letter] to [article]. :(
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Why can't I use \begin{figure}?

Post by localghost »

The figure environment simply isn't defined in the letter class just because float environments don't make sense in a letter.

You can load the caption package and use its \captionof command to get what you want. However, this will look very strange in a letter.


Best regards and welcome to the board
Thorsten
pietro1968
Posts: 1
Joined: Thu May 03, 2018 12:00 pm

Why can't I use \begin{figure}?

Post by pietro1968 »

Here is how I solved the problem:

- include the \usepackage{graphicx}

then:

Code: Select all

\begin{minipage}{\textwidth}
\centering
\includegraphics[width=0.50\textwidth]{ResponsiveMutantsMeeples.png}\\
Figure 1. Glycoproteostasis modulation therapy for responsive mutation carriers.
\end{minipage}
Last edited by cgnieder on Thu May 03, 2018 2:17 pm, edited 1 time in total.
Post Reply