GeneralWhy "undefined controls sequence"?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Why "undefined controls sequence"?

Post by Singularity »

I have a standard preamble that I use to make my exams. For exam 2, I just delete the content and add new questions and solutions. I add the solutions using a new command \sol that I define with

Code: Select all

\newcommand{\sol}[1]{\begin{solution} #1 \end{solution}\vspace{\stretch{1}}\droppoints}
I haven't changed anything, but in this one whenever I use a \sol command I'm getting the error
! Undefined control sequence.
But the sequence is defined just as it always has been.

Can someone explain what I'm doing wrong?

Here's my MWE

Code: Select all

\documentclass[fleqn,addpoints
,answers
]{exam}
\usepackage{amsfonts,amsmath,amssymb,amsthm,mathtools,commath}
\usepackage{color}					% Necessary for \shaded solutions and color solutions

\usepackage{array}					% Provides for a more flexible array and tabular environment, like the column defs below
\usepackage{booktabs}				% For fancy stuff in arrays and tables
\usepackage{multicol}
\newcolumntype{L}{>{\begin{math}}l<{\end{math}}}%
\newcolumntype{C}{>{\begin{math}}c<{\end{math}}}%
\newcolumntype{R}{>{\begin{math}}r<{\end{math}}}%

\everymath{\displaystyle}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\shadedsolutions

% For the exam package
\newcommand{\sol}[1]{\begin{solution} #1 \end{solution}\vspace{\stretch{1}}\droppoints}
\setlength\answerclearance{0.4ex}
\CorrectChoiceEmphasis{\itshape\color{red}}

\begin{document}

\begin{questions}

\question Solve the system, if possible.

%\begin{tabular}{RRRRRRR}
	     %&   &  x_2 & - &  x_3 & = &  0 \\
	 %x_1 &   &      & - & 3x_3 & = &  1 \\
	%-x_1 & + & 3x_2 &   &      & = & -1
%\end{tabular}

\sol{$x_1=3t-1, x_2=x_3=t$.}

\end{questions}

\end{document}
BTW, the code does what it's supposed to, but now it reports the error for every use of \sol.

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Why "undefined controls sequence"?

Post by Stefan Kottwitz »

I think it's the same as here: What control sequence is undefined here. I get the same error message, \padded@point@block is undefined.

Stefan
LaTeX.org admin
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: Why "undefined controls sequence"?

Post by Singularity »

Yes, you're right. I forgot about that (I should have searched).
TY.
Post Reply