I am using the command:

Print["A paragraph goes in here; a subparagraph goes here; etc."]

The output text has line returns that differ from where they are in the input text. How can I make the output text look just like the input text? And with a more readable font than the mma default?

  • 2
    $\begingroup$ In general, Print is not the right command if you want to produce nicely formatted output. It's more for diagnostic purposes. Are you insisting on using Print? $\endgroup$
    – Jens
    Sep 14, 2016 at 19:15
  • $\begingroup$ I am not insisting on using Print. What is the right command? $\endgroup$ Sep 14, 2016 at 20:52

2 Answers 2


Print just displays the given text. Style allows to format the text in a variety of styles, e.g.

Style["A paragraph goes in here; \n a subparagraph goes here; \n etc.",
Blue, 24, Italic, FontFamily -> "Courier", LineSpacing -> {1, 0}]

enter image description here

A line break is introduced with \n, and the list of available fonts can be obtained with $FontFamilies. For an exhausting list of possibilities achievable, see the documentation for Style.

  • $\begingroup$ Thanks for your help. I applied your suggestion like so: $\endgroup$ Sep 14, 2016 at 21:11
  • $\begingroup$ Style["Location classifications; \n 1 = Openings that users will \ touch frequently: buttons, usb jack, audio jack, charging ports, \ etc.; \n 2 = Openings or seams that users will touch infrequently: \ speaker holes, microphone openings, housing/mating seams, etc.; \n 3 \ = The screen; \n 4 = Surfaces: the back of the device, etc.", Black, \ 14, Plain, FontFamily -> "Arial", LineSpacing -> {1.5, 0}] $\endgroup$ Sep 14, 2016 at 21:12
  • $\begingroup$ But the line still breaks unnecessarily between the words "touch" and "infrequently"??? $\endgroup$ Sep 14, 2016 at 21:13
  • 2
    $\begingroup$ For future cases: (1) don't extend the scope of the initial question in the comments; edit the question accordingly or post a new one; (2) don't make prolonged discussions in the comments; (3) when posting MMA code in the comments, enclose it in the grave accents, `, that you can find in the upper left part of the keyboard. $\endgroup$
    – corey979
    Sep 14, 2016 at 22:42
  • 1
    $\begingroup$ @Michael With the option setting LineBreakWithin -> False for Style there will be no extra line breaks, even if the with of the window is to small to display the lines completely. One can use Pane for more options (size, scrolling, scrollbars, magnification, ...). From you question it is not clear how the output should look like and how it's related to the TableHeadings in your answer. $\endgroup$
    – Karsten7
    Sep 15, 2016 at 11:11

If you need strict control on the appearance of the output, you could consider using CellPrint which gives you maximum flexibility.

For example, you can print a cell with style "Text":

CellPrint@TextCell["A paragraph goes in here; a subparagraph goes here; etc.", "Text"]

You can print a cell with specific formatting:

  Row[{"The equation ", ExpressionCell[TraditionalForm[x^2 == -1]], " has 2 solutions."}],

I refer you to the Documentation pages for ExpressionCell, TextCell and CellPrint for additional examples.


Your Answer

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

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