Main Content

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 OptionDescription
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:

  • Black and white text — MATLAB elements print in black and white with no highlighting.

  • Colored Text — MATLAB elements print using the syntax highlighting colors displayed in the Command Window or Editor.

  • Styled Text — Keywords print in bold, comments print in italics, and all other text prints as plain text. Output is not styled.

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 OptionDescription
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:

  • Standard one line

    Current date and time, file name, and page number all on one line

  • Standard two lines

    File name and page number on line one, current date and time on line two

  • Simple one line

    File name and page number on one line

  • Simple two lines

    File name and page number on line one, file path and current date on line two

    (This option is not available for Command Window printing.)

For example, in the Editor, print the example file fourier_demo2.m with a standard two line header and a double line border.

Printed file showing 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:

  1. In the Page Setup dialog box, select the Fonts tab. (On macOS platforms, select MATLAB in the Settings menu to see the Fonts tab.)

  2. 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.

  3. 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

|

Related Topics