|
From: <ap...@us...> - 2025-12-11 06:53:27
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Maxima CAS".
The branch, master has been updated
via f350ddd019079b69da22d3df4691392003f0e34d (commit)
from ee369a0f5d1a40bb26a0dc80b6ce3de0475cd469 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f350ddd019079b69da22d3df4691392003f0e34d
Author: Robert Dodier <rob...@so...>
Date: Wed Dec 10 22:52:58 2025 -0800
New flag display_matrix_padding_horizontal to control between-columns padding for matrix display.
Default value is true (spaces between columns and a space
before the first column and after the last column).
When false, omit spaces between, before, and after;
columns are adjacent.
This commit includes a reference manual item and
some examples in tests/test_matrix_display.mac.
diff --git a/doc/info/Matrices.texi.m4 b/doc/info/Matrices.texi.m4
index b30582984..08b7cebda 100644
--- a/doc/info/Matrices.texi.m4
+++ b/doc/info/Matrices.texi.m4
@@ -1622,6 +1622,67 @@ only the matrix elements are displayed.
@end deffn
+@c -----------------------------------------------------------------------------
+@anchor{display_matrix_padding_horizontal}
+@deffn {Option variable} display_matrix_padding_horizontal
+Default value: @code{true}
+
+When @code{display_matrix_padding_horizontal} is @code{true},
+matrices are displayed with spaces between successive columns,
+and a space before the first column and a space after the last column.
+
+When @code{display_matrix_padding_horizontal} is @code{false},
+matrices are not displayed with spaces between successive columns,
+and no space before the first column and no space after the last column.
+Successive columns are immediately adjacent to each other,
+and the first column is immediately adjacent to the left bracket,
+and the last column is immediately adjacent to the right bracket,
+if the brackets are present (see @mref{display_matrix_brackets}).
+
+See also @mrefdot{display_matrix_padding_vertical}
+
+Examples:
+
+@c ===beg===
+@c display_matrix_padding_horizontal;
+@c foo: matrix ([a, b, c], [d, e, f], [g, h, i]);
+@c display_matrix_padding_horizontal: false;
+@c foo;
+@c ===end===
+@example maxima
+@group
+(%i1) display_matrix_padding_horizontal;
+(%o1) true
+(%i2) foo: matrix ([a, b, c], [d, e, f], [g, h, i]);
+ ┌ ┐
+ │ a b c │
+ │ │
+(%o2) │ d e f │
+ │ │
+ │ g h i │
+ └ ┘
+@end group
+@group
+(%i3) display_matrix_padding_horizontal: false;
+(%o3) false
+(%i4) foo;
+ ┌ ┐
+ │abc│
+ │ │
+(%o4) │def│
+ │ │
+ │ghi│
+ └ ┘
+@end group
+@end example
+
+@opencatbox{Categories:}
+@category{Matrices}
+@category{Display flags and variables}
+@closecatbox
+
+@end deffn
+
@c -----------------------------------------------------------------------------
@anchor{display_matrix_padding_vertical}
@deffn {Option variable} display_matrix_padding_vertical
@@ -1634,6 +1695,8 @@ When @code{display_matrix_padding_vertical} is @code{false},
matrices are not displayed with an empty line between successive rows;
successive rows are immediately adjacent to each other.
+See also @mrefdot{display_matrix_padding_horizontal}
+
Examples:
@c ===beg===
diff --git a/src/displa.lisp b/src/displa.lisp
index 10b7bdf73..f3e2ddfe2 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -1202,6 +1202,7 @@
(defmvar $display_matrix_brackets t)
(defmvar $display_matrix_padding_vertical t)
+(defmvar $display_matrix_padding_horizontal t)
(defun dim-$matrix (form result)
(prog (dmstr rstr cstr consp cols)
@@ -1221,7 +1222,7 @@
(do ((r (cdr form) (cdr r)) (h1 0) (d1 0))
((or consp (null r))
(setq width 0)
- (do ((cs cstr (cdr cs))) ((null cs)) (setq width (+ 2 (car cs) width)))
+ (do ((cs cstr (cdr cs))) ((null cs)) (setq width (+ (if $display_matrix_padding_horizontal 2 0) (car cs) width)))
(if (display2d-unicode-enabled)
(setq h1 (1+ (+ h1 d1)) depth (truncate h1 2) height (- h1 depth))
(setq h1 (1- (+ h1 d1)) depth (truncate h1 2) height (- h1 depth))))
@@ -1245,7 +1246,7 @@
(defun matout (dmstr cstr rstr result)
(when $display_matrix_brackets (push `(d-matrix left ,height ,depth) result))
- (push #\space result)
+ (when $display_matrix_padding_horizontal (push #\space result))
(do ((d dmstr (cdr d)) (c cstr (cdr c)) (w 0 0))
((null d))
(do ((d (car d) (cdr d)) (r rstr (cdr r))) ((null d))
@@ -1253,7 +1254,7 @@
(rplaca (cdar d) (- (truncate (- (car c) (caar d)) 2) w))
(setq w (truncate (+ (car c) (caar d)) 2))
(rplaca d (cdar d)))
- (setq result (cons (list (+ 2 (- (car c) w)) 0) (nreconc (car d) result))))
+ (setq result (cons (list (+ (if $display_matrix_padding_horizontal 2 (if (cdr c) 0 1)) (- (car c) w)) 0) (nreconc (car d) result))))
(if $display_matrix_brackets
(setq width (+ 2 width))
(when $display2d_unicode
-----------------------------------------------------------------------
Summary of changes:
doc/info/Matrices.texi.m4 | 63 +++++++++++++++++++++++++++++++++++++++++++++++
src/displa.lisp | 7 +++---
2 files changed, 67 insertions(+), 3 deletions(-)
hooks/post-receive
--
Maxima CAS
|