2

I use Mathstackexchange frequently and usually I write down my question on Lyx and then copy to the website. However, I must insert a $ sign before and after every equation while I am writing it down with Lyx. Is there a smart way to do this without inserting it every time? Thank you. Here's how it looks like. As you can see I want to insert a $ symbol everytime.enter image description here

10
  • Welcome to TeX.SX! What do you mean? A keyboard shortcut, leaving it out completely?
    – TeXnician
    May 27, 2017 at 11:37
  • Thank you. Yes, exactly. I don't know if for example Lyx has some kind of built-in function that everytime I initialize an equation it would insert those "$" signs. As far as I know there's something called macros but I don't know if this would solve my problem.
    – aadcg
    May 27, 2017 at 11:44
  • Do you start all your equations the same way? How should Lyx know when math starts other than $? I do not really get it, but maybe there are some Lyx experts who can manage it. (Btw: Macros could also refer to TeX commands.)
    – TeXnician
    May 27, 2017 at 11:46
  • I don't know absolutely anything about Latex except using Lyx. When you want to insert an equation on Lyx you simple press CRTL + M. I will attach a photo to my post.
    – aadcg
    May 27, 2017 at 11:49
  • I don't get it either. I use LyX sometimes and in that case I don't need to introduce those $ myself. Entering math inline mode is enough (the CTRL+M shortcut you speak of). May 27, 2017 at 12:23

1 Answer 1

2

Sort answer: Ctrl+M already insert $ $ in LaTeX code.

Long answer:

In LaTeX $ is an active character that start/end the inline math mode. In Lyx, $ is not a active character that will do nothing except print that symbol, and it will we exported to LaTeX as\$ (the inactive symbol) in text mode or in math mode.

Therefore you cannot write in LyX $...$ to make an equation like in LaTeX, except if you are in a TeX box, aka Evil Red Tex (ERT), using Ctrl+L but then you must work with LateX code in the red box, that do not show anything except what you write. Be careful with ERTs, some typo here can produce a fatal error (= no PDF preview).

To write in math mode in LyX use the blue ∑ butttom or Ctrl+M. This make a blue box, warning you that a math environment equivalent to $...$ in LaTeX is already done, then you can write the equation with LaTeX commands as \simeq but is showed the correspondent symbol .

You can also write the equation "as is" in text mode (e.g.: A \simeq B), then select the equation with the cursor and use Ctrl+M to convert to math mode (i.e.,A≃B).

But as show your screenshot, all you equations are already in math mode, so you are trying is not only wrong, but also absolutely unnecessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .