When you are in math mode, for example equation
, align
, eqnarray
, very often you want to label
the equation or one of the equations for later reference in the article or document, there is a chance that you triggered a keybinding when you are in label
. My case is as follows:
In math-mode, I bind d i
to the math formula \partial_i (in terms of Tex, \partial_{i}
). For me it is extremely useful. Say I want to label the equation differential
. When there was no third line of the below code, \partial_i will be popping up in label
.
(kbd-map
(:mode in-math?)
(:require (not (in-variants-disabled?)))
("d i" (math-insert '(concat "<partial>" (rsub "i")))))
Alternative solution could also be
(kbd-map
(:mode in-math?)
("d i" (math-insert '(concat "<partial>" (rsub "i")))))
(kbd-map
(:mode in-variants-disabled?)
("d i" "di"))
Figure
Reference of TeXmacs code:
-
progs/kernel/texmacs/tm-modes.scm
, Seetexmacs-modes
. -
progs/kernel/gui/kbd-define.scm
, See the definitions ofkbd-add-condition
,kbd-map-one
,kbd-map-body
andkbd-map