(defconst footnote-hebrew-numeric-regex "[אבגדהוזחטיכלמנסעפצקרשת']+") ; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") (defconst footnote-hebrew-numeric '( ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט") ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ") ("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק"))) (defun Footnote-hebrew-numeric(n) "Supports 9999 footnotes, then rolls over." (let* ((n (+ (mod n 10000) (/ n 10000))) (thousands (/ n 1000)) (hundreds (/ (mod n 1000) 100)) (tens (/ (mod n 100) 10)) (units (mod n 10)) (special (if (not (= tens 1)) nil (or (when (= units 5) "טו") (when (= units 6) "טז"))))) (concat (when (/= 0 thousands) (concat (nth (1- thousands) (nth 0 footnote-hebrew-numeric)) "'")) (when (/= 0 hundreds) (nth (1- hundreds) (nth 2 footnote-hebrew-numeric))) (if special special (concat (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew-numeric))) (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew-numeric)))))))) (add-to-list 'footnote-style-alist `(hebrew-numeric Footnote-hebrew-numeric ,footnote-hebrew-numeric-regex) t) (defconst footnote-hebrew-symbolic-regex "[אבגדהוזחטיכלמנסעפצקרשת]") (defconst footnote-hebrew-symbolic '( "א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט" "י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ" "ק" "ר" "ש" "ת")) (defun Footnote-hebrew-symbolic(n) "Only 22 elements, per the style of eg. 'פירוש שפתי חכמים על רש\"י'. Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'." (nth (mod (1- n) 22) footnote-hebrew-symbolic)) (add-to-list 'footnote-style-alist `(hebrew-symbolic Footnote-hebrew-symbolic ,footnote-hebrew-symbolic-regex) t)