WeBWorK Main Forum

Are there any way to write a table in PGML?

Are there any way to write a table in PGML?

by Yuncong Chen -
Number of replies: 1
I know how to do it in PG, just wondering if there is simple syntax to do it in PGML?
In reply to Yuncong Chen

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

by Alex Jordan -
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.