Improve TeX-fold symbol substitution
This commit is contained in:
parent
46a5ffdc92
commit
1c9c8c4bfa
37
config.org
37
config.org
|
@ -1824,7 +1824,7 @@ Let's enhance ~TeX-fold-math~ a bit
|
|||
("𝑑" ("dd"))
|
||||
;; known commands
|
||||
("" ("phantom"))
|
||||
("({1}⧸{2})" ("frac"))
|
||||
("❪{1}/{2}❫" ("frac"))
|
||||
("‘{1}’" ("text"))
|
||||
;; private commands
|
||||
("|{1}|" ("abs"))
|
||||
|
@ -1833,8 +1833,16 @@ Let's enhance ~TeX-fold-math~ a bit
|
|||
("⌈{1}⌉" ("ceil"))
|
||||
("⌊{1}⌉" ("round"))
|
||||
("⭡{1}" ("vec"))
|
||||
("𝑑{1}⧸𝑑{2}" ("dv"))
|
||||
("∂{1}⧸∂{2}" ("pdv"))
|
||||
("𝑑{1}/𝑑{2}" ("dv"))
|
||||
("∂{1}/∂{2}" ("pdv"))
|
||||
;; fancification
|
||||
("{1}" ("mathrm"))
|
||||
(TeX-fold-apply-mathbf ("mathbf"))
|
||||
(TeX-fold-apply-mathcal ("mathcal"))
|
||||
(TeX-fold-apply-mathfrak ("mathfrak"))
|
||||
(TeX-fold-apply-mathbb ("mathbb"))
|
||||
(TeX-fold-apply-mathsf ("mathsf"))
|
||||
(TeX-fold-apply-mathtt ("mathtt"))
|
||||
)
|
||||
TeX-fold-macro-spec-list
|
||||
'(
|
||||
|
@ -1863,6 +1871,29 @@ Let's enhance ~TeX-fold-math~ a bit
|
|||
("⬖ {1}" ("begin"))
|
||||
("⬗ {1}" ("end"))
|
||||
))
|
||||
|
||||
(defun TeX-fold-apply-mathbf (word)
|
||||
(string-offset-roman-chars 119743 word))
|
||||
|
||||
(defun TeX-fold-apply-mathcal (word)
|
||||
(string-offset-roman-chars 119951 word))
|
||||
|
||||
(defun TeX-fold-apply-mathfrak (word)
|
||||
(string-offset-roman-chars 120003 word))
|
||||
|
||||
(defun TeX-fold-apply-mathbb (word)
|
||||
(string-offset-roman-chars 120055 word))
|
||||
|
||||
(defun TeX-fold-apply-mathsf (word)
|
||||
(string-offset-roman-chars 120159 word))
|
||||
|
||||
(defun TeX-fold-apply-mathtt (word)
|
||||
(string-offset-roman-chars 120367 word))
|
||||
|
||||
(defun string-offset-roman-chars (offset word)
|
||||
"Shift the codepoint of each charachter in WORD by OFFSET with an extra -6 shift if the letter is lowercase"
|
||||
(apply 'string
|
||||
(mapcar (lambda (c) (+ (if (>= c 97) (- c 6) c) offset)) word)))
|
||||
#+END_SRC
|
||||
|
||||
Let's just make the folding a little less manual
|
||||
|
|
Loading…
Reference in New Issue