Mathics3 / mathics-core

An open-source Mathematica. This repository contains the Python modules for WL Built-in functions, variables, core primitives, e.g. Symbol, a parser to create Expressions, and an evaluator to execute them.
https://mathics.org
Other
780 stars 46 forks source link

formatted text in strings #245

Open mmatera opened 2 years ago

mmatera commented 2 years ago

Description

In WMA, a string can produce a text equivalent to a boxed expression. For example,

"Power: \!\(a \^ b\)"

produces the same formatted text as the Boxed expression

Row[{"Power", Superscript[a, b]}]

See https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.html#28564 for details of the syntax.

In mathics, on the other hand, the string is taken literally.

Motivation for fixing it

To reproduce the WMA behavior would be helpful, among other things, for improving the support of online help using ::usage strings associated with symbols. This also would contribute to having a more compatible interface for dealing with formatted text.

rocky commented 2 years ago

I believe I have seen a number of packages that require this form too.

It seems like this should be pretty straightforward thing to do in the parser.

If I had known about that link, I probably looked at it earlier.