When using the exams
package to produce PDF files for NOPS exams I want to edit the number of digits that are available to my students (reglength
). I am aware that the package only admits a minimum of 7 digits. However, our students only have 5 digits in their ID number. As so I would to know if it is possible to edit the template via PDF manipulation (I tried with the staplr::get_fields()
function, but it does not work) or any other way... I simply want to add 0
to the two first digits (i.e., 00xxxxx
).
Asked
Active
Viewed 135 times
3

Achim Zeileis
- 15,710
- 1
- 39
- 49

Sinval
- 1,315
- 1
- 16
- 25
2 Answers
3
This is a good idea which I have implemented in exams 2.4-0. If you specify a reglength < 7
now, it is still enforced to be 7 internally - and thus this length is necessary in the registration CSV file! But on the exam sheet the initial IDs are fixed to "0" and the corresponding boxes are ticked already.
For example, the following code will give you a warning but produce the output below:
exams2nops(..., reglength = 5)
## Warning message:
## In make_nops_page(n, nchoice = nchoice, reglength = reglength) :
## 'reglength = 5' too small, using 7 instead, but fixing initial IDs to 0
Notes:
- I haven't tested yet whether the scanning of these sheets actually works well enough because I'm in my home office for the foreseeable future without access to a suitable printer/scanner. I don't see sources for potential problems, though.
- I assumed that you referred to
exams2nops()
rather thanexams2pdf()
and hence have modified your question accordingly. Inexams2pdf()
you can need to provide your template anyway and can edit it in any way you like, adding the zeros where you need them.

Achim Zeileis
- 15,710
- 1
- 39
- 49
-
1Exactly, you assumed it correctly. It is perfect! Thank you! – Sinval Dec 17 '20 at 07:54
1
We added the XX manually to the exams2nops pdf generated file manually, and the scans did work fine. I see no reason why they should not work with your solution. Thanks for implementing it.

JPMD
- 644
- 1
- 7
- 19