Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I read threw the manual for exam class at mit. I also did some searches, and found one that stated to use the \setcounter{question}{WANTED NUMBER} I want to be able to change the number of the question ie {3,5,10,20343}

This is the error from texsudio

-> Something's wrong--perhaps a missing \item. \question $

Here is my code:

  \documentclass[10pt]{exam}
  \usepackage[a4paper]{geometry}
  \usepackage{graphicx}
  \usepackage{amssymb}
  \usepackage{epstopdf}
 \usepackage{amsmath}
 \usepackage{paralist}
 \usepackage{enumerate}
 \usepackage{wrapfig}
 \usepackage{xcolor}
 \usepackage{graphicx}
 \usepackage{tikz}



 \newcommand\dx[1]{\,\textrm{d}#1}
 \newcommand{\Lim}[1]{\raisebox{0.5ex}{\scalebox{0.8}{$\displaystyle \lim_{#1}\;$}}}
 \begin{document}

  \begin{questions}

In Exercises 1-6, find the equation of the tangent line $T$ to the graph of $f$ at the given point. Use this linear approximation to complete the table. 

\begin{tabular}{|c|c|c|c|c|c|}
\hline 
$x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\ 
\hline 
$f\left(x\right)$ &  &  &  &  &  \\ 
\hline 
$T\left(x\right)$ &  &  &  &  &  \\ 
\hline 
\end{tabular} 

\setcounter{question}{2}

\question $f\left(x\right) = x^5, \; \left(2,\sqrt{2}\right)$ <<<<Here it states and error with \item or \question>>>>>>

\begin{solution}

$f\left(x\right) = x^5$ 
$f^{\prime}\left(x\right) = 5x^4$
Tangent line at $\left(2,32\right)$
$\begin{array}{ccc}
y-f\left(2\right) & = & f^{\prime}\left(x-2\right) \\ 
               y-32& = & 80\left(x-2\right) \\ 
                 y & = & 80x-128
\end{array} $
\begin{tabular}{|c|c|c|c|c|c|}
\hline 
$x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\ 
\hline 
$f\left(x\right)= x^5 $ &24.761 & 31.208 & 32 & 32.808 & 40.841  \\ 
\hline 
$T\left(x\right)= 80x -128$ & 24 & 31.200 & 32 & 32.800 & 40.000 \\ 
\hline 
\end{tabular}

\end{solution}

\question $f\left(x\right)=\sqrt{x}, \; \left(2,\sqrt{2}\right)$
\begin{solution}
$f\left(x\right) = \sqrt{x}$ 
$f^{\prime}\left(x\right) = \frac{1}{2\sqrt{x}} = \frac{\sqrt{2}{4}$
Tangent line at $\left(2,\sqrt{2}\right)$
\begin{array}{ccc}
$y-f\left(2\right) & = & f^{\prime}\left(x-2\right) \\ 
               y-\sqrt{2}& = & \frac{\sqrt{2}{4}\left(x-2\right) \\ 
                 y & = & \frac{x\sqrt{2}}{4}+\frac{\sqrt{2}}{2}$
\end{array} 
\begin{tabular}{|c|c|c|c|c|c|}
\hline 
$x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\ 
\hline 
$f\left(x\right)= x^5 $ & 1.378 & 1.411 & 1.414 & 1.418 & 1.449  \\ 
\hline 
$T\left(x\right)= 80x -128$ & 1.379 & 1.411 & 1.414 & 1.418 & 1.450 \\ 
\hline 
\end{tabular}
\end{solution}
\end{questions}
\end{document} 

What am I doing incorrect?

share|improve this question
    
Please edit your MWE to contain the \documentclass command and the required packages. –  masu Oct 14 '13 at 7:38
    
There are quite a few errors in your code. To fix the first one (which gives rise to the error you're getting at the moment), move the statement \begin{questions} down to between \setcounter{question}{2} and the first \question directive. –  Mico Oct 14 '13 at 7:39
    
@Mico I have a webpage that I got the idea fromhttp://www.latex-community.org/forum/viewtopic.php?f=44&t=9091&start=0 –  MaoYiyi Oct 14 '13 at 8:00
    
Thanks for providing this link. If you study the code that's provided there, you'll notice that there is no LaTeX code that gives rise to typeset output between \begin{questions} and the first \question statement. This is in contrast to your posting, which is trying to direct LaTeX to typeset a sentence plus an entire tabular environment between \begin{questions} and the first \question statement. –  Mico Oct 14 '13 at 8:16

1 Answer 1

up vote 3 down vote accepted

There are currently three errors in your MWE that prevent it from compiling successfully.

  • You have material -- a sentence and an entire tabular environment -- that would be typeset by LaTeX between \begin{questions} and \setcounter{question}{2}. This is causing the error message about "perhaps a missing \item".

    To fix this error, move the \begin{questions} statement down to just before \setcounter{question}{2}.

  • In two instances, you have \frac{\sqrt{2}{4}, which is missing a right curly brace.

    Replace both of these instances with \frac{\sqrt{2}}{4}.

  • An array environment needs to be entirely in math mode. However, the one featured in the solution to the second question is not in math mode (though one of the cell entries is).

    To fix this, place the material from \begin{array}{ccc} to \end{array} in math mode, and remove the $ signs currently located inside the array environment:

    $\begin{array}{ccc}
    y-f\left(2\right) & = & f^{\prime}\left(x-2\right) \\
                   y-32& = & 80\left(x-2\right) \\
                     y & = & 80x-128
    \end{array} $
    

With these changes in place, your code should compile -- and the first question will be numbered 3. Separately, you're probably already aware of the fact that there are several errors in content (rather than syntax) in your MWE which need to be fixed.

Incidentally, I can't help but remark that you're overusing the \left( and \right) statements; none of the expressions currently encased by these constructs are actually "large" in the TeX sense. It's much better to use ordinary round parentheses, ( and ), in all of these cases. You'll find that the spacing around the parentheses is far more natural without these \left and \right qualifiers.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.