|
From: Robert D. <rob...@gm...> - 2025-10-12 17:27:25
|
I've taken the liberty of extending the display flags for matrix,
determinant, and box expressions. See commits 99a826..66001d on master.
For matrix(...), display_matrix_brackets (default true) governs whether
brackets are placed on either side of a matrix. Otherwise the matrix
elements are displayed without brackets. This flag has the expected effect
when display2d_unicode = true and display2d_unicode = false.
For determinant(...), display_determinant_bars (default true) governs
whether vertical bars are placed on either side of the matrix in an
expression 'determinant(matrix(...)) . Otherwise the expression is
displayed as an ordinary function call, as it is now. This flag has the
expected effect when display2d_unicode = true and display2d_unicode = false.
For box(...), display_box_double_lines (default true) governs whether
box(...) expressions are drawn with double-line Unicode characters, as they
are now, or single-line Unicode characters.This flag has an effect only
when display2d_unicode = true. I guess I could have imagined something
sensible to do when display2d_unicode = false for the sake of consistency
... I might still do that.
I only worked on the 2-d pretty printer -- I didn't try to update any other
displays such as tex(...) output.
Here is a tiny demo. See rtest_unicode_display.mac and
test_matrix_display.mac in the tests folder for additional examples.
(%i2) foo: matrix ([a, b, c], [d, e, f], [g, h, i]);
┌ ┐
│ a b c │
│ │
(%o2) │ d e f │
│ │
│ g h i │
└ ┘
(%i3) 'determinant (foo);
│ a b c │
│ │
(%o3) │ d e f │
│ │
│ g h i │
(%i4) box (%o2);
╔═══════════╗
║┌ ┐║
║│ a b c │║
║│ │║
(%o4) ║│ d e f │║
║│ │║
║│ g h i │║
║└ ┘║
╚═══════════╝
(%i5) display_matrix_brackets: false $
(%i6) foo;
a b c
(%o6) d e f
g h i
(%i7) display_box_double_lines: false $
(%i8) %o4;
┌─────────┐
│ a b c │
│ │
(%o8) │ d e f │
│ │
│ g h i │
└─────────┘
This 2-d Unicode stuff looks pretty bad in the Gmail composer, as
the vertical characters don't join up. It looks much better in a terminal,
where the vertical characters abut one another. I hope that what you see is
more like the latter than the former.
Hope this helps in some way.
Robert
|