At 2023-06-28T12:21:47+1000, Damian McGuckin wrote: > It has been said by someone more knowledgable than I that: > > A critical property of the 'matrix' construct is that elements in > a row are aligned, which is not necessarily true in a sequence of > piles.
That is consistently with my recently acquired understanding. > I am not convinced that EQN does this very well currently. Apparently not. > See the attached. When I have two entries in the same row, one > > 0 > > and the other a term like > > { partial x } over { partial r } > > which have a big height difference, they are poorly spaced vertically. > > See my example matrix A (both troff & PDF) for the problem matrix. > > The matrix B is better aligned but I had to seriously mess with fake > (unpadded space) subscripts and superscripts to achieve this. > > The example C tries to imitate the spacing [that] is expected in A. Yes. I think your complaints are well founded. > It is the same with either -ms or -mm. I don't expect the choice of macro package to matter at all. At most, they seem to use EQ/EN macros to "set up a display" (break the line and add some vertical space) and, sometimes, alter the indentation to permit centering or right-alignment of the equation. At my present level of knowledge, I have no reason to expect a macro package to ever alter anything within the "box" of an equation. > Is this urgent? Probably not. Yeah, TeX has been sucking up our oxygen for 40 years, what's one more groff release cycle? ;-) I feel like I'll have to learn a lot more about GNU eqn internals before I have any hope of tackling this one. On the bright side I have no reason to suspect it can't be solved with only moderate effort. I _believe_ GNU eqn builds the entire equation using TeX's "boxes and glue" approach before emitting any troff output, which suggests to me that a traversable data structure exists before output is produced, which can be iterated over and to which vertical spacing/alignment adjustments can be made. Someone truly familiar with GNU eqn internals could, I reckon, sketch a solution without much effort. Then it's down to a simple matter of programming. I tried your example on Heirloom Doctools and DWB 3.3. The latter, a pretty authentic eqn as these things go, I think, gets frustrated. ./bin/troff: Word overflow.; line 419, file matrix.ms stack: 10 Its vertical alignments are more what you would expect, better than GNU eqn's, but it botches the horizontal alignment of vector C. Also, the square bracket pieces don't align. Heirloom keeps the good layouts of A and B, but also the bracket alignment problem. It emits no diagnostics and lacks the horizontal botch, but I find its rendering of vector C to be excessively crowded vertically. See attachments. Regards, Branden
matrix-dwb.ps
Description: PostScript document
matrix-heirloom.ps
Description: PostScript document
signature.asc
Description: PGP signature