1

I am writing a math quiz that uses cloze questions: questions with a missing number that has to be determined.

To accommodate the handwriting of students, I'm creating an answer box using \fbox{\huge\phantom{NN}}.

These are elementary math facts, like 3 + 5 = 8. There are three possibilities: The first item could be missing ([missing] + 5 = 8), the second could be missing (3 + [missing] = 8), or the answer could be missing (3 + 5 = [missing]).

These are vertically aligned math problems that use an \hrule to separate the first two terms from the answer (think elementary math). I am trying to line up the problems so that the various components line up.

I am using \LARGE font (\baselineskip = 22 pt) for the numerals and \huge (\baselineskip = 25 pt) for the blank answer square. I tried to line these up by adding additional \vspace{3pt}, but it isn't working quite right.

Using the input below:

\documentclass[10pt]{letter}
\usepackage[top=0.5in, bottom=0.5in, left=0.5in, right=0.5in]{geometry}
\def\clozeMiddle[#1][#2][#3]{
\hbox to 72pt{
\vbox{
\vspace{3pt}
\hbox to 46pt{\hfill#1}
\vspace{1pt}
\hbox{\hbox to 12pt{\hfill#3}\hbox to 34pt{\hfill\fbox{\vbox{\huge\phantom{NN}}}}}
\vspace{2pt}
\hrule\vspace{2pt}\vspace{3pt}\hbox to 46pt{\hfill#2}}
}
}

\def\clozeBottom[#1][#2][#3]{
\hbox to 72pt{
\vbox{
\vspace{3pt}
\hbox to 46pt{\hfill#1}
\vspace{1pt}
\vspace{3pt}
\hbox{\hbox to 12pt{\hfill#3}\hbox to 34pt{\hfill#2}}
\vspace{2pt}
\hrule\vspace{2pt}\hbox to 46pt{\hfill\fbox{\vbox{\huge\phantom{NN}}}}}
}
}

\begin{document}
\LARGE
\hbox{
\clozeMiddle[4][7][+]
\clozeBottom[4][3][+]
}
\end{document}

I get this:

Output

The \hrule for the first item almost matches up with the \hrule for the second, but not quite. I think this is just because the \fbox line has some width.

The real issue is that the 4 in the second question is much higher the 4 in the first. I would not expect this to be the case because in both cases there should be 2 + 25 + 1 = 28 points between the \hrule and the bottom of the box housing the 4.

  • Welcome! Please put your code fragments together into a complete document so that we can copy-paste and compile your code to see exactly what you're seeing. To upload a picture, use the picture icon in the post editor, select a file, OK it and add a textual description. Your picture may not show up if you don't have enough reputation, but if you leave it as is, it will be very easy for somebody else to 'activate' it this way. – cfr Aug 10 '16 at 0:08
  • 1
    Since you seem to be using LaTeX, have you looked at packages which do this kind of thing for you? There are quite a number of packages for both maths and exams/quizzes. Not all of the maths is designed for university level, either. I believe there are packages designed for work with less advanced students, too. – cfr Aug 10 '16 at 0:12
  • Thanks, cfr for the welcome! I've modified my question and uploaded an image. I'll look into some packages, but I think I am close to having everything I need once I get this one issue sorted, as I can just tile the page as necessary with these boxes. – David R Aug 10 '16 at 15:49
  • Maybe worth a look too: Graphical placeholder for “variables” ;-) – Tobi Mar 30 '17 at 12:43
1

there are a lot of non-latex commands in the definitions, and the resulting command doesn't follow normal latex syntax as it has mandatory arguments in []. (and using unguarded \hbox in latex has odd effects if you try to centre it or start a paragraph, or make it the first thing after a section heading, etc.

A more idiomatic latex version might be

enter image description here

\documentclass[10pt]{article}


\usepackage{array}

\usepackage[top=0.5in, bottom=0.5in, left=0.5in, right=0.5in]{geometry}
\newcommand\clozeMiddle[3]{{%
\LARGE\setlength\extrarowheight{20pt}%
\begin{tabular}{@{}cc@{}}
&\makebox(72,30)[r]{#1}\\
\makebox(10,30){$#3$}&\framebox(72,30)[r]{}\\
\hline
&\makebox(72,30)[r]{#2}
\end{tabular}}}

\newcommand\clozeBottom[3]{{%
\LARGE\setlength\extrarowheight{20pt}%
\begin{tabular}{@{}cc@{}}
&\makebox(72,30)[r]{#1}\\
\makebox(10,30){$#3$}&\makebox(72,30)[r]{#2}\\
\hline
&\framebox(72,30)[r]{}
\end{tabular}}}

\begin{document}

\clozeMiddle{4}{7}{+}%
\qquad
\clozeBottom{4}{3}{+}

\end{document}
  • Thanks, David! (It was interesting to see you posting a solution here---I'm more used to see you on the xml-dev list-serv). – David R Apr 30 '17 at 21:00
  • @DavidR I've been posting tex answers since long before xml existed:-) – David Carlisle Apr 30 '17 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.