Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Insert code snippet via keyboard shortcut in TeXworks

I know there already are questions (1, 2) on creating keyboard shortcuts in TeXworks. The discussion (also in the Google thread referred to), however, seems a little outdated.

By now, there is the possibility to create keyboard shortcuts via the shortcuts.ini file (link) as well as keywords via adding a .txt file to the completion folder (link, p.23).

What I am trying to achieve is: create a keyboard shortcut (say, ctrl+shift+v) which inserts a code snippet such as \vec{#INS#}• (which would insert the snippet \vec{}, move the cursor to #INS# and add a placeholder at ).

While the first part (create a keyboard shortcut for some command) as well as the second one (create a keyword which expands to the full snippet) can be carried out separately, I can't get the combination to work - I only figured how to add shortcuts for commands listed at the bottom of this explanation.

Any help on how to perform the desired task would be appreciated. If my question is not clear, please let me know.

  • 1.7k
  • 3
  • 19
  • 32