[Tex/LaTex] How to Paste Equation from Maxima to Lyx

lyx

I am using Maxima/wxMaxima in Windows to perform a calculation and I get a nicely formatted equation as output in wxMaxima. I can copy the Latex code of the equation and paste it into a math box in Lyx (Insert Math) but it is rendered as the raw Latex code instead of the formatted equation. How can I get the equation from wxMaxima to appear properly in Lyx?

Best Answer

The equations you copy from Maxima, e.g.

\[\mathrm{fx}\left( x\right) :=\sqrt{\frac{1}{2\cdot \pi \cdot x}}\cdot \mathrm{exp}\left( \frac{-x}{2}\right) \]

include opening and closing delimiters for a math environment, in this case \[ and \]. In LaTeX, they denote the start and end of a displayed, unnumbered equation. However, when you make an equation in LyX, you already have such delimiters, so you shouldn't add a second set.

Hence, if you don't copy the starting \[ and closing \] it works fine.

The method mentioned by Scott Kosty in the comments also work fine: After copying the entire equation, including delimiters, do Edit --> Paste special --> Paste from LaTeX, without inserting a math environment first. Then LyX will read the delimiters from the code and insert the proper math environment.

Related Question