Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.7K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Importing a Latex string gives an error no translation

Posted 1 year ago

I am new to Mathematica and would like to import a LaTeX string into a notebook. I have done the following and I have an error message as shown. Can anyone shed light on what I'm doing wrong please?

mathExpression = ImportString[ "\alpha =& \left[\left(\frac{A^4-B^4}{16}\right)
\textcolor{red}{-}\frac{B^2}{4}\left(\frac{A^2-B^2}{2}\right)
\textcolor{red}{+}\left(\frac{A^2-B^2}{2}\right)\left(\frac{\ln B}{\ln C} \frac{A^2-B^2}{4} \right) \right.\\ 
\left. & \ -\left(\frac{A^2}{2}\left(\ln A-\frac{1}{2}\right)-\frac{B^2}{2}\left(\ln B-\frac{1}{2}\right)\right)\left(\
\frac{A^2 - B^2}{4\ln C}\right)\right] \\" ],"LaTeX"] 

Error message : "No Wolfram language translation found"

POSTED BY: Gregory Holba

Your code does not parse. Try this:

ImportString["\\begin{align}
\\alpha =& \\left[\\left(\\frac{A^4-B^4}{16}\\right)
\\mathrel{\\textcolor{red}{-}}\\frac{B^2}{4}
\\left(\\frac{A^2-B^2}{2}\\right)
\\textcolor{red}{+}\\left(\\frac{A^2-B^2}{2}\\right)
\\left(\\frac{\\ln B}{\\ln C} 
\\frac{A^2-B^2}{4} \\right) \\right.\\\\ 
& \\left.  \\ -\\left(\\frac{A^2}{2}
\\left(\\ln A-\\frac{1}{2}\\right)-\\frac{B^2}{2}
\\left(\\ln B-\\frac{1}{2}\\right)\\right)
\\left(\\frac{A^2 - B^2}{4\\ln C}\\right)\\right]
\\end{align}", "LaTeX"]

I think in LaTeX you cannot insert an & inside a \left \right pair.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard