Hey,

I have pushed some more work on the new LaTeX class. This commit brings
the infrastructure into place to support proper tabular layouts for
questions that are supposed to be laid out in a matrix.

You can see some the features in test.pdf on the first page. Notice the
following:
 * The label on the left wraps correctly.
 * The column headers are rotated (this will be optional), and there is
   space inserted at the right so that they do not hang out of the
   content area.
 * The columns in all three tables are aligned to each other.

Note that this code assumes that the column headers and cells have a
fixed width. Only the width of the row label is allocated dynamically
to fill the rest of the available space.

As always, the code is pushed into the "sdaps-class" repository on
github. It should be possible to use this class with the "variables"
branch of SDAPS, but I have not tested this for a long time now.

The implementation is in sdapslayout.dtx:
  https://github.com/sdaps/sdaps-class/blob/master/sdapslayout.dtx

I think that this is a big step towards getting the new LaTeX class
working.

---

Some of the implementation details (requires a deeper understanding of
plain TeX).
What the code does is that it lays out each row as a single line. Now
there are two requirements for this:
 * Number of cells may be dynamic
 * The code in each cell should only be expanded once

Because of these requirement the class first expands each cell using a
customizable macro. This macro places the content into a box and may do
a few more actions (e.g. rotate the label and calculate the overlap
with the previous/next row).
The result for all cells is then stored inside an hbox. After this we
have the following information:
 * hbox containing a box for each cell
 * the row label
 * updated global variables for the overlaps

This is passed to another (customizable) macro which then generates a
box to be put into the global vbox of the page. For this the macro
unpacks the hbox into a new hbox and then pops each cell from it. This
happens from back to front, and while doing this it measures the size
of the cell, updates the maximum width information for the column and
places it into a new box (coffin actually) with correct inter column
spacing and width.
Afterwards the remaining space for the "row label" can be calculated
and the final line is laid out.


The code to replace the implementation with customized functions is
still missing. This is mainly to allow LTR/RTL layouts and for users to
choose different sizing options and column header layouts.

Also missing is row/column colouring and insertion of grid lines. This
requires completely custom code as this environment has no resemblance
with a normal "tabular" environment.

Benjamin

Attachment: test.pdf
Description: Adobe PDF document

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to