\ProvidesPackage{biganswerbox}[2003/05/20 wide answer boxes with solutions]
% Written by Nick Urbanik
% see
% http://tex.loria.fr/ctan-doc/macros/latex/doc/html/usrguide/node19.html
% for use of lrbox.
% Actually the Companion describes it even better on page 459--460.

% $Id$

% $Log$

\RequirePackage{ifthen,pifont,calc}

\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{\biganswerboxheight}%
\setlength{\biganswerboxheight}{1.8cm}%
\newsavebox{\biganswerboxsaved}
\newenvironment{biganswerbox}[1][\biganswerboxheight]{%
  \par\nopagebreak\mbox{}%
  \marginpar%
  [{
    \raggedright%
    \protect%
    \makebox[50pt][r]%
    {%
      \protect\writeSymbol%
    }%
  }]%
  {%
    \raggedright%
    \protect%
    \makebox[50pt][r]%
    {%
      \protect\writeSymbol%
    }%
  }%
  \begin{lrbox}{\biganswerboxsaved}%
    \rule[0.5\baselineskip-#1]{0pt}{#1}%
    \begin{minipage}[t]{\linewidth-2\fboxrule-2\fboxsep}%
    }%
    {%
      \unskip%
      \hrule height 0pt width\hsize%
    \end{minipage}%
  \end{lrbox}%
  \noindent\fbox{\usebox{\biganswerboxsaved}}%
}

%% Use like this:
%% \usepackage{version}
%% \excludeversion{solution}
%% %\inludeversion{solution}
%% \begin{enumerate}
%% \item Here is my first question:
%%   \begin{biganswerbox}
%%     \begin{solution}% <-- essential
%%       This is my solution.
%%     \end{solution}
%%   \end{biganswerbox}
  
%% \item Here is my next question.
%%   \begin{testanswerbox}[0.5cm]
%%     % No answer yet
%%   \end{testanswerbox}
%% \end{enumerate}

%% From - Sat May 31 05:36:34 2003
%% Path: dragon.vtc.edu.hk!not-for-mail
%% From: Nick Urbanik <nicku@vtc.edu.hk>
%% Newsgroups: comp.text.tex
%% Subject: Re: minipage loses shape if empty, oh dear!
%% Date: Sat, 31 May 2003 05:33:18 +0800
%% Organization: Institute of Vocational Education (Tsing Yi)
%% Lines: 45
%% Message-ID: <3ED7CE1E.D30D0E59@vtc.edu.hk>
%% References: <3ED720CB.65FC4A00@vtc.edu.hk> <yfifzmwbt7z.fsf@triumf.ca> <3ED73BE0.8672E0B7@vtc.edu.hk> <yfibrxkblvk.fsf@triumf.ca>
%% NNTP-Posting-Host: 172.19.32.95
%% Mime-Version: 1.0
%% Content-Type: text/plain; charset=us-ascii
%% Content-Transfer-Encoding: 7bit
%% X-Trace: dragon.vtc.edu.hk 1054330341 6006 172.19.32.95 (30 May 2003 21:32:21 GMT)
%% X-Complaints-To: abuse@vtc.edu.hk
%% NNTP-Posting-Date: 30 May 2003 21:32:21 GMT
%% X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.20-8custom i686)
%% X-Accept-Language: en
%% Xref: dragon.vtc.edu.hk comp.text.tex:154891

%% Donald Arseneau wrote:

%% > Nick Urbanik <nicku@vtc.edu.hk> writes:
%% > Probably it is best to perform
%% >
%% > \setlength{\wd\biganswerboxsaved}{\columnwidth-2\fboxrule-2\fboxsep}
%% > right after \end{lrbox}.

%% Okay, thank you, I'll try that.

%% > You could do
%% > \unskip
%% > \hrule height 0pt width\hsize
%% > but then also you lose the depth of the last box.  Oh, you use [t]
%% > alignment... then it only hurts if there is only one line of text.

%% No problem, as the rule I put in stops the box from getting that small a
%% height.  I'll have a go at it.  News flash: It works!! Thank you, thank you!

%% > Oh, have you looked at framed.sty, and some others?

%% Well, not till you mentioned it, so I'll see if I can get your
%% framed.sty to do what I'm trying to achieve.

%% Thank you very much Donald, I am honoured by the effort you have made
%% in helping me with my endeavour.  For now, it is 5.30am, Saturday
%% morning, and I must get ready to take my lovely 3 1/2 year old son on
%% my bicycle to Lion Rock here in Hong Kong, where we will walk to the
%% top and admire the beauty of Hong Kong from the top of that wonderful
%% rock!

%% One of these days I'll read the TeXbook and finally start to
%% understand how LaTeX actually works.  My messing with the LaTeX
%% commands from The LaTeX Companion has gotten me to solve nearly all my
%% formatting problems, but for the last few, I need to roll up my
%% sleeves and get down and dirty with TeX.

%% --
%% Nick Urbanik   RHCE                               nicku(at)vtc.edu.hk
%% Dept. of Information & Communications Technology
%% Hong Kong Institute of Vocational Education (Tsing Yi)
%% Tel:   (852) 2436 8576, (852) 2436 8713          Fax: (852) 2436 8526
%% PGP: 53 B6 6D 73 52 EE 1F EE EC F8 21 98 45 1C 23 7B     ID: 7529555D
%% GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24   ID: BB9D2C24
