WOLFRAM LANGUAGE TUTORIAL
Newlines and Tabs in Strings
|∖n||a newline (line feed) to be included in a string|
|∖t||a tab to be included in a string|
Explicit representations of newlines and tabs in strings.
This prints on two lines.
there is an explicit
to represent the newline.
The Wolfram Language keeps line breaks entered within a string.
There is a newline in the string.
With a single backslash at the end of a line, the Wolfram Language ignores the line break.
You should realize that even though it is possible to achieve some formatting of Wolfram Language output by creating strings which contain raw tabs and newlines, this is rarely a good idea. Typically a much better approach is to use the higher-level Wolfram Language formatting primitives discussed in "String-Oriented Output Formats", "Output Formats for Numbers", and "Tables and Matrices". These primitives will always yield consistent output, independent of such issues as the positions of tab settings on a particular device.
In strings with newlines, text is always aligned on the left.
The front end formatting construct Column
gives more control. Here text is aligned on the right.
And here the text is centered.