[LON-CAPA-users] Help with formatting

Michael T Hamlin lon-capa-users@mail.lon-capa.org
Fri, 31 Oct 2003 07:40:47 -0500 (EST)

here's a easy-to-use solution for the decimal aligning in tables, although the
results are still somewhat ugly.

Three steps:
1) at the top of your problem import the library:


2) in your script block, collect the table data and call the generating

   # some data...
   $p1 = random(28,36,0.25);
   $p2 = $p1 + random(0.25,1.5,0.25);
   # the table entries in order...
   @data = ('age','waistline',
   # column alignments: center, decimal
   $o_calign = 'cd';
   # add one horizontal bar (LaTeX only)
   $o_hbars = ' -   ';
   # create a 2-column table
   $table = &DTable(2,@data);

3) display the table
In your problem text (or even outside of an "outtext" block) simply

I fiddled with the code for a while but couldnt improve the appearance too much
at this stage.  Here's why its ugly:
  1) most browsers (including mozilla) dont understand the HTML 4.0
specifications to do char align, which would let us keep numbers in single
columns, and
  2) my code cant produce tables with "spanning" cells, yet.
The combination of these means any header cell above the doubled column doesnt
span the doubled column, but sits above the left one only.  In fact any cell
without a decimal gets treated the same way.