1;;; -*- Mode:LISP; Package:MACSYMA -*- 2;; 3;; This program is free software; you can redistribute it and/or 4;; modify it under the terms of the GNU General Public License as 5;; published by the Free Software Foundation; either version 2 of 6;; the License, or (at your option) any later version. 7;; 8;; This program is distributed in the hope that it will be 9;; useful, but WITHOUT ANY WARRANTY; without even the implied 10;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 11;; PURPOSE. See the GNU General Public License for more details. 12;; 13;; Comments: TeX formatting module for itensor.lisp 14;; 15 16(in-package :maxima) 17 18;; top level command the result of tex'ing the expression x. 19;; Lots of messing around here to get C-labels verbatim printed 20;; and function definitions verbatim "ground" 21 22;(defmspec $tex(l) ;; mexplabel, and optional filename 23; (let ((args (cdr l))) 24; (apply 'tex1 args))) 25(defprop $dl "\\Delta" texword) 26(defprop $divg "(\\nabla\\cdot G)" texword) 27(defprop $og "(\\Omega\\cdot G)" texword) 28(defprop $dl_1 "\\Delta^{\\star}" texword) 29(defprop $dl_c "\\Delta_{\\chi}" texword) 30(defprop $omega "\\Omega" texword) 31(defprop $om "\\Omega^{\\star}" texword) 32(defprop $dlt "\\delta" texword) 33(defprop $phi "\\Phi" texword) 34(defprop $d_t "\\frac{\\partial}{\\partial t}" texword) 35 36(defprop $kdelta "\\delta" texword) 37(defprop %kdelta "\\delta" texword) 38(defprop $icurvature "\\cal{R}" texword) 39(defprop %icurvature "\\cal{R}" texword) 40(defprop $ichr1 "\\Gamma" texword) 41(defprop %ichr1 "\\Gamma" texword) 42(defprop $ichr2 "\\Gamma" texword) 43(defprop %ichr2 "\\Gamma" texword) 44;(defprop $icc1 "c" texword) 45;(defprop %icc1 "c" texword) 46;(defprop $icc2 "c" texword) 47;(defprop %icc2 "c" texword) 48(defprop $ifc1 "\\gamma" texword) 49(defprop %ifc1 "\\gamma" texword) 50(defprop $ifc2 "\\gamma" texword) 51(defprop %ifc2 "\\gamma" texword) 52(defprop $ifb "\\lambda" texword) 53(defprop %ifb "\\lambda" texword) 54;(defprop $ifr "e" texword) 55;(defprop %ifr "e" texword) 56;(defprop $ifri "e" texword) 57;(defprop %ifri "e" texword) 58(defprop $ifg "\\nu" texword) 59(defprop $levi_civita "\\varepsilon" texword) 60(defprop %levi_civita "\\varepsilon" texword) 61 62(defun $tentex (x) (meval (list '$tex (tenreform x)))) 63 64(defun tenreform (x) 65 (cond 66 ((atom x) x) 67 ((atom (car x)) (cons (car x) (tenreform (cdr x)))) 68 ( 69 (rpobj x) 70 ( 71 (lambda (u v) (cond (v (list '(mexpt simp) u v)) (t u))) 72 ( 73 (lambda (y) 74 (cond (y (cons (cons (name x) '(simp array)) y)) (t (name x))) 75 ) 76 (append 77 (and (covi x) (list (cons '(mtimes simp) (covi x)))) 78 (and 79 (deri x) 80 (list 81 (cons 82 '(mtimes simp) 83 (append (and (not (covi x)) (deri x) '(",")) (deri x)) 84 ) 85 ) 86 ) 87 ) 88 ) 89 (and (conti x) (cons '(mtimes simp) (conti x))) 90 ) 91 ) 92 (t (cons (tenreform (car x)) (tenreform (cdr x)))) 93 ) 94) 95