I want to format part of a paragraph in typewriter font. Is there a shortcut to quickly switch to the typewriter
font in Lyx?
Or even better: is there a concept like character styles in Lyx so that I can have all my programming code (as in Java programming code) appear in the same way? I do not want the whole paragraph to be in this style, just a part of a paragraph.
Best Answer
A flexible way is to make your own LyX inset (easier than it sounds). Let's start with the "code" inset that is in LyX's Logical Markup module. If you don't need to customize it, just use the module by going to Document > Settings > Modules and add "Logical Markup". But you sound like you might enjoy customizing it, so let's copy it. Put the following in Document > Settings > Local Layout:
Then click "Validate". Then click OK. Your new inset "Code" is available in the Edit > Text Style menu.
For more information, see Help > Customization. Read sections 5.2 and 5.3.
To make a shortcut out of it, go to Tools > Preferences > Editing > Shortcuts. Click on "New". For the Function, put
flex-insert "Code"
. Then choose your key binding.