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 mathmode, 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
.
(kbdmap
(:mode inmath?)
(:require (not (invariantsdisabled?)))
("d i" (mathinsert '(concat "<partial>" (rsub "i")))))
Alternative solution could also be
(kbdmap
(:mode inmath?)
("d i" (mathinsert '(concat "<partial>" (rsub "i")))))
(kbdmap
(:mode invariantsdisabled?)
("d i" "di"))
Figure
Reference of TeXmacs code:

progs/kernel/texmacs/tmmodes.scm
, Seetexmacsmodes
. 
progs/kernel/gui/kbddefine.scm
, See the definitions ofkbdaddcondition
,kbdmapone
,kbdmapbody
andkbdmap