Dear all,
I have encountered a bug in tex() when passed a lisp array created
using make_array(). The following session is obtained using 5.24.0
with closure common lisp. (This bug occurs with CMUCL and SBCL
as well).
(%i2) b:make_array(any,3);
(%o2) ?\#\(NIL\ NIL\ NIL\)
(%i3) tex(b);
$$
Maxima encountered a Lisp error:
value #(NIL NIL NIL) is not of the expected type SYMBOL.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i4)
This is due to the fact that the function tex-atom in mactex.lisp is not
prepared to accept a lisp array as its argument.
The fix should be not complex. The following is a possible fix of
tex-atom function.
% git diff mactex.lisp
diff --git a/src/mactex.lisp b/src/mactex.lisp
index df0ee41..466605f 100644
--- a/src/mactex.lisp
+++ b/src/mactex.lisp
@@ -246,9 +246,13 @@
((get (caar x) 'tex) (funcall (get (caar x) 'tex) x l r))
(t (tex-function x l r nil))))
+(defvar *LispArray-string* "\\left| Lisp Array ~D \\right|")
+
(defun tex-atom (x l r) ;; atoms: note: can we lose by leaving out
{}s ?
(append l
- (list (cond ((numberp x) (texnumformat x))
+ (list (cond ((arrayp x)
+ (tex-string (format nil *LispArray-string*
(array-total-size x))))
+ ((numberp x) (texnumformat x))
((and (symbolp x) (or (get x 'texword) (get (get x
'reversealias) 'texword))))
((stringp x)
(tex-string (quote-% (if $stringdisp (concatenate
'string "``" x "''") x))))
If everyone is OK, I would like to commit above changes to the git
repository.
Any feedback is welcome.
Thanks and best regards,
Yasuaki Honda, Japan