WeBWorK Problems

Placement of preview/check answer box

Placement of preview/check answer box

by Steven Fiedler -
Number of replies: 3

I'm looking for a clean way to write a problem on balancing a chemical equation. Below is a MWE of a simple attempt. The issue is that the preview and the check answer boxes are (logically) inserted by the final answer blank, however this impedes the readability of the problem itself. I would appreciate any instruction about controlling the placement of these pop-up boxes, if this is possible.

DOCUMENT();
loadMacros('PGstandard.pl','PGML.pl','parserMultiAnswer.pl');

$ma=MultiAnswer(2,2,1)
 ->with(cmpOpts=>{mathQuillOpts => "disabled"},partialCredit=>0,singleResult=>1);

BEGIN_PGML
Balance the below chemical equation.

[_]{$ma} [`\text{H}_2\text{O}`] (g) [`\longrightarrow`]  [_]{$ma} [`\text{H}_2`] (g) + [_]{$ma} [`\text{O}_2`] (g)

END_PGML
ENDDOCUMENT();

Attachment mwe2.png
In reply to Steven Fiedler

Placement of preview/check answer box

by Glenn Rice -

Place the answer line inside a div with the ww-feedback-container class.  For example,

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'parserMultiAnswer.pl');

$ma = MultiAnswer(2, 2, 1)->with(
    partialCredit => 0,
    singleResult  => 1
);

BEGIN_PGML
Balance the below chemical equation.

[<
    [_]{$ma} [`\text{H}_2\text{O}`] (g) [`\longrightarrow`]  [_]{$ma} [`\text{H}_2`] (g) + [_]{$ma} [`\text{O}_2`] (g)
>]{ [ class => 'ww-feedback-container' ] }
END_PGML

ENDDOCUMENT();

That will place the feedback button at the end of the line.

You can additionally add one of the classes ww-fb-align-middle or ww-fb-align-bottom to make the button be aligned vertically to the middle right or bottom right of that containing div.  The default is to align the button at the top right of the div.  In this case, the top seemed to look best to me.

Any problem that uses MultiAnswer with singleResult => 1 now needs this sort of thing, since in that case the new feedback mechanism cannot automatically choose a good place to put the feedback button.

I noticed that you had cmpOpts=>{mathQuillOpts => "disabled"} in the problem.  I am not sure why you would do that for this sort of answer.  The answers are numeric which works quite well with MathQuill.

In reply to Glenn Rice

Placement of preview/check answer box

by Steven Fiedler -

Thank you Glenn. This is very helpful.

Regarding MathQuill... Some of my students have shown that they use their phones to complete their assignments. While I personally don't consider this to be optimal and have ensured that the students are well aware of campus resources, their phone display appears to be a preferred option for some of the students that we are trying the hardest to reach.

The issue is that the mathquill editor takes up a rather sizable portion of the phone display, e.g, ~10% of the problem in the attached screenshot. If mathquill is superfluous for tasks such as simple numerical entry, I considered the expanded display afforded by its absence to take precedence.

Attachment phone_screenshot.jpeg
In reply to Steven Fiedler

Placement of preview/check answer box

by Glenn Rice -

That is seriously the wrong reason to add cmpOpts=>{mathQuillOpts => "disabled"} to a problem.  That option is certainly not intended for that.  The option is intended for problem answers for which a MathQuill input does not make sense such as a purely textual answer.

For the purpose you are describing you should disable MathQuill for the course.

You should also note that students can disable the toolbar.  On a touch screen touch and hold any MathQuill input, and a menu will pop up that has the single "Disable Toolbar" option.  It can be re-enabled again in the same way.  I would prefer that you teach the students this, rather than disabling MathQuill and certainly do not add that option to the problem.