I would do it in this way (picking up from my first answer, and see at the end for insertion of latex-style commands):
-
Figure out what TeXmacs expression corresponds to \quad
-
Make a shortcut for that
In order to do point 1., I would enter \quad Return
in math, copy to TeXmacs Scheme (menu Edit->Copy To->TeXmacs Scheme
) and finally paste in a text file—so that you see the expression that you have to use in my-init-texmacs.scm
In this case, the expression is (space “1em”) and you can include it in the keyboard shortcuts as “space space” (pressing twice the space bar) as
(“space space” (insert '(space “1em”)))
It seems to me that this is the general procedure.
One needs to keep in mind the quoting symbol ’ in front of the expression that one has copied from TeXmacs and must also put a space between successive key presses that make up a sequence—for example in (“ss” (insert '(space “1em”))) “ss” would not be recognized as the sequential press of “s” and “s”.
I found out two more Scheme forms, one is helpful and one maybe
In place of (insert '(space "1em"))
one can use make-space
: for example ("space space" (make-space "1em"))
There is a make-hybrid
form as well (I found it in math-kbd.scm
), and this, I guess, is the way to insert LaTeX-style commands. I have seen that this works (as an example, in math mode):
("a r r" (begin (make-hybrid) (insert "leftarrow")))
but then you still have to press the return key.
P.S.
All of this is by guessing and experimenting starting from the descriptions in the manuals (general and Scheme developer), so there may be mistakes