;;; math-symbol-lists.el --- Lists of Unicode math symbols and latex commands
;;
-;; Copyright (C) 2014 Free Software Foundation, Inc.
-;; Author: Vitalie Spinu
+;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Author: Vitalie Spinu <spinuvit@gmail.com>
;; URL: https://github.com/vspinu/math-symbol-lists
;; Keywords: Unicode, symbols, mathematics
- ;; Version: 1.0
+ ;; Version: 1.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
"width" "year")
"List of the latex commands.")
+ \f
+ ;; IMPORT UTILITIES
+
+ (defun msl--read-LUCR-list (file &optional print)
+ "Read in LUCR list from [1] and optionally PRINT.
+ LUCR list is a super-set of unicode-math list [2]. FILE is a
+ local file from [3].
+
+ [1] http://milde.users.sourceforge.net/LUCR/Math/
+ [2] https://github.com/wspr/unicode-math/blob/master/unicode-math-table.tex
+ [3] http://milde.users.sourceforge.net/LUCR/Math/data/unimathsymbols.txt
+ "
+ (let* ((lines (with-temp-buffer
+ (insert-file-contents file)
+ (split-string (buffer-string) "\n" t)))
+ (symb (cl-loop for l in lines
+ unless (string-match-p "^#" l)
+ for words = (split-string l "\\^")
+ if (> (length (nth 3 words)) 0)
+ collect (list (nth 5 words) (nth 3 words) (nth 0 words) (substring (nth 1 words) -1))
+ ;; if (and (> (length (nth 3 words)) 0)
+ ;; (not (string= (nth 2 words) (nth 3 words))))
+ ;; collect (list (nth 5 words) (nth 2 words) (nth 0 words) (substring (nth 1 words) -1))
+ ))
+ (symb (cl-sort symb (lambda (a b) (string-lessp (concat (car a) (cadr a)) (concat (car b) (cadr b)))))))
+ (if print
+ (let ((out-buff (get-buffer-create "*symbol-list*")))
+ (with-current-buffer out-buff
+ (erase-buffer)
+ (insert "(")
+ (dolist (w symb)
+ (insert (apply 'format "(\"%s\" \"\\%s\" #X%s \"%s\")\n" w )))
+ (insert ")")
+ (goto-char (point-min)))
+ (switch-to-buffer out-buff))
+ symb)))
+
(provide 'math-symbol-lists)
+;;; math-symbol-lists.el ends here