## WeBWorK Main Forum

### new_multiple_choice: can't generate hardcopy with student answer

by Andras Balogh -
Number of replies: 8

When I use new_multiple_choice, for example from https://webwork.maa.org/wiki/MultipleChoiceProblems, PDF hard copy generation with students answer results in error message

Package inputenc Error: Invalid UTF-8 byte "80.
...
l.416 $\displaystyle \verb B$
Without student answer there is no problem with PDF generation.

This is in v. 2.17, but as I remember I had the same problem with v. 2.16.

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Glenn Rice -

First, it needs to be noted that using the PGchoicemacros.pl with anything other than new_checkbox_multiple_choice is not something that you should do anymore.  The only reason for the allowance for usage of new_checkbox_multiple_choice is because there isn't a proper alternative for that with new answer checkers.  For radio answer type problems use parserRadioButtons.pl as noted on the page that you referenced.

In any case, to fix the issue on line 597 of PGstringevaluators change "my $c = chr(128);" to "my$c = MODES(HTML => chr(0x1F), TeX => chr(0xD));"

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Andras Balogh -

Thanks for the fix!

For the record, I was not going to write a problem myself with new_multiple_choice(). It came from the library problem MontanaState/FL/2.2B83Nested2.pg
It looks superfluous to me to have A,B,C... listed next to the options, like A. True, B. False.

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Glenn Rice -
Yeah, at some point we need to update all of the OPL problems. That is a huge project though.

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Cindy Loten -
I've been using PGchoicemacros.pl for the function NchooseK. Is there a comparable function that I should be using instead of NchooseK?

Thanks!

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Glenn Rice -

Unfortunately, there isn't a replacement for NchooseK even though it has been marked as deprecated since 2007.

### Re: new_multiple_choice: can't generate hardcopy with student answer

by Cindy Loten -
Okay, I see where NchooseK is marked as deprecated in https://webwork.maa.org/pod/pg/macros/PGchoicemacros.html. Thanks for pointing this out.

Unfortunately, I was looking at info about NchooseK at https://webwork.maa.org/wiki/NchooseK

Any style hints as to what's better:
(1) keep using NchooseK
or
(2) use my own perl program to shuffle the array (0.. n-1) and then keep the first k elements of the array.