6

Has someone got an idea what the shortcut is/where I can create one for the \medskip{} command (or any other command, that generates a vertical space in my document)?

I looked in Tools/Preferences/Editing/Shortcuts, but I couldn't find any command of this type there.

P.S. I'm using Lyx 1.6.5

0

2 Answers 2

11

Short answer:

The following command sequence inserts a \medskip in your document, you just have to bind it to the shortcut you prefer: inset-insert vspace medskip.

General answer:

At times it is a bit tricky to figure out what LyX commands one actually has to bind to a shortcut to achieve the desired behavior. While for most commands LyX shows the last executed command in the status bar, this does not help for commands that open a dialog for further settings. In the following, I describe the approach I used to figure this one out, so you could apply it for other questions in this respect:

(1) Start Lyx with the -dbg action option (that is, run /path/to/lyx-binary/lyx -dbg action from a console window).

(2) Execute the command for which you want to figure out the command sequence. LyX lists the actions in the debug output in the console. The following shows the relevant output for Insert->Formatting->Vertical Space... with selecting MedSkip:

LyXFunc::dispatch: cmd:  action: 219 [dialog-show-new-inset]  arg: 'vspace' x: 0 y: 0
LyXFunc.cpp(771): 
LyXFunc::dispatch: cmd:  action: 218 [dialog-show]  arg: 'vspace vspace defskip' x: 0 y: 0
LyXFunc.cpp(1842): dispatch msg is 
LyXFunc.cpp(1875): verbose dispatch msg (dialog-show-new-inset vspace)
LyXFunc.cpp(771): 
LyXFunc::dispatch: cmd:  action: 224 [inset-apply]  arg: 'vspace medskip' x: 0 y: 0
LyXFunc.cpp(771): 
LyXFunc::dispatch: cmd:  action: 225 [inset-insert]  arg: 'vspace medskip' x: 0 y: 0

(3) Usually the last command executed by some dialog-based action is the one you are looking for. In this case it is the line with [inset-insert] and the arguments vspace medskip.

(4) Use the LyX Mini-Command Buffer (View -> Toolbars -> Command Buffer) to manually test the command: inset-insert vspace medskip

If the result is what you want to achieve, you are done and have found the command sequence to bind to the shortcut. Otherwise you have to experiment more :-)

Update: General answer using the GUI only

For those who do not feel comfortable with starting LyX from a console window, there is also a GUI-only way to figure out the commands (thanks to Dominik for the hint!):

(1a) In LyX, open the debug Console by selecting View –> Message Pane

(1b) Configure the settings on the Settings page, so that User commands and External control interface are set to Yes:

enter image description here

(2) Switch on the Output pane and execute the command for which you want to figure out the command sequence. The following shows the relevant output for Insert->Formatting->Vertical Space... with selecting DefSkip:

enter image description here

(3) Proceed as above.

3
  • Wow, very elegant solution for the general case. thank you
    – l7ll7
    Commented Jul 14, 2011 at 11:28
  • 1
    Since LyX 2.0 there's a debugging pane which you can start on menu "View > Messages Pane". To only see the command sequences, disable all debug levels except "External control interface".
    – Dominik
    Commented Feb 24, 2015 at 17:57
  • @Dominik: Nice, I wasn't aware of that. However, to also get the results from an inset window (command argument), I additionally had to select "User Command". I have edited your approach into the answer.
    – Daniel
    Commented Feb 25, 2015 at 9:50
0

From what you ask a simple solution would be to add in ERT \vspace{xcm}, where x is the vertical space required.

1
  • 1
    Welcome to TeX.sx! In the present form, your answer looks more like a comment. Could you expand it slightly?
    – Corentin
    Commented Mar 19, 2013 at 22:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .