Using the menu entry Insert > Formatting > Horizontal Line I can insert a WYSIWYG horizontal line into a LyX document. I want to figure out the internal command(s) used to do this so I can set up a binding to do this via a keyboard shortcut. However, Tools > Preferences > Editing > Shortcuts doesn't show anything, and the functions listed under Help > LyX Functions doesn't show anything either.

I could make a binding to insert the \hrulefill LaTeX command, but that wouldn't be WYSIWYG.

Looking in the .lyx file, I can see that a WYSIWYG line is done by:

\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"



However, using a command-sequence of multiple self-insert to insert those lines one after the other doesn't work.

I'm using LyX version 2.1.2

1 Answer 1


Go to View > Messages Pane:

enter image description here

Then click on the "Settings" tab in the bottom right corner:

enter image description here

Then click on the "Selected" radio button:

enter image description here

Then double click on "User commands" so that "no" turns to "yes":

enter image description here

Then click on the "Output" tab:

enter image description here

Then do the action that you want to copy the shortcut of. In this case, insert your horizontal line. In the output tab at the bottom, you will see:

enter image description here

This tell us that the correct command is:

inset-insert line CommandInset line LatexCommand rule offset "0.5ex" width "100col%" height "1pt" \end_inset

Verify that the command is correct by inserting it directly into the mini buffer (Alt + X or View > Toolbars > Command Buffer) at the bottom of the screen:

enter image description here

Run the command by pressing return. If it has the desired effect, then you know you have the right command and can create the shortcut in the usual way.

Note that you can have one shortcut do multiple commands by using command-sequence.

  • Thanks! I did have to drag the message pane divider line up in order for the radio buttons to show, but after that it worked just like you said. Oct 23, 2014 at 1:16
  • @MatthewCline good to know. Can you please make a bug report for that at lyx.org/trac ?
    – scottkosty
    Oct 23, 2014 at 8:46

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.