summaryrefslogtreecommitdiff
path: root/macros/generic/youngtab/youngtab.el
blob: 458049e8e2f201abcba3e10a6954f92f1c73ef18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;;; youngtab.el - Support for the user macros of the youngtab package
;; by Volker B"orchers, <boercher@physik.uni-bremen.de>
;; This program can be redistributed and/or modified under the terms
;; of the LaTeX Project Public License Distributed from CTAN
;; archives in directory macros/latex/base/lppl.txt; either
;; version 1 of the License, or any later version.

;;-((and (not( = elisp favorite-language)) (concat "lucky" "it" "works" (!))))
 
(TeX-add-style-hook "youngtab"
 (function
  (lambda ()
    (TeX-add-symbols
     '("Yboxdim" "Box Dimension")
     '("Ylinethick" "Line Thickness")
     '("Yinterspace" "Space between 2 Tableaux")
     '("Yvcentermath" TeX-arg-young-bool)
     '("Ystdtext" TeX-arg-young-bool)
     '("yng" (TeX-arg-young t))
     '("young" TeX-arg-young)
     ))))

(defun TeX-arg-young (optional &optional isyng)
  "Insert macros young and yng.
Ask for the rows of a tableau.
Do not accept non-numbers for yng."
  (let ((num 0))
    (insert "(")
    (while (>= num 0)
      (setq num (1+ num))
      (setq row (read-input (concat (int-to-string num) ". Row: ")))
      (if (zerop (length row))
	  (setq num -1)
	(if (and isyng (<= (string-to-int row) 0))
	    (setq num (- num 1))
	  (insert (if (> num 1) "," "") row)))))
    (insert ")"))

(defun TeX-arg-young-bool (optional)
  "To handle the switches Yvcentermath and Ystdtext"
  (insert (if (y-or-n-p "true(y) or false(n)? ") "1" "0")))