PageWidth

PageWidth

is an option for output streams and for cells that specifies how wide each line of text is allowed to be.

Details

  • Possible settings for output streams are:
  • Infinityan infinite width (no line breaking)
    nexplicit width in characters
  • SetOptions[stream,PageWidth->val] resets the line width allowed for an open stream.
  • Possible settings for cells are:
  • WindowWidththe width of the window on the screen
    PaperWidththe width of the page as it would be printed
    nexplicit width given in printer's points
  • PageWidth->WindowWidth allows each line to use the full width of the displayed window, taking into account settings for CellMargins.
  • The PageWidth setting of a cell sets the boundary for all of the cell's elements, including the CellMargins, CellFrame and CellFrameLabels. It does not include the space allocated for the cell bracket.
  • PageWidth->UpTo[n] is equivalent to the lesser of PageWidth->WindowWidth and PageWidth->n.
  • If the effective PageWidth is less than the window's width, the alignment of the contents of the cell is controlled by the Alignment option.

Examples

open allclose all

Basic Examples  (2)

Set the PageWidth to be 60 characters for a stream:

Set the PageWidth to be 30 characters for a stream:

Compare the two resulting files:

Delete the temporary files:

Create an Output cell with a fixed width:

This is a bit of text

Scope  (4)

Set a fixed page width:

Four score and seven years ago, our fathers brought forth upon this continent a new nation: conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war...testing whether that nation, or any nation so conceived and so dedicated. . .

Set the width to use the full width of the window:

Four score and seven years ago, our fathers brought forth upon this continent a new nation: conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war...testing whether that nation, or any nation so conceived and so dedicated. . .

Set the width to the paper width for the default printer:

Four score and seven years ago, our fathers brought forth upon this continent a new nation: conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war...testing whether that nation, or any nation so conceived and so dedicated. . .

Set the width to be as much as 600 points, or narrower if the window is narrower:

Four score and seven years ago, our fathers brought forth upon this continent a new nation: conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war...testing whether that nation, or any nation so conceived and so dedicated. . .

Properties & Relations  (3)

The PageWidth cell setting includes the horizontal space consumed by CellMargins:

This is a bit of textThis is a bit of textThis is a bit of textThis is a bit of text

PageWidth affects the width of CellFrame and the position of CellFrameLabels:

This is a bit of textThis is a bit of textThis is a bit of textThis is a bit of text

Alignment determines how cells affected by a narrow PageWidth align:

abc
Wolfram Research (1988), PageWidth, Wolfram Language function, https://reference.wolfram.com/language/ref/PageWidth.html (updated 2020).

Text

Wolfram Research (1988), PageWidth, Wolfram Language function, https://reference.wolfram.com/language/ref/PageWidth.html (updated 2020).

CMS

Wolfram Language. 1988. "PageWidth." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PageWidth.html.

APA

Wolfram Language. (1988). PageWidth. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PageWidth.html

BibTeX

@misc{reference.wolfram_2024_pagewidth, author="Wolfram Research", title="{PageWidth}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/PageWidth.html}", note=[Accessed: 05-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_pagewidth, organization={Wolfram Research}, title={PageWidth}, year={2020}, url={https://reference.wolfram.com/language/ref/PageWidth.html}, note=[Accessed: 05-December-2024 ]}