Desktop Tools and Development Environment Previous page   Next Page

Example of Publishing with Text Markup

This simple example adds text markup to the sine_wave.m file used in Example of Publishing Without Text Markup to produce the following published HTML document. General instructions for marking up M-files for publishing are in the section after the following example.

Image of file published with text markup, highlighting key features. The resulting HTML file includes a title, equations in comments displayed using TeX, monospace font in comments to indicate code, and a smaller size plot.

  1. Add an overall title for the published document
    1. Add a blank line at the top of the file.
    2. Select Cell -> Insert Text Markup -> Cell Title. MATLAB adds the following in the new blank line and adds a blank line beneath it.
    1. Type over the text TITLE, replacing it with Plot Sine Wave. Add a comment about the overall file in line 2. Type
  2. Display equations in comments with symbols and Greek characters using the TeX format. For a list of symbols you can display and the character sequence to create them, see the String property on the MATLAB reference page for graphics text properties. In this example, use text markup to create a comment containing an equation:
    1. Position the cursor in line 5, Define the range for x.
    2. Using text markup, insert a comment containing the equation
    1. Type the following TeX equation to replace the sample equation.
  3. Display selected comment text in a monospaced font.
    1. Position the cursor in the comment in line 9.
    1. To make the equation y = sin(x) appear in monospace in the published document, add the | symbol before and after the equation so it appears as follows.
  4. To reduce the size of the resulting figure, select File -> Preferences -> Editor/Debugger -> Publishing Images. In the Preferences dialog box, for Resize image, select the check box Restrict height to and enter 200 for the number of pixels. Click OK to close the dialog box.
  5. Select File -> Save and Publish to HTML.
  1. The HTML file displays in your system's default browser, as shown at the start of this example, Example of Publishing with Text Markup.

  1. By default, MATLAB stores the HTML document, sine_wave.html, and the associated image files in d:/mymfiles/html for this example.

The file sine_wave.m now appears as shown in the following illustration.

Image of modified sine_wave.m file.


Previous page  Example of Publishing Without Text Markup Marking Up Text in Cells for Publishing Next page

© 1994-2005 The MathWorks, Inc.