HP Forums

Full Version: How to get textbook display of an expression held in a string?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a piece of code that generates an expression as a string. I can't find a way to convert it into a CAS expression (within the program and without simplifying or evaluating it) so that it displays pretty-printed in textbook mode on the history stack when the program ends.

Typical example is: "3 NTHROOT (1/8)" which I'd like to see displayed as:
\begin{equation}
\sqrt[3]{1/8}
\end{equation}

Any suggestions, please?
If s is your string, then the following should work:
Code:
EXPR("'" + s + "'")
or
Code:
EXPR("QUOTE(" + s + ")")
Thanks, the latter version did the trick. I felt sure that I had tried every combination of QUOTE, EXPR and EVAL but clearly not. Thanks again.
Both versions work in the tests I've done. Do you have an example where the first one would not work ?
Reference URL's