[texworks] shortcuts with multiple letters

Z Br breigzach at gmail.com
Wed Mar 15 05:28:42 CET 2017


Thanks Alain!

Unfortunately I am not much of a programmer and so I am unsure how to
modify the script you posted to get the action I had asked about. Could you
give a bit more direction, or if someone else knows if this is possible
with the short cuts file that would be great too.

ZB

On Tue, Mar 14, 2017 at 1:32 PM, Alain Delmotte <
alain.delmotte at leliseron.org> wrote:

> Hi,
>
> I don't think that it is possible with a shortcut*, but you could have a
> script to do that, like this one:
>
> ================================ chapter.lua
> --[[TeXworksScript
> Title: d: chapter \c&hapter
> Description: Encloses the current selection in \chapter{}
> Author: Alain Delmotte from Stefan Löffler & Jonathan Kew
> Version: 0.1
> Date: 2011-11-01
> Script-Type: standalone
> Context: TeXDocument
> Shortcut: Alt+W, Alt+&
> ]]
>
> txt = TW.target.selection
> if (txt == nil) then txt = "" end
> TW.target.insertText("\\chapter{" .. txt .. "}")
> TW.target.selectRange(TW.target.selectionStart - string.len(txt) - 1,
> string.len(txt))
> ============================
>
> To create a \chapter{xyz} instruction I type "xyz", select this and type
> Alt+W& (the key where is "1", but on my belgian keyboard it has & as lower
> case). If I selct nothing I just have \chapter{}.
>
> You have to put the script file in the scripts folder.
>
> Regards,
>
> Alain
> * to be confirmed by the specialists
>
>
> Le 14/03/2017 à 14:15, Z Br a écrit :
>
> Hi:
>
> I am using a shortcuts.ini file to create some custom shortcuts. I would
> like to have shortcuts which involve multiple letters, e.g. the familiar
> Alt+F+S to save the file. But when I include lines like this in
> shortcuts.ini,
> actionSave = Alt+F+S
> they do not work (literally nothing happens). Shortcuts with just one
> letter like
> actionSave = Alt+S
> do work.
>
> Is there a way to create shortcuts with multiple letters?
>
> Regards,
> Zach
>
>
> My setup:
> Win7 Enterprise x64
> TexWorks 0.6.1
>
>
>
>
> ------------------------------
> [image: Avast logo] <https://www.avast.com/antivirus>
>
> L'absence de virus dans ce courrier électronique a été vérifiée par le
> logiciel antivirus Avast.
> www.avast.com <https://www.avast.com/antivirus>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20170314/0a2a92ff/attachment.html>


More information about the texworks mailing list