Re: LaTex to Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg91413] Re: LaTex to Mathematica*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Wed, 20 Aug 2008 06:23:44 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <g8gj47$etf$1@smc.vnet.net>

snowrain wrote: > Does anyone know how to convert LaTex file to Mathematica ? > For example, the formula that I typed in LaTex is: > ln{H}^{*} &= {X}_{1} {\beta}_{1} + {\alpha}_{1}lnE+ {\varepsilon}_{1}\\ > If I copy the above LaTex command to Mathematica, it only shows the > original LaTex command. I'd like to have symbols for beta, alpha, and also > for subscript and superscript. That is, I hope it looks like the pdf file > that LaTex produces instead of showing "\beta", "\alpha", etc. First, note that Mathematica handles AMS-LaTeX. Depending on how the code you have adheres to this standard, you will get varying results with the automatic conversion process. Converting a LaTeX file can be done via the command *Import* [1], e.g. Import["filename.tex"] If you want to convert just one expression in TeX/LaTeX, you can use use ToExpression with the option TeXForm [2, 3]. Note that the expression must be enclosed within double quotes, must start and end with a dollar sign, and backlashes must be repeated. In[12]:= ToExpression["$ln{H}^{*}&={X}_{1} {\\beta}_{1}+{\\alpha}_{1}lnE+{\\varepsilon}_{1}\\\\$", TeXForm] Out[12]= l n \!\(\*SuperscriptBox["H", "*"]\) == E l n Subscript[\[Alpha], 1] + Subscript[X, 1] Subscript[\[Beta], 1] + Subscript[\[Epsilon], 1] Regards, - Jean-Marc [1] http://reference.wolfram.com/mathematica/ref/format/LaTeX.html [2] http://reference.wolfram.com/mathematica/ref/TeXForm.html [3] http://reference.wolfram.com/mathematica/ref/ToExpression.html