%Basic Math Practice worksheet
%By Matthew Ferguson
%Randomly Generates a PDF with
%56 addition problems for a desired
%Difficulty level (currently single digits).
\documentclass{article}
% \usepackage{amsmath}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{xlop}
\usepackage{pstricks}
% \usepackage{showframe}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{~\\56 Problem Practice Worksheet}
\rhead{Name: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \\}
\lfoot{Number Correct: ~ \Large $\dfrac{~}{56}$}
\cfoot{~}
%---------------------------------------%
% To change the Difficulty, enter a number.
% Problems will be generated randomly with
% this as a maximum (i.e. 99 will give all
% two-digit numbers). Default is for First
%and Second number to be single digit (i.e.
%maximum of 9).
\newcommand*{\DifficultyOne}{9}%
\newcommand*{\DifficultyTwo}{9}%
%---------------------------------------%
\newcommand{\AddQuestion}[1]{%
\foreach \i in {1,...,#1}{%
\pgfmathtruncatemacro{\AddOnea}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwoa}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOneb}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwob}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOnec}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwoc}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOned}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwod}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOnee}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwoe}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOnef}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwof}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOneg}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwog}{random(\DifficultyTwo)}
\pgfmathtruncatemacro{\AddOneh}{random(\DifficultyOne)}%
\pgfmathtruncatemacro{\AddTwoh}{random(\DifficultyTwo)}
\hspace*{\fill}
\opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOnea}{\AddTwoa} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOneb}{\AddTwob} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOnec}{\AddTwoc} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOned}{\AddTwod} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOnee}{\AddTwoe} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOnef}{\AddTwof} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOneg}{\AddTwog} \hfill \opadd[carryadd=false, voperator=bottom, resultstyle=\white]{\AddOneh}{\AddTwoh} \hspace*{\fill}\\
~\newline
~\newline
}%
}%
\begin{document}
%\large
\AddQuestion{7}
\end{document}