comparison lisp/calc/calc-lang.el @ 108590:c84578d13e42

calc-aent.el (math-read-token, math-find-user-tokens): calc-lang.el (math-read-big-rec, math-lang-read-symbol) (math-compose-tex-func): calccomp.el (math-compose-expr): calc-ext.el (math-format-flat-expr-fancy): calc-store.el (calc-read-var-name): calc-units.el (calc-explain-units-rec): Allow Greek letters. calc.el (var-¦Ð, var-¦Õ, var-¦Ã): New variables. calc-aent.el (math-read-replacement-list): Add "micro" symbol. calc-units.el (math-unit-prefixes): Add mu for micro. (math-standard-units): Add units.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 14 May 2010 23:50:25 -0500
parents 1d1d5d9bd884
children d150a25a0eb9
comparison
equal deleted inserted replaced
108589:b818f9578731 108590:c84578d13e42
212 (format "%d#%s" r s))))) 212 (format "%d#%s" r s)))))
213 213
214 (put 'pascal 'math-lang-read-symbol 214 (put 'pascal 'math-lang-read-symbol
215 '((?\$ 215 '((?\$
216 (eq (string-match 216 (eq (string-match
217 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)" 217 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)"
218 math-exp-str math-exp-pos) 218 math-exp-str math-exp-pos)
219 math-exp-pos) 219 math-exp-pos)
220 (setq math-exp-token 'number 220 (setq math-exp-token 'number
221 math-expr-data (math-match-substring math-exp-str 1) 221 math-expr-data (math-match-substring math-exp-str 1)
222 math-exp-pos (match-end 1))))) 222 math-exp-pos (match-end 1)))))
310 310
311 (put 'fortran 'math-output-filter 'calc-output-case-filter) 311 (put 'fortran 'math-output-filter 'calc-output-case-filter)
312 312
313 (put 'fortran 'math-lang-read-symbol 313 (put 'fortran 'math-lang-read-symbol
314 '((?\. 314 '((?\.
315 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\." 315 (eq (string-match "\\.[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω]?\\."
316 math-exp-str math-exp-pos) math-exp-pos) 316 math-exp-str math-exp-pos) math-exp-pos)
317 (setq math-exp-token 'punc 317 (setq math-exp-token 'punc
318 math-expr-data (upcase (math-match-substring math-exp-str 0)) 318 math-expr-data (upcase (math-match-substring math-exp-str 0))
319 math-exp-pos (match-end 0))))) 319 math-exp-pos (match-end 0)))))
320 320
601 601
602 (put 'tex 'math-lang-read-symbol 602 (put 'tex 'math-lang-read-symbol
603 '((?\\ 603 '((?\\
604 (< math-exp-pos (1- (length math-exp-str))) 604 (< math-exp-pos (1- (length math-exp-str)))
605 (progn 605 (progn
606 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" 606 (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
607 math-exp-str math-exp-pos) 607 math-exp-str math-exp-pos)
608 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" 608 (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
609 math-exp-str math-exp-pos)) 609 math-exp-str math-exp-pos))
610 (setq math-exp-token 'symbol 610 (setq math-exp-token 'symbol
611 math-exp-pos (match-end 0) 611 math-exp-pos (match-end 0)
612 math-expr-data (math-restore-dashes 612 math-expr-data (math-restore-dashes
613 (math-match-substring math-exp-str 1))) 613 (math-match-substring math-exp-str 1)))
689 (if (memq (nth 1 a) '(0 2)) ")" "]"))) 689 (if (memq (nth 1 a) '(0 2)) ")" "]")))
690 690
691 (defun math-compose-tex-var (a prec) 691 (defun math-compose-tex-var (a prec)
692 (if (and calc-language-option 692 (if (and calc-language-option
693 (not (= calc-language-option 0)) 693 (not (= calc-language-option 0))
694 (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" 694 (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'"
695 (symbol-name (nth 1 a)))) 695 (symbol-name (nth 1 a))))
696 (if (eq calc-language 'latex) 696 (if (eq calc-language 'latex)
697 (format "\\text{%s}" (symbol-name (nth 1 a))) 697 (format "\\text{%s}" (symbol-name (nth 1 a)))
698 (format "\\hbox{%s}" (symbol-name (nth 1 a)))) 698 (format "\\hbox{%s}" (symbol-name (nth 1 a))))
699 (math-compose-var a))) 699 (math-compose-var a)))
700 700
701 (defun math-compose-tex-func (func a) 701 (defun math-compose-tex-func (func a)
702 (let (left right) 702 (let (left right)
703 (if (and calc-language-option 703 (if (and calc-language-option
704 (not (= calc-language-option 0)) 704 (not (= calc-language-option 0))
705 (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func)) 705 (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'" func))
706 (if (< (prefix-numeric-value calc-language-option) 0) 706 (if (< (prefix-numeric-value calc-language-option) 0)
707 (setq func (format "\\%s" func)) 707 (setq func (format "\\%s" func))
708 (setq func (if (eq calc-language 'latex) 708 (setq func (if (eq calc-language 'latex)
709 (format "\\text{%s}" func) 709 (format "\\text{%s}" func)
710 (format "\\hbox{%s}" func))))) 710 (format "\\hbox{%s}" func)))))
822 822
823 (put 'latex 'math-lang-read-symbol 823 (put 'latex 'math-lang-read-symbol
824 '((?\\ 824 '((?\\
825 (< math-exp-pos (1- (length math-exp-str))) 825 (< math-exp-pos (1- (length math-exp-str)))
826 (progn 826 (progn
827 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" 827 (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
828 math-exp-str math-exp-pos) 828 math-exp-str math-exp-pos)
829 (string-match "\\\\text *{\\([a-zA-Z0-9]+\\)}" 829 (string-match "\\\\text *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
830 math-exp-str math-exp-pos) 830 math-exp-str math-exp-pos)
831 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" 831 (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
832 math-exp-str math-exp-pos)) 832 math-exp-str math-exp-pos))
833 (setq math-exp-token 'symbol 833 (setq math-exp-token 'symbol
834 math-exp-pos (match-end 0) 834 math-exp-pos (match-end 0)
835 math-expr-data (math-restore-dashes 835 math-expr-data (math-restore-dashes
836 (math-match-substring math-exp-str 1))) 836 (math-match-substring math-exp-str 1)))
2299 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t) 2299 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
2300 (setq p (math-read-big-rec math-rb-h1 v h (1+ v) v))) 2300 (setq p (math-read-big-rec math-rb-h1 v h (1+ v) v)))
2301 2301
2302 ;; Variable name or function call. 2302 ;; Variable name or function call.
2303 ((or (and (>= other-char ?a) (<= other-char ?z)) 2303 ((or (and (>= other-char ?a) (<= other-char ?z))
2304 (and (>= other-char ?A) (<= other-char ?Z))) 2304 (and (>= other-char ?A) (<= other-char ?Z))
2305 (and (>= other-char ?α) (<= other-char ?ω))
2306 (and (>= other-char ?Α) (<= other-char ?Ω)))
2305 (setq line (nth v math-read-big-lines)) 2307 (setq line (nth v math-read-big-lines))
2306 (string-match "\\([a-zA-Z'_]+\\) *" line math-rb-h1) 2308 (string-match "\\([a-zA-Zα-ωΑ-Ω'_]+\\) *" line math-rb-h1)
2307 (setq h (match-end 1) 2309 (setq h (match-end 1)
2308 widest (match-end 0) 2310 widest (match-end 0)
2309 p (math-match-substring line 1)) 2311 p (math-match-substring line 1))
2310 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t) 2312 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
2311 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t) 2313 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)