Pascal Francq wrote:
Hi,
Does anybody know if it is possible to create macro in Lyx and how to do it ?
In practice, I want to add some shortcuts to action such as "putting the text
in red" or "the text is in English".
Thanks.
Anything you can do in LyX---any sequence of actions---can be assigned
(bound) to a key. Two ways. (i) The file that sets the bindings is just
a text file, *.bind; you can find out which one you are using in
Tools>Preferences>Editing>Shortcuts. Copy that file to your LyX user
directory, and then edit as you wish. The syntax is reasonably
straightforward. (ii) Use the Shortcuts editor in
Tools>Preferences>Editing>Shortcuts.
The only problem now is to know function what to assign. The available
functions are described in Help>LyX Functions, so you can look them up
there. But an easier way is to watch the status line when you perform
some action: LyX will usually pop up the name of the function you just
used. If you want to perform a sequence of actions, then you'll need to
use the command-sequence LFUN to do it, e.g.:
command-sequence word-select; textstyle-update color 3
That selects the current word and makes it red. (Getting the
textstyle-update syntax right is less easy than with other things.)
rh