]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc-lang.el
(add-log-buffer-file-name-function): Add defvar.
[gnu-emacs] / lisp / calc / calc-lang.el
index d91d78fc46151b63dfbc63d2c23b413f2f187965..e0099ee4e076e520ff628b4f2f75b77210599132 100644 (file)
@@ -1,6 +1,7 @@
 ;;; calc-lang.el --- calc language functions
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <belanger@truman.edu>
   (calc-wrapper
    (and n (setq n (prefix-numeric-value n)))
    (calc-set-language 'tex n)
-   (message (if (and n (/= n 0))
-               (if (> n 0)
-                   "TeX language mode with \\hbox{func}(\\hbox{var})"
-                 "TeX language mode with \\func{\\hbox{var}}")
-             "TeX language mode"))))
+   (cond ((not n)
+          (message "TeX language mode"))
+         ((= n 0)
+          (message "TeX language mode with multiline matrices"))
+         ((= n 1)
+          (message "TeX language mode with \\hbox{func}(\\hbox{var})"))
+         ((> n 1)
+          (message 
+           "TeX language mode with \\hbox{func}(\\hbox{var}) and multiline matrices"))
+         ((= n -1)
+          (message "TeX language mode with \\func(\\hbox{var})"))
+         ((< n -1)
+          (message 
+           "TeX language mode with \\func(\\hbox{var}) and multiline matrices")))))
 
 (defun calc-latex-language (n)
   (interactive "P")
      ( \\arg      . calcFunc-arg )
      ( \\cos      . calcFunc-cos )
      ( \\cosh     . calcFunc-cosh )
+     ( \\cot      . calcFunc-cot )
+     ( \\coth     . calcFunc-coth )
+     ( \\csc      . calcFunc-csc )
      ( \\det      . calcFunc-det )
      ( \\exp      . calcFunc-exp )
      ( \\gcd      . calcFunc-gcd )
      ( \\log      . calcFunc-log10 )
      ( \\max      . calcFunc-max )
      ( \\min      . calcFunc-min )
-     ( \\tan      . calcFunc-tan )
+     ( \\sec      . calcFunc-sec )
      ( \\sin      . calcFunc-sin )
      ( \\sinh     . calcFunc-sinh )
      ( \\sqrt     . calcFunc-sqrt )
+     ( \\tan      . calcFunc-tan )
      ( \\tanh     . calcFunc-tanh )
      ( \\phi      . calcFunc-totient )
      ( \\mu       . calcFunc-moebius )))
 (put 'latex 'math-function-table
      (append
       (get 'tex 'math-function-table)
-      '(( \\frac      . (math-latex-parse-frac /))
-        ( \\tfrac     . (math-latex-parse-frac /))
-        ( \\dfrac     . (math-latex-parse-frac /))
-        ( \\binom     . (math-latex-parse-frac calcFunc-choose))
-        ( \\tbinom    . (math-latex-parse-frac calcFunc-choose))
-        ( \\dbinom    . (math-latex-parse-frac calcFunc-choose))
+      '(( \\frac      . (math-latex-parse-frac))
+        ( \\tfrac     . (math-latex-parse-frac))
+        ( \\dfrac     . (math-latex-parse-frac))
+        ( \\binom     . (math-latex-parse-two-args calcFunc-choose))
+        ( \\tbinom    . (math-latex-parse-two-args calcFunc-choose))
+        ( \\dbinom    . (math-latex-parse-two-args calcFunc-choose))
         ( \\phi              . calcFunc-totient )
         ( \\mu       . calcFunc-moebius ))))
 
 
 (put 'latex 'math-complex-format 'i)
 
+
 (defun math-latex-parse-frac (f val)
   (let (numer denom)
-    (setq args (math-read-expr-list))
+    (setq numer (car (math-read-expr-list)))
+    (math-read-token)
+    (setq denom (math-read-factor))
+    (if (and (Math-num-integerp numer)
+             (Math-num-integerp denom))
+        (list 'frac numer denom)
+      (list '/ numer denom))))
+
+(defun math-latex-parse-two-args (f val)
+  (let (first second)
+    (setq first (car (math-read-expr-list)))
     (math-read-token)
-    (setq margs (math-read-factor))
-    (list (nth 2 f) (car args) margs)))
+    (setq second (math-read-factor))
+    (list (nth 2 f) first second)))
 
 (defun math-latex-print-frac (a fn)
   (list 'horiz (nth 1 fn) "{" (math-compose-expr (nth 1 a) -1)
      ( Conjugate   . calcFunc-conj )
      ( Cos        . calcFunc-cos )
      ( Cosh       . calcFunc-cosh )
+     ( Cot        . calcFunc-cot )
+     ( Coth       . calcFunc-coth )
+     ( Csc        . calcFunc-csc )
+     ( Csch       . calcFunc-csch )
      ( D          . calcFunc-deriv )
      ( Dt         . calcFunc-tderiv )
      ( Det        . calcFunc-det )
      ( Random     . calcFunc-random )
      ( Round      . calcFunc-round )
      ( Re         . calcFunc-re )
+     ( Sec        . calcFunc-sec )
+     ( Sech       . calcFunc-sech )
      ( Sign       . calcFunc-sign )
      ( Sin        . calcFunc-sin )
      ( Sinh       . calcFunc-sinh )