[Tex/LaTex] faulty in this LaTeX Code

errors

Consider the following code:

\begin{figure}[hbtp]
\centering
\fbox{\includegraphics[trim=2 0 0 0,width=\textwidth]{"Main Picture".jpg}}
\caption{Geometric Setup used for the proof of Theorem 1}
\end{figure}

When I execute this code by clicking "QuickBuild" in TeX editor I get the following errors:

  1. ! Undefined control sequence.
  2. ! Missing number treated as zero.
  3. ! Illegal unit of measure (pt inserted).

A rough sketch of my entire code is given for reference:

\documentclass[10 pt,a4paper,twoside,reqno]{amsart} 
\usepackage{amsfonts,amssymb,amscd,amsmath,enumerate,verbatim,calc} 
\renewcommand{\baselinestretch}{1.2} 
\textwidth = 12.5 cm 
\textheight = 20 cm 
\topmargin = 0.5 cm 
\oddsidemargin = 1 cm 
\evensidemargin = 1 cm 
\pagestyle{plain} 

\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}

\begin{document}

\begin{titlepage}
\vfill
\centering
{\Huge On the Reflection Property of a Pararbolid}\\[1cm]
{\Large Shrey Aryan}\\[0.6cm]
XYZ University, ABC Country

Email:183@gmail.com
\vfill
\end{titlepage}

\section{abstract}
Some Text....

\section{Introduction}
Some Text.....

\section{Preliminary}
Some Text.....

\begin{figure}[hbtp]
\centering
\fbox{\includegraphics[trim=2 0 0 0,width=\textwidth]{"Main Picture".jpg}}
\caption{Geometric Setup used for the proof of Theorem 1}
\end{figure}

\section{Main Result}
Some Text....

section{References}
Some Text....

\end{document}

Best Answer

The problem in your code is that your are using the \includegraphics command without loading a package where it is defined. This is what the error message

Undefined control sequence.
<argument> \includegraphics 
                            [trim=2 0 0 0,width=\textwidth ]{algorithm.jpg}
l.39 ...=2 0 0 0,width=\textwidth]{algorithm.jpg}}

means. The solution is to load the package graphicx which contains a definition of \includegraphics. You do this by adding \usepackage{graphicx} to the preamble of your document.

Related Question