Main Content

设置打印选项命令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 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.exportsettings 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:

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

广告d 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 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:

  • 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 filefourier_demo2.mwith 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 theFontstab. (OnmacOSplatforms, selectMATLABin theSettingsmenu to see theFontstab.)

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

  3. SelectUse custom fontand then specify the font name, style, and size. TheSamplearea shows a preview of the selected font.

See Also

|

Related Topics