How I can I create hotkeys for some of the features in LyX? Are there keyboard shortcuts for the "Horizontal Space" feature?

  • Hi Tyler, please take a look at my answer to tex.stackexchange.com/questions/22938/… which describes a general approach. In fact, this question could qualify as a duplicate. – Daniel Mar 15 '12 at 8:18
  • No. This is not a duplicate. – GTyler Apr 4 '12 at 5:24
  • Maybe you could elaborate a bit what part of your question is not covered by the described approach? – Daniel Apr 4 '12 at 8:05

There is a plethora of hotkey configuration options in

Tools | Preferences | Editing | Shortcuts

If you type "space" in the Show key-bindings containing field, you'll see the existing shortcuts for some Insert | Formatting | Horizontal Space options.

You could also try to create a new, customized one if the choice is not sufficient for your needs, but that is tricky.

If you just want to get to the formatting window for horizontal spaces, the good old

Alt - I - O - O

will do the job.


In general, when you call any dialog in LyX (i.e. any box that pops up so you can choose to insert or modify something) the appropriate command to issue in order to call the dialog box is shown in the bottom status bar (but disappears as soon as anything else happens, so you have to be quick, or repeatedly call the dialog).

When you go to Insert > Formatting > Horizontal Space in LyX 2.0.0 the status bar will read

(dialog-show-new-inset space)

To make a shortcut to that dialog, go to Preferences > Editing > Shortcuts, make a new shortcut, and as the command insert

dialog-show-new-inset space

i.e. what the status bar wrote, but without the parentheses. Choose a shortcut, and this will now call the dialog.

If there is some space you want to insert all the time, you can also insert it a bit more rudely, using Evil Red Text (TeX code).

To find the code for the space you wish to insert, insert it via the menus, move the cursor to it and choose Viev > View Source. Then write down the code. I will use Douable Quad as an example -- it has the code \qquad{}. Now go make a shortcut with the command

command-sequence ert-insert; self-insert \qquad{}; char-forward;

This will insert a ERT box; and it the ERT box insert the code \qquad{}; and then move one character to the right, so you can keep on writing outside the box! It'll look ugly because the ERT filed will stay there, but it'll save you calling the dialog all the time.

  • 1
    Full automation even via the dialog is possible as well, albeit it is a bit tricky to figure out the command sequence. However, there really is no need to employ "ugly ERT" for stuff that is natively supported by LyX. See my answer to tex.stackexchange.com/questions/22938/… – Daniel Mar 15 '12 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.