My problem is related to FormatType
of the Output
of Print[]
.
Look at this example code
i = 4;
Print["Try", "\tPippo : ", i, "\nPluto"]
The output is
If instead I send the output to another stream through
$Output = OpenWrite["demo.txt"]
and then I evaluate again the Print command, the output in the file “demo.txt” looks like the following
How can I save the text in the same style it appears in Mathematica?
FormatType -> OutputForm, that is, using
$Output = OpenWrite["demo2.txt", FormatType -> OutputForm]
give you what you need? $\endgroup$Print
documentation is that you normally would useWrite
for direct writing to files. $\endgroup$