Forum archive 2000-2006

Michael Gage - labeled_ans_rule

Michael Gage - labeled_ans_rule

by Arnold Pizer -
Number of replies: 0
inactiveTopiclabeled_ans_rule topic started 12/15/2001; 12:37:52 PM
last post 12/15/2001; 12:37:52 PM
userMichael Gage - labeled_ans_rule  blueArrow
12/15/2001; 12:37:52 PM (reads: 1706, responses: 0)

labeled_ans_rule

Description
This enters an answer rule attached to a specific label. This allows more control when matching student answers with answer evaluators

Syntax

labeled_ans_rule(label,width)

Params

The first parameter is the label and is required.
The second parameter is the width of the ans_rule and defaults to 20 (characters) if omitted.

Returns

The HTML (or TeX) code for an answer blank.

Examples


BEGIN_TEXT
Complete the sentence. Hello \{labeled_ans_rule("string_answer",20)\}
4+8 = \{labeled_ans_rule("numerical_answer"\}

END_TEXT
LABELED_ANS("numerical_answer" => num_cmp(12),"string_answer" => str_cmp("World") );

checks that the first answer is "World" and that the second answer is numerically equivalent to 12, despite entering the answer evaluators in an order which does not match the appearance of the answer blanks.

Notes

This is essentially syntactic sugar for "NAMED_ANS_RULE". It provides a default for the width, and labeled_ans_rule seems a more descriptive title than named_answer_rule. The low level (capitalized) subroutines will retain the titles NAMED... for backward compatibility.
The labeled (or NAMED) versions of answer blanks and answer evaluators can be useful in situations where the order of the answer blanks is not obvious.

See Also

LABELED_ANS, "NAMED_ANS_RULE", ans_rule, "NAMED_ANS_BOX", Managing answers

Macro Definition File

PGbasicmacros.pl

 

<| Post or View Comments |>