WeBWorK Problems

Graphs in Tables with Multiple Choice

Graphs in Tables with Multiple Choice

by Cindy Loten -
Number of replies: 2

I am using webwork 2.17 and am looking to create some questions containing graphs in tables with multiple choice radio buttons as appears in

Library/NAU/setGraphTheory/FindIsomorphism.pg

This is my first problem of this sort, and I want to make sure I've got a good approach before making more.

In FindIsomorphism.pg, creating the table (containing 3 graphs) with radio buttons relies on the line

($table,$ans) = radio_table([@pics], [0,0,1], geometry => [1,3]);

[0,0,1] means that the 3rd option is correct.  [1,3] means the table has 1 row and 3 columns.

I found the command radio_table in the macro PGnauGraphics.pl which is loaded by PGnauGraphtheory.pl

When I try to use the radio_table command, I ended up with an extra row. Note that I have 4 graphs, not 3. I used the line

($table,$ans) = radio_table([ @image], [@indices], geometry => [2,2], border => 1);

@indices has 1 in the position corresponding to the correct answer and 0 elsewhere. I have some randomization in my problem.  [2,2] means I want a  2x2 table of graphs.

See below for screen shot.

Table with extra row, created using radio_table

I have attached my code in 12_2_Polish_rtable.pg

I also tried a version of this question according to the guidelines posted at https://webwork.maa.org/wiki/GraphsInTables using popups for selecting the correct graph. See below for a screen shot. I used niceTables.pl and LayoutTable instead of unionTables.pl and BeginTable.

graph in table using niceTables.pl

I have attach my code for this version in 12_2_Polish.pg

Now for my questions:

  1.  Why am I getting an extra line using radio_table? In the code for radio_table, they use unionTables.pl and BeginTable and AlignedRow.

  2. What is the "modern" approach for multiple choice and graphs in tables: using radio_table, or using popups with an appropriately formatted table?
  3. If using popups with an appropriately formatted table is the modern approach, which is better for the table: niceTables.pl and LayoutTable or unionTables.pl and BeginTable?
Thanks!

Cindy

In reply to Cindy Loten

Re: Graphs in Tables with Multiple Choice

by Danny Glin -
The code for radio_table has not been touched for 10 years, so it's definitely not up to modern WeBWorK standards.  niceTables is more recent, and has been refactored for WW 2.18 to better adhere to current web best practices.  In the long run unionTables will probably be deprecated in favour of niceTables, so you should probably stick with niceTables.

If you're not married to a table, you should be able to put your graphs directly into a radio button question.  Try the following:

$radio1 = RadioButtons([@image],$pick);

BEGIN_PGML
[_]{$radio1}
END_PGML


In reply to Danny Glin

Re: Graphs in Tables with Multiple Choice

by Cindy Loten -

$radio1 = RadioButtons([@image],$pick);

worked great.  Thanks!

I also appreciated the comments on niceTables vs unionTables.