Reputation: 31
Rigth now I have
:R:#bn:: \binom{}{}
#bn is my shortcut to create the binom
What I'd like to have is that I could type
#bn_a_b (or anything else)
and get \binom{a}{b} with each time I'm typing a,b could be different numbers or letters.
is that possible?
(Also usable for: #for x creates for x = to
next x )
Upvotes: 1
Views: 738
Reputation: 6489
You could for example make #bn
be your hotstring, and then make that hotstring trigger an Input
(docs) command like so:
:*B0:#bn::
Input, outp, L2 V
characters := StrSplit(outp)
SendInput, % "{BS 5}{Text}\binom{" characters[1] "}{" characters[2] "}"
return
*
and B0
options used for the hotstring to make it not require an ending character and not be automatically backspaced so you can see the yourself type the whole thing first.
L2
and V
options used for the input command to limit its length to two characters and make the input visible while typing.
{BS 5}
(docs1, docs2) used to send five backspaces (erase the hotstring trigger).
{Text}
(docs) used to enable the text send mode to interpret the latter curly brackets literally.
Alternatively, you could take a look at this library to create dynamic hotstrings
https://autohotkey.com/board/topic/98728-dynamic-hotstrings/
I can't speak for good it is (or isn't), haven't really used it.
Upvotes: 1