summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/blanks/blanks.tex
blob: f15cd374041813ab79a0da461b552db0fe55eed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%               Fill-in-the-blank macros
%                     Hal Varian
%                   August 19, 1987
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
     
%list processing routines taken from TeXbook, p. 310-11
     
\def\dolist{\afterassignment\dodolist\let\next= }
\def\dodolist{\ifx\next\endlist \let\next\relax
  \else \\\let\next\dolist \fi
  \next}
\def\endlist{\endlist}
     
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
%print out answers or not?
\newif\ifDoAnswers\DoAnswerstrue
     
%See if next token is a space.  If it is, set a low penalty for
%line breaking.  Set box 0 to be the next token.  If we should
%do answers, underscore box 0, back up and print box 0.  Otherwise
%just underscore box 0.
\def\\{\expandafter\if\space\next\penalty0\fi\setbox0=\hbox{\next}\ifDoAnswers
  \underscore\llap{\raise2pt\box0}\else\underscore\fi}
     
%Underscore -- put in strut so there is enough space for handwriting.
\def\underscore{\bigstrut\vrule height 0pt depth.5pt width\wd0}
\def\bigstrut{\hbox{\vrule height 16pt width 0pt}}
     
\def\Ans#1{\space{\AnsFont {\dolist#1\endlist}\underscore}}

%%% ----cutting here would not be a bad idea-----------------------