Warning, /education/cantor/src/backends/maxima/cantor-initmaxima.lisp is written in an unsupported language. File is not indexed.
0001 ;;this file is partially based on similar files from the WxMaxima and Texmacs projects 0002 0003 (in-package :maxima) 0004 #+clisp (defvar *old-suppress-check-redefinition* 0005 custom:*suppress-check-redefinition*) 0006 #+clisp (setf custom:*suppress-check-redefinition* t) 0007 (setf *alt-display2d* 'cantor-latex-print) 0008 (setf *alt-display1d* 'cantor-regular-print) 0009 (setf *prompt-prefix* "<cantor-prompt>") 0010 ;;the newline at the end of the next line is needed, as we otherwise might run into 0011 ;;weird issues with KPtyProcess caching the line of the prompt, and sending it twice 0012 ;;to readStdOut() 0013 (setf *prompt-suffix* "</cantor-prompt> 0014 ") 0015 ;(setf *general-display-prefix* "DISPLAY_PREFIX") 0016 (setf *maxima-prolog* "Hello World") 0017 (setf *maxima-epilog* "Bye!") 0018 0019 (setf $display2d nil) 0020 0021 ;#-gcl(setf *debug-io* (make-two-way-stream *standard-input* *standard-output*)) 0022 ;#+(or cmu sbcl scl) 0023 ;(setf *terminal-io* (make-two-way-stream *standard-input* *standard-output*)) 0024 0025 ;; Small changes to mactex.lisp for interfacing with TeXmacs 0026 ;; Andrey Grozin, 2001-2006 0027 0028 ;(defun main-prompt () 0029 ; (format () "~A(~A~D) ~A" *prompt-prefix* 0030 ; (tex-stripdollar $inchar) $linenum *prompt-suffix*)) 0031 0032 (declare-top 0033 (special lop rop ccol $gcprint $inchar) 0034 (*expr tex-lbp tex-rbp)) 0035 (defconstant texport *standard-output*) 0036 0037 (defun tex-stripdollar (x) 0038 (let ((s (quote-% (maybe-invert-string-case (symbol-name (stripdollar x)))))) 0039 (if (> (length s) 1) 0040 (concatenate 'string "\\mathrm{" s "}") 0041 s))) 0042 0043 (defprop mtimes ("\\*") texsym) 0044 0045 0046 (defun cantor-latex-print (x) 0047 (princ "<cantor-result>") 0048 (princ "<cantor-text>") 0049 (linear-displa x ) 0050 (princ "</cantor-text>") 0051 0052 (let ((ccol 1)) 0053 (mapc #'princ 0054 (tex x '("<cantor-latex>") '("</cantor-latex>") 'mparen 'mparen))) 0055 0056 (princ "</cantor-result>") 0057 ) 0058 0059 (defun cantor-regular-print (x) 0060 (princ "<cantor-result>") 0061 (princ "<cantor-text>") 0062 (linear-displa x) 0063 (princ "</cantor-text>") 0064 (princ "</cantor-result>") 0065 ) 0066 0067 (defun cantor-inspect (var) 0068 ($disp var) 0069 (mapc #'(lambda (x) 0070 ($disp (eval x)) 0071 ($disp "-cantor-value-separator-") 0072 ) 0073 (cdr var) 0074 ) 0075 ) 0076 0077 ;; Fix bug with maxima tex output, LaTeX and amsmath, until Maxima team don't solve it 0078 ;; More info: https://sourceforge.net/p/maxima/bugs/3432/ 0079 (defun tex-matrix(x l r) 0080 (append l `("\\begin{pmatrix}") 0081 (mapcan #'(lambda(y) 0082 (tex-list (cdr y) nil (list "\\\\ ") "&")) 0083 (cdr x)) 0084 '("\\end{pmatrix}") r)) 0085 0086 #+clisp (setf custom:*suppress-check-redefinition* 0087 *old-suppress-check-redefinition*)