LyXShortcut for custom text style

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

Shortcut for custom text style

Post by efroselli »

I have two custom text styles, Code and Menuitem, that allow me to change the appearance of a selected string of text via the right-click - Text Style menu.

But applying the styles often is a lot of mouse work, and I should like to be able to affect a key shortcut, like CTRL + e for Emph, to both of these styles.

When I apply them via the menu, the status bar at the bottom of my interface shows

flex-insert "menuitem"
or
flex-insert "code"

So I tried binding these lines to keyboard shortcuts via the Tools - Preferences - Editing - Shortcuts menu. (Yes, I did RTFM.)

Everything compiled ok, but this does not have the desired effect. The selected text just appears in italics. For the record, "code" should put it into the typewriter font and "menuitem" should put it into a small caps sans serif. Neither is italics. I used the shortcut CTRL + m after removing the math mode shortcut which I never use.

Thanks to anyone who can help.

EFR

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Shortcut for custom text style

Post by scottkosty »

I don't know why that didn't work. A good way of testing is to enter those commands into the mini-buffer (alt+x for default bindings). If they work there, then bind them to a short cut.

Also, if you start lyx with -dbg action, it will show all of the lyx functions, which can be used to discover the short cut.

Finally, you might need to use 'command-sequence' which lets you run several LFUNS at once. See Help > LyX Functions for a list of many LFUNS.

Scott
efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

Re: Shortcut for custom text style

Post by efroselli »

Thanks Scott, for that mini-buffer tip. In fact, the flex-insert command worked correctly, but I was not respecting case-sensitivity. My commands were called MenuItem and Code, not menuitem and code. So now all is well and I will have to apply myself to figuring out how to use the LFUNS.
Post Reply