|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file:
;; http://anggtwu.net/myqdraw/myqdraw-tex.lisp.html
;; http://anggtwu.net/myqdraw/myqdraw-tex.lisp
;; (find-angg "myqdraw/myqdraw-tex.lisp")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;
;; This file is loaded by:
;; (find-myqdraw "myqdraw3.mac")
;; It removes some TeX-isms from how "matrix"es and "/"s are TeXed,
;; and makes them more LaTeX-friendly.
;; Compare with:
;; (find-maximagitfile "src/mactex.lisp" "(defprop mquotient tex-mquotient tex)")
;; (find-maximagitfile "src/mactex.lisp" "(defprop $matrix tex-matrix tex)")
;; (find-maximagitfile "src/mactex.lisp" "(defun tex-mquotient ")
;; (find-maximagitfile "src/mactex.lisp" "(defun tex-mquotient " "\\over")
;; (find-maximagitfile "src/mactex.lisp" "(defun tex-matrix")
;; (find-maximagitfile "src/mactex.lisp" "(defun tex-matrix" "\\ifx")
;;
;; «.quotient-and-matrix» (to "quotient-and-matrix")
;; «.includegraphics» (to "includegraphics")
;; «quotient-and-matrix» (to ".quotient-and-matrix")
;; Here we just redefine `tex-mquotient' and `tex-matrix' to remove
;; some TeXisms and to make them use pure LaTeX - we don't need to run
;; their `defprop's again.
;;
(defun tex-mquotient (x l r)
(twoargcheck x)
(setq l (tex (cadr x) (append l '("{\\frac{")) nil 'mparen 'mparen)
r (tex (caddr x) (list "}{") (append '("}}") r) 'mparen 'mparen))
(append l r))
(defun tex-matrix (x l r)
(append l `("\\begin{pmatrix}")
(mapcan #'(lambda (y)
(tex-list (cdr y) nil (list "\\cr ") "&"))
(cdr x))
'("\\end{pmatrix}") r))
;; «includegraphics» (to ".includegraphics")
;; `includegraphics' is new - it needs a `defprop'.
;;
(defprop $includegraphics tex-includegraphics tex)
(defun tex-includegraphics (x l r)
`(,@l ,(format nil "\\myvcenter{\\includegraphics[~a]{~a}}" (cadr x) (caddr x)) ,@r))
#|
* (eepitch-sly)
* (eepitch-kill)
* (eepitch-sly)
*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("startsly");
*
* (sly-connect "localhost" 56789)
* (eepitch-sly)
* (eepitch-maxima)
load_myqdraw();
load("myqdraw-tex.lisp");
ig : includegraphics("height=5cm", "foo_bar.pdf");
tex1(ig);
to_lisp();
(princ 23)
(princ 23 45)
(to-maxima)
M : matrix([2,3],[4,5]);
tex1(M);
(tex-matrix #$M$ nil nil)
($tex1 #$M$)
* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)
(load "myqdraw-tex.lisp")
|#