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 selectPage Setup.
Editor — Go to theEditortab, and in theFilesection, selectPrint>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 thematlab.editor.export
settings described inmatlab.editor Settings.
To specify layout options when printing, in the Page Setup dialog box, select theLayouttab. (OnmacOSplatforms, selectMATLABin theSettingsmenu to see theLayouttab.) 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:
|
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 theLayouttab and then selectPrint header.
To change the format and layout of the header, select theHeadertab and then select from the available options, as described in the table below. (OnmacOSplatforms, selectMATLABin theSettingsmenu to see theHeadertab.) 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 includeSingle line,Double line,Box,Shaded box, andNone. |
Layout | Layout style for the header. Options include:
|
For example, in the Editor, print the example filefourier_demo2.m
with a standard two line header and a double line border.
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 theFontstab. (OnmacOSplatforms, selectMATLABin theSettingsmenu to see theFontstab.)
In theChoose fontfield, selectHeaderto change the font for the header text, orBodyto change the font for all of text in Command Window or Editor except for header text.
SelectUse custom fontand then specify the font name, style, and size. TheSamplearea shows a preview of the selected font.