diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/randomlist/test.tex |
Initial commit
Diffstat (limited to 'macros/generic/randomlist/test.tex')
-rw-r--r-- | macros/generic/randomlist/test.tex | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/macros/generic/randomlist/test.tex b/macros/generic/randomlist/test.tex new file mode 100644 index 0000000000..7e6f65519c --- /dev/null +++ b/macros/generic/randomlist/test.tex @@ -0,0 +1,61 @@ +\documentclass{article} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[a4paper, margin=2.5cm, noheadfoot]{geometry} +\usepackage{amsmath} +\usepackage[seed=1]{randomlist} + +\pagestyle{empty} +\setlength{\parindent}{0pt} + +\NewList{Pupils} +\NewList{Triples} + +\begin{document} +\ReadFileList{Pupils}{pupils.dat} +\ExtractFirstItem{Pupils}{NULL} % extract title line +\ReadFileList{Triples}{pythagoras.dat} +\ForEachFirstItem{Pupils}{Pupil} +{% + \ReadFieldItem{\Pupil}{0}{Name} + \ReadFieldItem{\Pupil}{1}{FName} + \ReadFieldItem{\Pupil}{2}{Note} + \ExtractRandomItem{Triples}{Triple} + \ReadFieldItem{\Triple}{0}{Triplea} + \ReadFieldItem{\Triple}{1}{Tripleb} + \ReadFieldItem{\Triple}{2}{Triplec} + \begin{center} + \fbox{\huge\bfseries Test for \Name{} \FName} + \end{center} + \textbf{Exercise} \par + \if A\Note + The diagonal of a rectangle is \Triplec~in and a side of this + rectangle is \Triplea~in. What is the length of the other side of + the rectangle? + \else + Find the length of the diagonal of a rectangle that is \Triplea~in + by \Tripleb~in. + \fi + \newpage + \begin{center} + \fbox{\huge\bfseries Answer to the test for \Name{} \FName} + \end{center} + \textbf{Exercise} \par + \if A\Note + Use Pythagorean theorem. We have: + \[\text{diag}^2=\text{side1}^2+\text{side2}^2.\] + Here: + \[\Triplec^2=\Triplea^2+\text{side2}^2\] + and then + \[\text{side2}=\sqrt{\Triplec^2-\Triplea^2} = \Tripleb.\] + \else + Use Pythagorean theorem. We have: + \[\text{diag}^2=\text{side1}^2+\text{side2}^2.\] + Here: + \[\text{diag}^2=\Triplea^2+\Tripleb^2\] + and then + \[\text{diag}=\sqrt{\Triplea^2+\Tripleb^2} = \Triplec.\] + \fi + \newpage +} +\end{document} |