I just upgraded to LyX 2.1.0. I use the "Code" text style from the Logical Markup module. In prior versions, whenever I formatted a word as code, it was just displayed as such (see the first line of the screenshot). Now, it also writes the label "code" beneath it (see second line).

enter image description here

This may be helpful for more obscure text styles. But in the case of code formatting, I can see that it's formatted as code just by looking at the text. So the label stating the obvious just distracts me from reading the text and makes for an uneven line spacing.

I found that I can hide each label individually by right-clicking the text an un-checking the "Show Label" checkbox. However, what I'm really looking for is some setting in LyX so that whenever I format some snippet of text, the label is hidden by default.


I don't believe this is currently possible with LyX 2.1. Here are some thoughts:

  • If you are on Linux you can easily get the old behavior. Just clone the repository, run git revert 906a473e578aae1a681aaf48054ea33c9e27bed8, and compile.
  • This change was introduced to fix this bug report: http://www.lyx.org/trac/ticket/8442. You (understandably) like what is described there as the "inconsistent" behavior that the inset is collapsed after leaving it.
  • If you are OK with the underbrace but just don't want the string "code" under it, you can add the following (refer to the instructions here: How to exclude code from spell-checking in LyX?)

    LabelString           ""
  • Note that the shortcut "ctrl + i" can be used to collapse the inset (hide the label string in this case).
  • Read Help > Customization for more information on these types of issues.

You can also hack around this by using the following keyboard shortcut (works for Lyx 2.1.4):

command-sequence flex-insert Code; char-backward; inset-toggle; char-forward

If you bind it to a specific key. It will insert the "code" inset, which will place the cursor after it. Then go back into it, toggle the label display of the inset (which will put the cursor before the inset) and then go again into the inset.

If you have text selected before using the shortcut that text will be inside the created inset.

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.