Re: Re: Mathematica and LyX - Graphics and equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg95798] Re: [mg95749] Re: Mathematica and LyX - Graphics and equations*From*: TL <latev at shaw.ca>*Date*: Tue, 27 Jan 2009 07:01:24 -0500 (EST)*References*: <glj8bm$dln$1@smc.vnet.net> <200901261001.FAA22263@smc.vnet.net>

That's what I was looking for, thanks a lot JUN! I have a WinXP environment here and I'm not sure your instructions will work but at least that's an excellent starting point. As for pasting content from Mathematica I noticed one really annoying fact, that's actually mentioned in the Mathematica help as well - when there are two or more symbol variables in your equations Mathematica treats them as text and displays them as such, the result being that part of the equation appears in italic font part in regular. I think that was the root of my issues in some of my previous posts and now it's haunting me in other environments too, cause the LaTeX form of the equations that is exported by Mathematica contains a whole bunch of text{} tags that I have to manually get rid of Does someone know how to change that behaviour? JUN wrote: >>> 3) And finally could someone please provide detailed instructions of >>> how to setup LyX to interact directly with the Mathematica kernel so >>> I can have some semi live math environment. May be that way the >>> equations will come in the right form >>> >> Given what LyX is, I doubt this is easily doable if at all. >> > > The last remark needs fact-checking. It actually works - within > limits. It's a fun feature, but I don't really use it much. > > What you have to do to make it work depends on your platform. On Mac > OS X, I first created a little script > /usr/local/bin/math > containing the following two lines: > #!/bin/sh > /Applications/Mathematica.app/Contents/MacOS/MathKernel "$@" > > The purpose of this is simply to make the command "math" appear in the > path visible to LyX, and point to the Mathematica Kernel (so obviously > this is Mac specific, and I don't know the PC equivalent). Then > whenever you have a calculation that you want to do in LyX, do the > following: > * Open a math environment. > * Type the Mathematica expression you want to evaluate (e.g.: Sin[.2]) > * Highlight the expression > * While you are still in that math box, go to Edit > Math > Use > Computer Algebra System > Mathematica > * Magically, an equals sign and the result of the evaluation will > appear in the LyX math box. > > In general, in particular when graphics is involved, I would just work > with the Mathematica Notebook and the LyX editor side by side, and > copy/paste between the two. In LyX 1.6, you can paste graphics into > LyX from the clipboard. Equations in Mathematica's TeXForm can be > pasted directly into LyX math environments. > > In the other direction, you can copy LaTeX from LyX into Mathematica > as follows: > * enter the desired math expression in LyX (e.g., \sin\alpha) > * select all the _contents_ of the math box, but not the math box > object itself (i.e., stop highlighting when you reach the end of the > math inset). > * Copy > * Paste literally into a Mathematica Cell, perhaps wrapped by > something like ToExpression["\sin\alpha", TeXForm] (where the pasted > text goes between the quotation marks) > * The result can then be used in Mathematica Labels etc. > > Although LyX has a non-LaTeX internal file format, everything it does > goes through LaTeX, and in particular all its equations can be > understood by other LaTeX-aware programs. One may still ask why anyone > would you use LyX instead of Mathematica to write equations. I think > this has already been addressed, and it may really be a matter of > taste - but it's worth pointing out that LyX has unlimited Undo and > version control (there's more, but I better stop here). > > As for the customization of the LyX output, it's true that this isn't > trivial if you don't know much LaTeX. The LyX-users mailing list would > be a place to start, they are very helpful... > > Jens > > >

**References**:**Re: Mathematica and LyX - Graphics and equations***From:*JUN <noeckel@gmail.com>