\ProvidesPackage{answer2}[1997/09/14 answer boxes that allow solutions]
% Written by Nick Urbanik,

% $Header$

% $Log$

\RequirePackage{ifthen}

\providecommand*{\writeSymbol}{\ding{48}}% A pencil pointing up, to right.
%\providecommand*{\writeSymbol}{\ding{43}}% A hand pointing to the right.
%\providecommand*{\writeSymbol}{\ding{45}}% A hand holding a pen
%\providecommand*{\writeSymbol}{\ding{253}}% A big fat arrow pointing right
\@ifundefined{s}{\global\def\s#1{}}

\newlength{\answerBoxWidth}%
\newcommand{\answerbox}[2][.3\columnwidth]%
{%
  \settowidth{\answerBoxWidth}{\s{#2}}%
  \addtolength{\answerBoxWidth}{2\fboxsep}%
  \ifthenelse{\lengthtest{#1 > \answerBoxWidth}}%
    {\setlength{\answerBoxWidth}{#1}}%
  %else
    {}
  \nolinebreak[1]\mbox{}\dotfill%
  \nolinebreak\hspace{2ex}\nolinebreak%
  \ifthenelse{\lengthtest{\answerBoxWidth > \linewidth}}%
  {%
    \setlength{\answerBoxWidth}{\linewidth}%
    \addtolength{\answerBoxWidth}{-2\fboxsep}%
    \par\noindent%
    \mbox{}%
    \marginpar%
    [{
      \raggedright%
      \protect%
      \makebox[50pt][r]%
      {%
        \protect\writeSymbol%
      }%
    }]%
    {%
      \raggedright%
      \protect%
      \makebox[50pt][r]%
      {%
         \protect\writeSymbol%
      }%
    }%
    \framebox{\parbox{\answerBoxWidth}{\s{#2}}}%
  }%
  %else
  {%
    \mbox{}%
    \marginpar%
    [{
      \raggedright%
      \protect%
      \makebox[50pt][r]%
      {%
         \protect\writeSymbol%
      }%
    }]%
    {%
      \raggedright%
      \protect%
      \makebox[50pt][r]%
      {%
         \protect\writeSymbol%
      }%
    }%
   \framebox[\answerBoxWidth]{\rule{0pt}{\baselineskip}\s{#2}}\sloppypar%
  }%
%  \sloppypar%
}

