On 09/18/2015 10:15 AM, David L. Johnson wrote:
On 09/18/2015 09:40 AM, Sajjad wrote:
Hello forum,

I am trying to insert TeX code directly from the LyX interface Insert->Tex Code . Then I see a box in the editor. Inside the box I entered the following:

\sqrt A-B

But that is not correct TeX code. If you were to write that in an editor and tried to run TeX, you would get the same error. If you write, in the box, (as TeX claims it will do in that error message) $\sqrt A-B$ you would not get an error, but you would also not get what I suspect you want. The $s put it in math mode for TeX. To get the square root of the difference, write $\sqrt{A-B}$. Alternately, go to Math mode in LyX, rather than TeX mode, and enter \sqrt . If you then hit the space bar, you see a little blue square root sign, with a blue box inside, and the cursor in the box. Then enter A-B. Easier, and you see what you will get.

Maybe it's worth adding that "TeX Code" (aka ERT, Evil Red Text), is intended for various sorts of constructionw that LyX does not natively support, or doesn't support very naturally. As David said, most math can be done in LyX's math mode.

Richard

Reply via email to