I don't generally use imaxima or texmacs, but I would certainly endorse
any change that
makes these work better and doesn't break anything!
Here's another thought. Provide a Maxima format for tabular displays .
For example, here is a (LaTeX) table ...
|\begin{table}
\begin{tabular}{|l|l|}
\hline
a & c \\ \hline
b & d \\ \hline
\end{tabular}
\end{table}|
|
|
|Have the tex command in Maxima produce something like this given|
|table("|l|l|", hline , [a,c], hline, [b,d], hline)|
||
|wxmaxima, imaxima etc could mimic the display of tables as well.|
||
|Maybe a more user-friendly setup could be devised,|
|for example separating the formatting from the data, where the|
|data could be lists equivalent to "comma separated values". Or|
|the data could be in some sort of data-base. Having a|
|relational data base inside (or adjacent to) Maxima might have some|
|use. Importing real-world data into Maxima would be cute -- e.g.|
|weather, stock market numbers, geography.|
||
|RJF|
||
On 9/22/2013 7:42 AM, John Lapeyre wrote:
>
> Here is a hack to improve output in maxima, imaxima, and texmacs
>
> Currently, maxima does this:
>
> -------------
> (%i1) tex(make_array(fixnum,2));
> $$
> Maxima encountered a Lisp error:
>
> The value #(0 0) is not of type SYMBOL.
>
> Automatically continuing.
> To enable the Lisp debugger set *debugger-hook* to nil.
> -------------
>
> The same thing happens when the argument is a graph
> from the graphs package, or an array expression from the aex
> package.
>
> imaxima fails to print these for the same reason.
>
> One solution is to change tex-atom in src/mactex.lisp
> and add a function from imaxima.lisp (which may have been
> borrowed from somewhere else.):
>
> SOLUTION A
> -----------------------------------------
> edit src/mactex.lisp
> -----------------------------------------
> (defun verb-quote (str)
> (let ((var "") (charlist
> '((#\Newline . "| \\\\ \\verb| "))))
> (dotimes (i (length str))
> (let ((chari (elt str i)))
> (setq var (concatenate 'string var
> (or (cdr (assoc chari charlist :test #'eql))
> (string chari))))))
> var))
>
> (defun tex-atom (x l r) ;; atoms: note: can we lose by leaving out
> {}s ?
> (append l
> (list (cond ((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))))
> ((characterp x) (tex-char x))
> ((not ($mapatom x))
> (verb-quote ($sconcat x)))
> (t (tex-stripdollar (or (get x 'reversealias) x)))))
> r))
> -----------------------------------------
>
> This allows tex(), to print something reasonable for all
> each of the objects mentioned above. I did not test it
> carefully to see what it might break.
>
> Another solution, which only changes imaxima.lisp, is:
>
> SOLUTION B
> -----------------------------------------
> edit imaxima.lisp
> -------------------------------------------
> (defun tex-atom (x l r &aux other-case) ;; atoms: note: can we lose by
> leaving out {}s ?
> (let ((result (append l
> (list (cond ((mstringp x) (texstring x))
> ((characterp x) (texchar x))
> (t (setq other-case t))))
> r)))
> (if other-case
> (if (not ($mapatom x))
> (progn
> (setf x (list (verb-quote ($sconcat x))))
> (tex-list x l r 'mparen))
> (funcall *old-tex-atom* x l r))
> result)))
> -------------------------------------------
>
> This allows printing these objects with imaxima, but not with
> the original tex().
>
> wxmaxima has a different way of printing something, rather than an
> error with these objects. In some cases, its solution is better, and
> in some worse, than SOLUTION A, depending on the value of display2d,
> and the kind of object.
>
> I did some quick checks of SOLUTION A with different settings of
> display2d for command line, wxmaxima, imaxima, texmacs. In each case,
> either something reasonable is printed rather than an error, or there
> is no change. In other words, for the cases I tried, SOLUTION A,
> improves many cases, and worsens none. In the case of imaxima, the best
> is to combine both SOLUTION A and SOLUTION B.
>
> But, I don't claim this is bug free or near an optimal solution.
>
> -- John
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima