I have something like this:
Hold[TraditionalForm[1/2 + x^2]]
And wish to change it to Input form with the use of code (that is, without clicking Cell > Convert To > InputForm)
I have something like this:
Hold[TraditionalForm[1/2 + x^2]]
And wish to change it to Input form with the use of code (that is, without clicking Cell > Convert To > InputForm)
Does it fit your needs?
Block[{TraditionalForm},
RawBoxes @ ToString[ Hold @ TraditionalForm[1/2 + x^2], InputForm]
]
It is even more strict as terms were not reordered as in the first example.
ReleaseHold[Hold[TraditionalForm[1/2 + x^2]]][[1]]
1/2
. What am I missing?
$\endgroup$
ReleaseHold[Hold[TraditionalForm[1/2 + x^2]]][[1]] // InputForm // Text
ok?
$\endgroup$