Set Print Options for Command Window and Editor
You can customize how pages look when printing from the Command Window and Editor.
To specify page setup options, open the Page Setup dialog box using one of these methods:
Command Window — Right-click in the Command Window and select Page Setup.
Editor — Go to the Editor tab, and in the File section, select Print > Page Setup.
The Live Editor has a different way of controlling how pages look when printing. To
change the page setup options when exporting in the Live Editor, use settings. For more
information, see the matlab.editor.export
settings described in
matlab.editor Settings.
Specify Layout Options
To specify layout options when printing, in the Page Setup dialog box, select the Layout tab. (On macOS platforms, select MATLAB in the Settings menu to see the Layout tab.) Then, select from the available options as described in the table below. A preview pane shows a sample document with the selected layout options.
Layout Option | Description |
---|---|
Print header | Include a header at the top of each printed page. |
Print line numbers | Print line numbers. |
Wrap lines | Wrap any lines that are longer than the printed page width. Otherwise, the line is cut off at page boundaries. |
Syntax highlighting | Specify how MATLAB® elements appear when printed. Options include:
|
Add Header
When printing from the Command Window or Editor, you can include a header on each printed page. The header includes information such as the current date and time, the name of the file you are printing, and the page number. To include a header, in the Page Setup dialog box, select the Layout tab and then select Print header.
To change the format and layout of the header, select the Header tab and then select from the available options, as described in the table below. (On macOS platforms, select MATLAB in the Settings menu to see the Header tab.) The preview area shows a sample of the header with the selected options.
Header Option | Description |
---|---|
Page number | Format for the page number. Options include # of n, Page #, and # / n |
Border | Border style for the header. Options include Single line, Double line, Box, Shaded box, and None. |
Layout | Layout style for the header. Options include:
|
For example, in the Editor, print the example file
fourier_demo2.m
with a standard two line header and a double
line border.
Change Fonts
You can specify the font to use when printing. By default, MATLAB uses the Editor or Command Window font when printing.
To specify a different font to use when printing, follow these steps:
In the Page Setup dialog box, select the Fonts tab. (On macOS platforms, select MATLAB in the Settings menu to see the Fonts tab.)
In the Choose font field, select Header to change the font for the header text, or Body to change the font for all of text in Command Window or Editor except for header text.
Select Use custom font and then specify the font name, style, and size. The Sample area shows a preview of the selected font.
See Also
print
| matlab.editor Settings