[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] Patch 1168
From: |
Nix N. Nix |
Subject: |
[Texmacs-dev] Patch 1168 |
Date: |
27 Feb 2003 01:00:35 -0700 |
Hi!
Please drop Patch #1168 from savannah. I have submitted a new one,
which makes use of David's new table library. The new one is 1189.
Wow ! Very elegantly done. The new library made it easy to both add new
functionality to it, as well as use it in tmtex.
Here's a summary:
1. I added 2 new vectors to tmtable-parser:
cols-border
rows-border
as well as the size of rows-border, nrrows.
The size of each of these is equal to the number of columns/rows,
respectively. Each entry contains a tuple (a b), where a is a boolean,
indicating whether the column has a left margin, and b is also a
boolean, indicating whether the column has a right margin. rows-border
has the same structure for top and bottom margins, respectively.
2. I modified parse-tformat-item to update the 2 new vectors upon
encountering a "cell [lrtb]border". I mean, simply setting a global
"yes, this table has borders" flag and then drawing /all/ borders is not
only simplistic, but in many cases ugly - imagine an augmented matrix !
Unfortunately, taking care of borders has introduced an ugly
complication: For table-wide operations (i.e., ... 1 -1 1 -1 ...), the
number n (simply set to nrcols before the modification) must be set to
either nrrows or nrcols, depending on whether the string var refers to a
row operation or a column operation, because, subsequently, the borders
must be applied to the correct one of the border-vectors, to /all/
entries in /that/ vector. Maybe you can think of a more elegant way of
doing this.
3. I added switches to the accessors of scope 'rows and 'cols to return
these vectors via vector->list, so tmtex may take advantage of this new
information.
4. I modified tmtex-table-args to insert "|" only where the borders
specify, and tmtex-table-make to insert ('hline) entries only where the
borders specify, and not everywhere.
For the above two, I took the (let rec ... and turned it into a new
function, because now it has to do a lot more than just append or not
append single entries (and because I couldn't quite wrap my head around
the syntax - especially to add a new parameter). It has to also check
the truth values contained in the lists returned from tmtable-parser,
and basically interlace the border entries with the row entries in one
case, and with the column alignment specifiers in the other case.
Since we're dealing now with a table library, I tried to keep the data
representation in the table library entirely non-LaTeX-specific - hence
my choice of (a b), versus, for example, what I had in the previous
patch, which was a vector of size 1 + number_of_columns, so I could
store the "|"s directly and literally interlace them with the horizontal
alignment specifiers.
Well, I hope I didn't botch things up too-too badly. I mean, the result
looks pretty neat: ftp://go-nix.ca/incoming/nix1.pdf .
Thanks for your patience !
- [Texmacs-dev] Patch 1168,
Nix N. Nix <=