[texworks] Space as a hotkey

Ryszard Kubiak rhkubiak at gmail.com
Wed Apr 4 14:50:22 CEST 2012


> Hi,
>
> On 2012-03-17 08:51, Ryszard Kubiak wrote:
>> I wonder whether the space character can be used as a hotkey
>> to invoke a script. I am thinking of writing a script that
>> would on the fly replace the space character with ~, depending
>> on a surrounding context.
>
> I don't think so, but I haven't tried. Whitespaces are ignored AFAIK, so
> if at all, you should probably use "Space". But still, I don't think
> single characters are usable as shortcuts (as they are intercepted
> already by the editor).

After a few experiments I can tell now how it (probably) works.
In the shortcut line of the script one can write, for example,
Qt::Key_Space. This is transormed into the space character
which gets deleted by this code in TWScript.cpp:

  line 146: value = line.section(':', 1).trimmed();

This means that the information gets lost, which is a bit unfortunate.
A kind of extra notation for shortcut lines might help, probably.

>> A more general question would be whether TeXworks internals
>> allow the editor to be extended so that one could define
>> their own input method. For example, in Emacs many input
>> methods are defined for editing in various alpabets based
>> on just ASCII characters. Or, you think that such a feature
>> is better to be provided by external, keyboard layout tools?
>
> Following Reinhard's comment, this could be very interesting. E.g.,
> press Ctrl+G to switch to greek letters (useful for math/sciency stuff).
> It's not straight forward to implement (efficiently), though. Could you
> please add it to the issue tracker at Google Code?

Sure. It has been added as issue #571.

>
> Regards,
> Stefan

Greetings,
Ryszard


More information about the texworks mailing list