2

I'm a long-term LaTeX user trying to figure LyX out. Sometimes, the subscript underscore behavior works just fine. But, after I write an equation, if I go back to edit it, if I later add an underscore, it treats it like I really want an underscore in the equation. In other words, I type _ and in the tex source, \_ appears. But that's not what I want! I truly want to add a subscript and I can't figure out how to tell it not to add the backslash and I don't know how to edit the TeX source directly. What do I do?

Edit: I figured out the issue and how to reproduce it. Go into math mode and type \text <space> t_a and notice that the term "t_a" appears on the screen rather than "a" being an underscore. This makes sense. But now, let's say I realized that going into text mode was a mistake. Well, how do I get out of it? Do I just need to edit the .tex code directly? Obviously, for this simple example, I can just delete the whole equation and start from scratch. But when this issue first arose, it was in the context of a giant equation and I was having problems fixing it and it was hard to debug because I didn't know that the \text was causing problem until digging into the LaTeX code itself.

7
  • I am using math mode. The problem is that within math mode when I type "_" it replaces it with "<backslash><underscore>". It's nuts!
    – Andy Stein
    Jan 27 '16 at 15:30
  • Sigur, I'm sorry. I think you don't understand the problem. Perhaps someone else can comment.
    – Andy Stein
    Jan 27 '16 at 15:33
  • I don't have the newest lyx, only version 2.1.3, and I'm not a lyx user, but in a small test I couldn't reproduce your problem. As soon as I click in an equation the underscore creates a subscript. Jan 27 '16 at 15:55
  • Thanks Ulrike. I tried to reproduce the error and failed too. Then, when I look back at my original code, I see an extra \text{} bit that doesn't need to be there. I think it's left over from me typing it because I thought I needed it and it might have messed things up and now, I can't get rid of it. It doesn't seem like it's very easy to edit the source code directly, so I think I should just start from scratch and do things "right" this time.
    – Andy Stein
    Jan 27 '16 at 17:30
  • @AndyStein I cannot reproduce this problem. If you can reproduce it and you think there is a better way LyX could handle it, please open a ticket at lyx.org/trac. Although you cannot edit .tex directly (this is a known disadvantage of using LyX), you can try opening the .lyx file in a text editor. I believe that LyX stores math as LaTeX. Backup of course.
    – scottkosty
    Jan 28 '16 at 5:21
1

The text inset looks like other insets in math mode, i.e. it is denoted by small "brackets" at each corner. To get out of it, use for example the arrow keys on the keyboard to move the cursor outside the inset.

To take your example:

  • Enter math mode and type \text <space> t_a, which generates this:

    enter image description here

    Note the small angle "brackets", especially in the lower left. The outer ones indicate the math inset, the inner ones indicate the text inset.

  • Move the cursor one step right with the right arrow key, , and note that the brackets that were at the same height as the underscore are gone. This indicates you are outside the text inset, but still inside the math inset.

    enter image description here

  • As G.M. says in a comment, you can delete the \text part by moving the cursor to the start of it and hitting backspace. So in this case, move the cursor to right before the t, but make sure it's still inside the inset, as in the following image (left, before hitting backspace, right after hitting backspace).

    enter image description here

    When you do that, you go from \text{t\_a} to t\_a, so you still have to change to a proper subscript, which you can do by for example

    1. deleting the underscore
    2. selecting the a
    3. hitting _ on the keyboard.

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.