MATLAB® provides special page setup options for printing from the Command Window and Editor.
To specify page setup options for printing from the Command Window, right-click in the Command Window, and then select Page Setup.
To specify page setup options for printing from the Editor, first select the Editor tab. Then, in the File section, click Print and select Page Setup.
The Page Setup dialog box opens for that tool.
Then, perform these steps:
Click the Layout, Header, or Fonts tab in the dialog box and set those options for that tool, as detailed in subsequent sections. On Mac platforms, you must first select MATLAB in the Settings menu in order to see these tabs.
After specifying the options, select Print in the tool you want to print from, for example, the Command Window.
The contents from the tool print, using the options you specified in Page Setup.
You can specify the following layout options. A preview area shows you the effects of your selections.
Print header — Print the header specified in the Header pane.
Print line numbers — Print line numbers.
Wrap lines — Wrap any lines that are longer than the printed page width.
Syntax highlighting — For keywords and comments that are highlighted in the Command Window, specify how they are to appear in print. Options are black and white text (that is, no highlighting), colored text (for use with a color printer), or styled text. For styled text, keywords appear in bold, comments appear in italics, and all other text appears in the normal style. Only keywords and comments you input in the Command Window are highlighted; output is not highlighted.
If you want to print a header, select the Layout tab and then select Print header. Next, select the Header tab and specify how the elements of the header are to appear. A preview area shows you the effects of your selections:
Page number — Format for
the page number, for example
# of n
Border — Border style
for the header, for example,
Layout — Layout style
for the header. For example,
Standard one line includes
the date, time, and page number all on one line
Specify the font to use for the printed contents:
From Choose font,
select the element, either
Body text is everything except the
Select the font to use for the element.
For example, if you access this dialog box while using the Command
Window, you can select Use Command Window font for
The printed text matches the Command Window font.
Repeat for the other element.
If you did not select Print header on the Layout pane,
you do not need to specify the
As an example, for
Header text, select Use
custom font and then specify the font characteristics—type,
style, and size. After you specify a custom font, the Sample area
shows how the font will look.
Tip You can change the font that a desktop tool uses. On the Home tab, in the Environment section, click Preferences > Fonts > Custom.