WeBWorK Problems

ww2.9 and tables

ww2.9 and tables

by Hedley Pinsent -
Number of replies: 3
Perhaps it it too early to address the 2.9 as it is in progress.

Tables are causing me problems.
A stripped down version of the code follows; screenshot is attached.


DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(
"PGbasicmacros.pl",
"unionTables.pl",

);



#TEXT($BEGIN_ONE_COLUMN,beginproblem()) ;

##Constructing the data table vvvvvvvvvvvvvvvvvvvvvvvvvvvvv
$table = BeginTable(spacing => 3,border=>1, tex_border=>"1pt", padding=>4);
$table .= AlignedRow(["X","Y"],align=>LEFT,separation=>0);
# $table .= AlignedRow([1,1]);
# $table .= AlignedRow([1,1]);

$table .= EndTable();

##Constructing the data table ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


BEGIN_TEXT

$table


END_TEXT


#TEXT($END_ONE_COLUMN);
ENDDOCUMENT(); # This should be the last executable line in the problem.


Attachment Tables.png
In reply to Hedley Pinsent

Re: ww2.9 and tables

by Davide Cervone -
This appears to be a result of some recent changes in pg/macros/unionTables.pl that haven't seen too much use in the wild yet. It looks to me like the $r on line 257 should be a $c. Try changing that and see if it helps. You should not have to restart the server after the change, and if you don't have access to edit files in pg/macros, you can make a copy and put it in your course's templates/macros directory.
In reply to Hedley Pinsent

Re: ww2.9 and tables

by Alex Jordan -
The issues with unionTables.pl are my fault. I'll submit a fix later today if Davide hasn't beaten me to it.

If you are authoring new problems, consider using pccTables.pl instead. It is in the release candidate 2.9 branch of pg. I have not gotten around to writing documentation for the wiki for this, but the file itself has documentation about how to use it.

The main reason for using it is web accessibility. For visually disabled persons, true data tables should have all of the table structure: a caption and at least one of row headers and column headers. There is another type of "table" called a layout table where HTML tabling is used only for the arrangement of content on the screen. These types of "tables" should actually be built using div boxes to help visually disabled persons understand the important parts of what is on screen.

pccTables.pl provides DataTable() and LayoutTable() subroutines to handle the two different types.

Your table could be enacted with:

\{DataTable(
[[{data=>"X", header=>"CH"}, {data=>"Y", header=>"CH"}],
[1, 1],
[1, 1]],
allcellcss=>"border:1pt solid; padding:4pt",
caption=>"Data",
);\}

As a bonus, you can do more styling with these tables and css controls. If you wanted to get fancy, you can start doing things like:


\{DataTable(
[[{data=>"X", header=>"CH", rowcss=>"background-color:orange;"}, {data=>"Y", header=>"CH"}],
[1, 1],
[1, 1]],
allcellcss=>"border:1pt solid black; padding:4pt;",
datacss=>"color:blue;",
caption=>"Data",
);\}

There will be differences in the hard copy version from how unionTables.pl handles it. I hope to have more LaTeX packages loaded into hard copy production so that the hard copy tabling can be more robust, but this can be added retroactively.