WeBWorK Main Forum

Are there any way to write a table in PGML?

Re: Are there any way to write a table in PGML?

by Alex Jordan -
Number of replies: 0
PGML uses [ and ] a lot for block definitions, and this seems to make it hard to use PGML with any commands that use perl array references. I typically just END_PGML, then BEGIN_TEXT, give the table commands (or use other subroutines that don't play well with PGML), then END_TEXT, and then back to BEGIN_PGML.

I'd like to promote a new addition to the pg macros library for making tables though: pccTables.pl. Right now it's only in the develop branch of the pg repository on github, but you can get it from that link. There are two subroutines for making tables here. One is for true data tables: tables with rows and columns that give information based on where a cell is in the table. The other is for layout tables: tables that are simply being used for the visual layout of say, some images, but there is no important column/row structure being used to communicate important information.

These subroutines have been written so that tables in pg problems will be more accessible. Screen readers handle data tables and layout tables differently. Screen readers make active use of header cells in data tables. It is also advised that data tables get captions. So to start making our pg problems web accessible, we should start using an approach like what is in pccTables.pl over the native table-making subroutine in PG, or the table-making subroutines in unionTables.pl.

There is a fair amount of documentation at the head of the file pccTables.pl. I plan to add information to the wiki page too for table making when I can get a chance.