From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/plain/contrib/blanks/blanks-sample.tex | 45 +++++++++++++++++++++++++++ macros/plain/contrib/blanks/blanks.tex | 34 ++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 macros/plain/contrib/blanks/blanks-sample.tex create mode 100644 macros/plain/contrib/blanks/blanks.tex (limited to 'macros/plain/contrib/blanks') diff --git a/macros/plain/contrib/blanks/blanks-sample.tex b/macros/plain/contrib/blanks/blanks-sample.tex new file mode 100644 index 0000000000..a0c2c6c740 --- /dev/null +++ b/macros/plain/contrib/blanks/blanks-sample.tex @@ -0,0 +1,45 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Example of use of macros +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\magnification=\magstephalf +\font\AnsFont=cmtt10 at 14pt +\parskip=1pc +\parindent=15pt + +\newcount\QuestionNumber +\QuestionNumber=1 + +\def\Question{\hangindent\parindent\ignorespaces\noindent\number + \QuestionNumber.\space + \advance\QuestionNumber by 1} + +\DoAnswerstrue + +\noindent{\bf With Answers:} +\medskip + +\Question If all men are mortal, and Socrates is a man then +\Ans{Socrates is mortal man, as well as a Greek man}. + +\Question Five time four equals \Ans{20.} + +\Question Mares eat \Ans{oats}, and does eat \Ans{oats}, and little +lambs eat \Ans{ivy}. I would eat ivy too, \Ans{wouldn't you}? + +\DoAnswersfalse + +\QuestionNumber=1 +\bigskip +\noindent{\bf Without Answers:} +\medskip + +\Question If all men are mortal, and Socrates is a man then +\Ans{Socrates is mortal man, as well as a Greek man}. + +\Question Five time four equals \Ans{20.} + +\Question Mares eat \Ans{oats}, and does eat \Ans{oats}, and little lambs +eat \Ans{ivy}. A kid'll eat ivy too, \Ans{would you}? + +\bye diff --git a/macros/plain/contrib/blanks/blanks.tex b/macros/plain/contrib/blanks/blanks.tex new file mode 100644 index 0000000000..f15cd37404 --- /dev/null +++ b/macros/plain/contrib/blanks/blanks.tex @@ -0,0 +1,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----------------------- -- cgit v1.2.3