0
$\begingroup$

I had a simple LaTeX expression written in the Wolfram Cloud, namely $a_0 = $. I used ctrl+4 to display a box where I could write LaTeX. However, after some issue, it turned my simple expression into this mess:

Print[""!\*TemplateBox[<|\"boxes\" -> FormBox[RowBox[{SubscriptBox[StyleBox[\"a\", \"TI\"], \"0\"], \"\[LongEqual]\"}], TraditionalForm], \"errors\" -> {}, \"input\" -> \"a_0=\", \"state\" -> \"Boxes\"|>,\"TeXAssistantTemplate\"]""]

How can I revert it back to its original state without having to rewrite the entire code from scratch? Note that the expression $a_0=$ is just an example; we are talking about entire paragraphs that need correction. Therefore, I would like an automated way to convert the aforementioned mess back to a normal form.

Thanks in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$
(* Given string *)
str = "\"!\*TemplateBox[<|\"boxes\" -> FormBox[RowBox[{SubscriptBox[StyleBox[\"a\", \"TI\"], \"0\"], \"\[LongEqual]\"}], TraditionalForm], \"errors\" -> {}, \"input\" -> \"a_0=\", \"state\" -> \"Boxes\"|>,\"TeXAssistantTemplate\"]\"";

(* Convert the string to an expression *)
expr = ToExpression[str, StandardForm, HoldForm];

(* Print the expression *)
Print[expr];
$\endgroup$
1
  • $\begingroup$ Thanks for your answer! This means that I need to perform the actions you describe for each segment of the code that has been corrupted. This is equivalent to the task of rewriting it entirely. I was wondering if there is an option that could resolve the issue with a "click." $\endgroup$ Commented Dec 12, 2023 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.