Zum Inhalt springen
Home » Tutorial: Presenting Your Materials Using Mathcad

Tutorial: Presenting Your Materials Using Mathcad

    Whether for problem sets, lab reports, or papers, Mathcad provides an excellent environment for combining all the elements of a technical paper. You can place calculations, graphs, tables, text, images, and programs in a Mathcad worksheet to demonstrate your ideas and show solutions. The following tutorial provides information for creating effective documents efficiently. Browse these topics:

    • Creating and Using Mathcad Templates
    • Using Headers and Footers
    • Using Special Math Display Settings
    • Aligning Regions
    • Importing Graphics
    • Working with 2D Graphs
    • Working with Data


    Creating and Using Mathcad Templates

    There are three parts to this section. You will learn how to:

    1. Modify various settings in your worksheet.
    2. Save those settings in a template file.
    3. Open a new worksheet that uses the template you created.

    Part 1: Modifying Worksheet Settings

    To modify the default (or Normal) text style settings in your Mathcad worksheet:

    1. Create a new worksheet by clicking the New worksheet icon ( ) or by choosing New from the File menu. Choose the Normal template.
    2. Choose Style from the Format menu to pull up the Text Styles dialog box.
    3. Select Normal from the Styles list and then click the “Modify” button.
    4. In the Define Style dialog box, click the “Font” button. Change the Font size to 16 point and choose your favorite font. Sans serif fonts, such as Arial or Verdana, are usually best for displaying text on screen. You can also make the type bold, if you like.
    5. Click the “OK” button to exit this dialog box, and then click “OK” again to exit the Define Style dialog box. Finally, click “Close” to return to the worksheet.

    You have now changed the default text style of your worksheet. Start typing somewhere in the worksheet. The moment you type a space, your region will become a text region and you will see that your text is displayed in 16 point font. Alternatively, if you type a double quote in blank space you instantly get a text region.

    To modify the default variable and constant style settings:

    1. In this same worksheet, choose Equation from the Format menu.
    2. With Variables highlighted in the Style Name box, click the “Modify” button.
    3. In the Variables dialog box, change the Font size to 16 point and choose your favorite font. You may want to use a slightly different font for variables than you do for text. Often, variables and constants appear in a serif font, such as Times New Roman, even when a sans serif font is used for text.
    4. Click “OK” to close this dialog.
    5. In the Equation Format dialog box, select Constants from the Style Name popup menu. Then, follow the same font change procedure as above. Click “OK” to close the dialog boxes and effect these changes in your worksheet.

    To modify other settings, such as expression and equation display or symbolic evaluation style:

    1. Select Options from the Tools menu.
    2. On the Built-in Variables page, set the values of various built-in variables.
    3. On the Calculation page, set conditions for assumptions and display of symbolic operations.
    4. On the Display page, set the way expressions and equations are displayed for viewing and printing.
    5. On the Unit System page, set the unit system used by default in the worksheet.

    Each of these settings can be saved as a condition of the template file. If, for example, you always want to display bold equal signs as regular equal signs in your worksheet, you can set this under Options in the template file. Then, any time you create a worksheet from the template, this display setting will be in effect.

    Part 2: Saving a Worksheet as a Template

    1. To save a worksheet as a template:
    2. Choose Save As… under the File menu.
    3. Select Mathcad Template (*.mct) from the Save as type popup menu.
    4. Give your template a name that refers to the way in which it will be used, such as “presentation” or “lab report”.
    5. Save the template in the Templates directory of your installation of Mathcad. If you do this, the template will show up in the templates list when you create a new worksheet.

    Part 3: Opening a Worksheet with a Template

    Once you have customised a template to your liking and saved that template as an MCT file, you can open worksheets with these settings over and over again. You can also modify the template whenever and however you like. In order to streamline the use of templates, you always save to or keep copies of your template files in the Templates directory of your installation of Mathcad. Then, when you choose New from the File menu or use the pull down menu next to the New worksheet icon ( ), you will see your templates in this list.
    You can also modify existing templates. For instance, you might want to modify the Normal template, which is the default template used when you create a new worksheet. If you do this, you may want to save the original Normal template in a backup folder so you can get it back. Otherwise, you’ll have to reinstall the software.

    Limitations of Templates and Suggestions for Use

    There are a few settings that you can’t save in a template file because they are not conditions of the worksheet but of individual regions:

    • Settings in tables.
    • Other region-specific formatting such as highlighting or other settings from the Properties dialog box.
    • Session-specific settings such as those in the Preferences dialog box.
    • Despite these few limitations, there are many ways to use templates in StudyWorks. Here are a few suggestions:
    • Store often used formulas in the first page of a template.
    • Store often used graphics in one page of a template. Whatever you don’t use can be discarded.
    • Type a sample of each specially defined text style so you know at a glance what sort of formatting the worksheet has. You can always remove these text regions before you start using the worksheet.
    • Describe result or Math Options formatting that the template contains in a few brief sentences in the worksheet. Again, you can remove these regions before you start working.
    • If you have a lot of templates, create subfolders for them within the templates folder of your installation of Mathcad. Then, when you create a new worksheet and browse for a template file, you will see all the subfolders that contain your templates in the default view.

    Be creative when using templates and try to anticipate the needs of your students if you are creating worksheets for them to use, and your own needs if you are using Mathcad to make handouts, presentations, or tests. Each type of worksheet will have formatting that best suits its purpose.


    Using Headers and Footers

    Headers and footers allow you to create your own stamp on a document without needing to use regions in the worksheet itself. You can also insert pagination, date and time, file name, and even images. These settings can be saved in a template for use and reuse as you complete assignments. To gain access to the headers and footers in a file:

    1. Select Header and Footer… from the View menu.
    2. Click either the header or footer tab.
    3. Click in either the left, center, or right fields, and make selections from among various available options including page number, date, file name, date last saved, etc., using the buttons in the lower left area of the dialog box.
    4. Once you have customized the header and/or footer to your liking, click “OK” to dismiss the dialog box.

    The settings in this dialog box:

    appear as shown in the footer of the file when printed.

    Here is a header with an image shown in the right field:

    Note that you can place practically anything except a live math region into a header or footer.


    Using Special Math Display Settings

    When you enter an equality in your worksheet, you need to use the Boolean equal sign. It appears as a bold equal sign (=) and it serves the purpose of allowing you to solve the equation for any variable using the Variable Þ Solve command on the Symbolics menu. You will also use the Boolean equal sign to simply write equations. However, you probably won’t want the equal sign in this case to be bold, particularly if you’re trying to produce a nice looking, well formatted document. In order to format a bold equal sign as a regular equal sign, follow these steps:

    1. Create an equality using the Boolean equal sign (keystroke: [Ctrl]=).
    2. To format that one equation, right click on the bold equal sign and select View Equality As Þ Equals from the popup menu. When you click out of the equation or press [Enter], you will see this special formatting appear. Each time you click back in this region, the bold equal sign will reappear.
    3. To format all bold equal signs in your worksheet as regular equal signs, select Options from the Tools menu and go to the Display page. Select “Equal” for the View As option under Equality.

    You can also format other math operators from the Display page of the Options dialog box. It is particularly useful to be able to display multiplication as something other than the default small dot. It is often the case that you generally want a certain type of formatting for your operators, but you can override any worksheet-level setting you make by using the popup menu options available for a particular operator. Simply click on an operator and make your selection.


    Aligning Regions

    You can align regions using alignment buttons, menu commands, the worksheet ruler guidelines, or by nudging with arrow keys.

    Aligning Regions Vertically
    To align two or more selected regions along a vertical line midway between the leftmost and rightmost region:

    1. Select the regions you want to align.
    2. Choose Align Regions Þ Down from the Format menu.

    Note that this action makes it possible to inadvertently cause regions to overlap. If this happens, choose Separate Regions from the Format menu to separate them. Perform the same steps to align regions horizontally, choosing Align Regions Þ Across Across from the Format menu. In both cases, you can also use the alignment buttons on the Formatting toolbar.
    Setting Vertical Guidelines

    You can also align regions by setting vertical guidelines using the worksheet ruler under the View menu. Using these guidelines allows you to more easily align regions down multiple pages, and you can set as many guidelines as you need.

    To set a guideline on the ruler:

    1. Click on the ruler wherever you want the guideline to appear. A tab stop symbol appears on the ruler.
    2. Click on the tab stop symbol with the right mouse button and choose “Show Guideline” from the popup menu. A check appears next to the selection.
    3. You can also set guidelines and tabs using the Tabs choice on the Format menu.
      The guideline appears as a green vertical line in the worksheet. To remove a guideline, click on the ruler with the right mouse button where the guideline is located and choose “Show Guideline” to uncheck it. Alternatively, simply click and drag the tab stop associated with the guideline off the ruler and it will disappear.

    Nudging Regions

    1. Select the regions you want to align by clicking and dragging over them to get dotted line selection boxes around them.
    2. To select a single region or separated regions, hold down the [Ctrl] key while clicking on each one.
    3. Then use the arrow keys to nudge the regions in any direction you want to move them.

    Importing Graphics

    You can insert graphics into your worksheet by pasting them from the clipboard or referring to a file containing the graphics. Pasting a file is quick and easy and minimizes worksheet file size, particularly if you only need to use the image statically in a single file. Importing from a file to the Picture region offers other advantages, such as the ability to update the image in several files at once and manipulate the image with image processing functions once it is in your worksheet. The graphics formats allowed in a Picture region are BMP, GIF, JPG, PCX, and TGA.

    To paste an image from the clipboard:

    1. Copy the image to the clipboard.
    2. Click the mouse wherever you want to place the image.
    3. Choose Paste or Paste Special from the Edit menu to paste the image into the worksheet.

    When you choose Paste, the image on the clipboard is pasted according to the default information stored with it on the clipboard. If you want to paste the image as a particular kind of object (bitmap, linked object, or embedded object), choose Paste Special. To minimize the impact of graphics on worksheet file size, choose “Device Independent Bitmap” in the Paste Special dialog box when pasting images from the clipboard.

    To import an image from a file:

    1. Click the mouse wherever you want to put the image and choose Picture from the Insert menu.
    2. Type the double quotes key (“) to create a string. You will see an insertion point between double quotes.
    3. Type the path to the image file.

    Once you import an image into your worksheet, you can make a number of adjustments to its appearance using the Picture toolbar and the Properties dialog box. You can also format it as you would any other region by putting a frame around it, highlighting it, or disabling its calculation.


    If you change the original image file, you must click in the graphics region and choose Calculate from the Tools menu to update your worksheet.

    Other ways to import a bitmap from a file are to read the file in as a matrix of data, or insert the file as an object. See Mathcad Help for more information.

    Working with 2D Graphs

    2D graphing is essential in most math-related disciplines and it’s an important aspect of a majority of Mathcad worksheets. Here are a few quick tips. Look in Mathcad Help for more information about creating and formatting 2D graphs.

    • For plotting data, be sure to change the plot type to points from its default, lines. To do so, double click on the plot and, on the Traces page, change Lines to Points under “Type” for the plot you want to format.
    • To set appropriate x- and y-axis ranges, use the Zoom tool, or set the ranges numerically using the axis limit placeholders.
      • To use Zoom, right click the graph region and select Zoom from the popup menu. Click and drag on the plot to set a dotted line zoom box, and then click the Zoom button.
      • To set ranges numerically, click the graph region and position your cursor in one of the four axis limit placeholders. Enter new values in any or all the placeholders. Use the Tab key to jump from placeholder to placeholder.
    • The Trace tool allows you to look at individual values along a plot or plots. To use Trace, right click the graph region and select Trace from the popup menu. Click on the plot to set the position of the Trace crosshairs. Use the right and left arrow keys to move along a plot. Use the up and down arrow keys to jump from plot to plot in the graph.
    • To create a plot with error bars, you must give the graph region multiple arguments as follows:
      1. data set in the y-axis; data set or independent variable in the x-axis
      2. upper or lower limit as data, in the y-axis; data set or independent variable in the x-axis
      3. upper or lower limit as data, in the y-axis; data set or independent variable in the x-axis

    Then the plot type for traces 2 and 3 must be set to error. It is recommended that you set the trace 1 plot type to points, weight 2-4, no symbol. Here is a sample plot that shows those settings:

    Working with Data

    A variety of methods exist for importing and exporting data to and from Mathcad. File Input and Output components, and Data Tables, available from the Insert menu, give you the most control over which rows and columns are read, and delimeters between data. Data can also be read and stored using READPRN/WRITEPRN/APPENDPRN (for text files) and READBIN/ WRITEBIN (for binary files). These functions will also work with Mathcad’s nested matrix format.

    Data Tables

    To insert a Data Table, click in blank space in your worksheet, and choose Data Þ Table from the Insert menu, or right click in a blank space and select Insert ? Table from the popup menu. Data Tables have scroll bars to view large data sets. Data Tables can be used for typing entries individually, or for one-time importing of data (no link is retained to the original data source) permanently into Mathcad. Data is then stored inside the .mcd file.

    This Data Table contains annual totals of sunspots recorded from 1700 to 1995 — you can see the entire data set by scrolling in the table in Mathcad. The data was input to the table by right-clicking in the box at the upper-left corner, and selecting Import… from the popup menu.

    To extract the sunspot data for a particular year, use a lookup function:

    Once this data has been embedded in your Mathcad worksheet, you can use it as you would any Mathcad matrix:

    Writing data

    To write data to a file, use a File Output component or the WRITEPRN command:

    If you right click on the disk icon that represents the File Output component, and choose Properties…, you can see the options for File Output. In this example, the Data Range tab has been used to output only the data for rows 50 to 100 from Data.

    The WRITEPRN statement outputs the whole file, and returns the value of the Data to the assigned variable, out.
    Any time a worksheet is recalculated, the component and the function will recalculate, overwriting the original file. If you wish to retain previous values and add to the end of the file, use APPENDPRN:

    The APPENDPRN function will create a file if none exists under that name, otherwise, it will add to it.

    Reading Data

    Here, the data that was written with the File Output Component is read back into Mathcad. Recall that only lines 50 through 100 were stored.

    The file can also be read in using the READPRN function:

    The above commands, File Input/Output components, and the PRN functions, are for interactive reading and writing of data, that is, they will execute every time the document is calculated, unlike the importing of data into a Data Table, which happens only once. Note that you can also read Excel files and other spreadsheet and data application files in using the File Input/Output components.