![]() Volume 9, Issue 2 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff Submissions Subscriptions Advertising Back Issues Contact Information |
AuthorTools: A Package for Document Processing
Palettes Introduction The AuthorTools palettes provide an easy point-and-click interface to the package functions. You can use the palettes to process either a single notebook or multiple notebooks in a single directory. To process a single notebook: 1. Open the notebook. If it is already open, click the notebook to select it. 2. Click a button on the palette you want to use. To process multiple notebooks: 1. Open the MakeProject dialog box. 2. Click Load and choose a project file. (If you have not already created a project file, see Creating a Project File to learn how.) 3. With the MakeProject dialog box as the input notebook, click a button on the palette you want to use. The palette functions will apply to all notebooks that belong to the specified project. OpenAuthorTools The OpenAuthorTools palette provides a convenient way to access the other palettes in the package. Choose any topic to open the corresponding palette. Click the top button of this or any other palette to get help.
MakeProject Introduction The MakeProject dialog box makes it easy to set up and manage projects involving multiple notebooks. For example, you can use this dialog box to generate a unified table of contents or index for a set of notebooks.
Creating a Project File The first step in processing multiple notebooks is to create a project file. This is a file that specifies the names and location of all notebooks in a project. You can create any number of project files, one for each project you are working on. Each project file has a .m suffix. To create a project file: 1. Open the MakeProject dialog box. 2. Type in a name for your project in the Name of Project text box. 3. Choose Target Directory. A file browse dialog box appears. 4. Select a file in the directory containing your source notebooks. The full pathname of the directory is pasted into the Directory text box. 5. Choose Select All. A list of all notebook files in the directory you specified appears in the Files text box. 6. Edit the list to delete any notebooks that do not belong in the project. 7. Choose Save under the Project File tab to save the project file. Handling a Project To process all notebooks in a project: 1. Open the MakeProject dialog box. 2. Click Load and choose the project file you need. (If you have not already created a project file, see Creating a Project File to learn how.) 3. With the MakeProject dialog box as the input notebook, click a button on the palette you want to use. The palette functions will apply to all notebooks in the specified project. Once you have loaded a project, you can use the buttons under the Project Actions tab to perform a variety of tasks.
MakeContents Introduction The MakeContents palette enables you to generate a table of contents for any notebook or group of notebooks.
You can format your table of contents in any of three predefined styles:
Creating a Table of Contents To create a table of contents: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the MakeContents palette. 3. Choose Paginate to assign page numbers to the source notebooks. You can skip this step if you have paginated the notebooks previously or are creating a Simple table of contents, which does not contain any page numbers. 4. Choose either Make Simple Contents, Make Book Contents, or Make Condensed Contents, depending on which style of table of contents you want to create. It may take a few moments for the evaluation to be completed, depending on the size of the source notebooks. The newly generated table of contents appears on the screen and is saved in the same directory as the source notebook. Note: Mathematica automatically adds cell tags to the source notebooks and saves all changes. It is therefore advisable to make a back-up copy of your notebooks before generating a table of contents. Customizing a Table of Contents The buttons at the bottom of the palette let you specify options to customize various features of the table of contents. To set the value of an option, click the button bearing the name of that option. This brings up a dialog box displaying the current value of the option. You can edit the text and click Apply for the changes to take effect. Click OK to close the dialog box.
MakeCategories Introduction A BrowserCategories.m file determines how information is organized and displayed in the Mathematica Help Browser. The MakeCategories palette enables you to generate a BrowserCategories.m file for your notebook or project. By creating such a file, you can add your own content to the online help so it is accessible from the Help Browser.
Outline Format When generating a browser categories file, Mathematica assumes the source notebook is in strict outline format. This means all cells in the notebook are arranged in a consistent hierarchical order. Consider a notebook composed entirely of Section, Subsection, and Text cells. If every Text cell is contained in a Subsection cell and every Subsection cell is contained in a Section cell, as shown here, the notebook is said to be in strict outline format.
However, if the following sequence of cells occurs anywhere in the notebook, the hierarchical structure breaks down. This is because in the resulting browser categories file, the Section cell will have to serve both as an item (to display the Text cell) and a category (to contain the Subsection cell), which is not possible.
Note that if a Section cell contains only Text cells and no Subsection cells as shown here, the strict outline format is again restored, since now each Section cell can serve as an item.
Note: If you attempt to generate a browser categories file from a notebook that is not in strict outline format, you will get a warning message. The resulting browser categories file will ignore the presence of any cells that stray from the strict outline format, so those cells will not be viewable in the Help Browser. Creating Browser Categories To generate a browser categories file: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the MakeCategories palette. 3. Choose Make Browser Categories. A browser categories file is created and saved in the same directory as your source notebook. Cell tags are automatically added to the input notebook. Note: When you generate a browser categories file, your source notebooks are modified and all changes are automatically saved. It is therefore advisable to make a back-up copy of your notebook before using this palette. The BrowserCategories palette automatically inserts cell tags into the target notebook. To remove the automatically generated cell tags in the source notebook(s), click Clear Cell Tags. If you remove the cell tags, the hyperlinks in the table of contents will take you to the start of the notebook instead of to a specific topic. Customizing the Browser Categories The three buttons at the bottom of the palette enable you to specify options to customize various features of the BrowserCategories.m file. To set the value of an option, click the button bearing the name of that option. This brings up a dialog box displaying the current value of the option. You can edit the text and click Apply for the changes to take effect. Click OK to close the dialog box. Here are the options:
MakeIndex Introduction The MakeIndex palette enables you to generate an index for your notebook or project. Mathematica calculates page numbers for all the index entries you specify and lists them in alphabetical order. Each entry in the index is hyperlinked to the related material in the source notebooks.
To create an index for a document, you must assign an index entry to each cell in the notebook that will be referenced in the index. This is done using the Edit Notebook Index dialog box of the MakeIndex palette. Once all the index entries have been defined, you can use the palette to generate the index. For any document, you can generate several different types of indexes. Simple Index A Simple Index is used to check that all the index entries you specified were entered correctly. It lists all index entries, including duplicates and subentries, on separate lines. The text of the hyperlink for each entry consists of the cell tag of the target material and the name of the notebook in which it occurs. The Simple Index is saved in the same directory as the source notebooks. By default the file is called SimpleIndex.nb, but you can specify a different name using the Set Index FileName button at the bottom of the palette. Book Index A Book Index contains all the index entries formatted with the following features.
element, 2
If the Book index builds without error, it is saved in the same directory as the source notebooks. By default the file is called BookIndex.nb, but you can specify a different name using the Set Index FileName button at the bottom of the palette. Two-Column Index A two-column index has the same features as a Book Index, except that the entries are arranged in two columns. If the Two-Column Index builds without error, it is saved in the same directory as the source notebooks. By default the file is called TwoColumnIndex.nb, but you can specify a different name using the Set Index FileName button at the bottom of the palette. Browser Index A browser index file defines a list of keywords to be included in the Master Index of the Help Browser. By creating a browser index for your notebooks, you can integrate your own reference material into the existing online help. For the BrowserIndex.nb file to be compiled without error, an appropriate browser categories file must exist in the same directory as the source notebooks. To create a browser categories file, you can use the MakeCategories palette included with AuthorTools. Setting Up an Index Setting Up Index Entries To create an index, you must associate index entries with specific cells in your source notebooks. This is done using the Edit Notebook Index dialog box, which allows you to add, edit, and remove index entries.
This dialog box contains three text boxes: Index Main Entry--This specifies a term in the index. Index Sub-Entry--This is useful for distinguishing two cells that fall under the same main entry. Short Form--This defines a short word or phrase to represent the entry in the Master Index of the Help Browser. To associate an index entry with a cell (or group of cells): 1. Select the cell(s). 2. Specify the entry by typing it into the text fields of the dialog box. The main entry and subentry can be either a string or a two-dimensional expression, but the short form must be a string. 3. Choose Tag Current Cell to assign the entry to the selected cell(s). Any index entries associated with a cell are displayed in the box at the bottom of the dialog box, if you select that cell. After you add a new entry, you can choose Update Tag List to check that the entry you specified has been assigned. Note: Alternatively, you can select all or part of a cell's contents and click the Index Cell on Selection button. This makes the index entry for the cell the same as the selected text. To edit or remove an index entry: 1. Select the cell. A list of the currently assigned entries associated with that cell is displayed at the bottom of the dialog box. Each entry also has hyperlinks marked Edit and Remove next to it. 2. Click Edit to edit the entry or Remove to remove it. 3. Edit the entries displayed in the text fields of the dialog box. 4. Choose Tag Current Cell. This replaces the entry you edited with the new entry. To generate an index: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the MakeIndex palette. 3. Click Edit Notebook Index. This brings up a dialog box. 4. Use this dialog box to associate index entries with all cells in the notebook that are to be referenced in the index. 5. Choose Paginate to assign page numbers to the source notebooks. You can skip this step if you have paginated the notebooks previously or if you are creating a Simple index, which does not contain any page numbers. 6. Click the button corresponding to the type of index you want to create. For example, to build a Simple index choose Make Simple Index. The other formats available are Book Index, Two Column Index, and Browser Index. (See MakeIndex to learn about the differences among these four types of index.) Note: Mathematica automatically creates an index based on all the index entries that you defined. The index is saved as a separate notebook in the same directory as the source notebook. Browser Index When you choose an entry in a browser index, the target cells are displayed in the Help Browser. For the index entries to work properly, an appropriate browser categories file must be present in the same directory as the source notebooks. If you associate an index entry with a cell that cannot be displayed in the Help Browser, the index entry will bear the label "match not found" to indicate that the entry does not have a well-defined target. For a cell to be displayed in the Help Browser, the browser categories file must contain an item corresponding to that cell. If no such item is present, the cells are not the target of a terminal category in the columns of the Help Browser and so the index entry cannot link to those cells. This can happen if the source notebook is not in strict outline format and the target cells fall outside the outline. Even if the source notebook is in outline format but the target cell is a heading cell that does not correspond to an item in the browser categories file, the index entry will not work. To fix an index entry that does not have a match: 1. Edit the browser categories file by hand to insert an item corresponding to the target cells for the index entry. (For details of how browser categories files work, see Creating a Browser Categories File.) 2. Use the MakeIndex palette to regenerate the browser index. Paginate Introduction The Paginate palette enables you to assign page numbers to one or more notebooks. You must paginate your source notebooks at least once before you generate a table of contents or index. Otherwise, the table of contents or index will not contain any page numbers.
Paginating Notebooks To paginate one or more notebooks: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the Paginate palette. 3. Choose Paginate. Options for Pagination The three buttons at the bottom of the palette enable you to specify options that control how the page numbers are assigned. To set the value of an option, click the button bearing the name of that option. This brings up a dialog box displaying the current value of the option. You can edit the text and click Apply for the changes to take effect. Click OK to close the dialog box. Here are the options:
If
MakeBilateralCells Introduction The MakeBilateralCells palette allows you to display Mathematica calculations in a compact, bilateral format. Each bilateral cell consists of expository text to the left and input and output cells to the right. Bilateral cells are used extensively in The Mathematica Book to display examples.
Creating Bilateral Cells To convert a Mathematica example into bilateral form: 1. Create the example you want to convert to bilateral form. By default, each example must consist of a single MathCaption cell followed by any number of input and output cells. However, you can change the cell styles used to construct a bilateral cell, as explained in Specifying Cell Styles. 2. Open the MakeBilateralCell palette. 3. Select the cells you want to format. 4. Choose Make Selection Bilateral. The selected cells are automatically converted into bilateral cells. The text from each MathCaption cell appears in the left column while the corresponding input and output cells appear in the right column. For example, consider the following sequence of cells: Here is the integral
If you select the cells and choose Make Selection Bilateral, all three cells are combined into a bilateral cell.
If you have a notebook containing multiple Mathematica examples, you can convert all the examples into bilateral form in one step. Each example must consist of a single MathCaption cell followed by any number of input and output cells. To convert all examples in a notebook or project into bilateral form: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the MakeBilateralCell palette. 3. Choose Make All Bilateral. Mathematica automatically finds all cases in the notebook where input and output cells follow a MathCaption cell and converts each such example into a single bilateral cell. Dividing Bilateral Cells Once you have created a bilateral cell, you can reverse the process and convert the cell back into its constituent Input, Output, and MathCaption cells. To do this, select the bilateral cell and choose Divide Bilateral Cell. To divide all bilateral cells in a notebook in one step, select the notebook and choose Divide All Bilateral. Updating Bilateral Cells Once you have created a bilateral cell, you cannot evaluate its input cells. If you want to modify the input and re-evaluate, you must divide the bilateral cell, evaluate the raw input cells, and then change your cells back into bilateral form. To modify input and output in a bilateral cell: 1. Select the bilateral cell and decompose it by choosing Divide Bilateral Cell. 2. Edit the cells you want to modify. 3. Select any Input cell you edited and re-evaluate it (by pressing 4. Reformat the group of cells by selecting it and choosing Make Selection Bilateral. Pasting Bilateral Templates Another way to create a bilateral cell is to first create a template and then add the content you need in the appropriate text fields. To create a template for a bilateral cell: 1. Open the MakeBilateralCell palette. 2. Place the cursor at the point where you want the bilateral cell to be created. 3. Choose Paste Template. A template is pasted into the notebook, containing some sample text. 4. Replace the sample text with material appropriate for your example. Specifying Cell Styles The two buttons at the bottom of the palette allow you to specify what cell styles should be used in creating a bilateral cell. To set the value of either option, click the appropriate button to bring up a dialog box. You can edit the text and click Apply for the changes to take effect. Click OK to close the dialog box.
ExportCells Introduction The ExportCells palette enables you to extract content of a specified type from a given notebook or project and save the content in a desired format. For example, you can extract all the graphics cells from a notebook and save each graphic as a separate GIF file.
You can extract content of the following types:
By default, the content is saved in a new notebook. However, you can choose from any of the other export formats supported by Mathematica: plain text, HTML, Exporting Cells To export all cells of a specified style: 1. For a single notebook, open it and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the ExportCells palette. 3. Choose Cells of Style. 4. In the dialog box that appears, enter the style of the cells you want to export. 5. Click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Then click OK. The cells you specified are extracted from the source notebooks and saved in the same directory. By default, the exported cells are saved in a new notebook. If you want to export cells in a different format, you must set the value of the option ExportFormat as explained in Specifying the Export Format. To export all cell groups of a specified style: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. 2. Open the ExportCells palette. 3. Choose Cell Groups of Style. 4. In the dialog box that appears, enter the style of the heading cells for the cell groups you want to export. Then click OK. The cells you specified are extracted from the source notebooks and saved in the same directory. By default, the exported cells are saved in a new notebook. If you want to export cells in a different format, you must set the value of the option ExportFormat, as explained in Specifying the Export Format. To export all cells having a specified cell tag: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. 2. Open the ExportCells palette. 3. Choose Cells with CellTag. 4. In the dialog box that appears, enter the cell tag of the cells you want to export. Then click OK. All cells with the cell tag you specified are extracted from the source notebooks and saved in the same directory. By default, the exported cells are saved in a new notebook. To export cells in a different format, you must set the value of the option ExportFormat as explained in Specifying the Export Format. Specifying the Export Format To specify the export format: 1. Choose ExportFormat. This brings up a dialog box showing the current setting of the ExportFormat option. 2. Specify the format you want to save in by typing it in the text box. You can also click a button bearing the name of a specific format to paste that format into the text box. 3. Click Apply for the new setting to take effect. Click OK or Close to close the dialog box. Specifying the Export Directory To specify the directory to export to: 1. Choose Export To Directory. This brings up a dialog box showing the current setting of the ExportDirectory option. 2. In the text box, enter the full pathname of the directory to which you want to save. You can also use the Browse button to bring up a file dialog box, then locate a file in the target directory and click Open. 3. Click Apply for the option to take effect. Click OK to close the dialog box. Specifying the Extraction Method To specify the extraction method: 1. Choose ExtractionMethod. This brings up a dialog box showing the current setting of the ExtractionMethod option. 2. Enter the extraction method you want to use in the text box. Possible settings are:
3. Click Apply for the new setting to take effect. Click OK or Close to close the dialog box. InsertValue Introduction Using the InsertValue palette, you can insert an object to display the current value of variables such as the names of the home directory or the preferences directory, as well as the current filename, pathname, date, or time. The display object, once inserted, is dynamically updated so it always reflects the current value of the variable.
For example, the text in the following cell contains display objects that refer to the current date and time. This ensures that each time the notebook is opened, the cell always shows the current date and time. Today's date is 4/6/04. You can choose from variables divided into three categories.
Inserting a Value To insert the value of a variable: 1. Open the InsertValue palette. 2. Choose any of the three categories: Date and Time, Files and Directories, or System Variables to view the buttons in that category. 3. Click the button with the name of the variable whose value you want to enter. The value of the selected variable is pasted into the notebook at the position of the cursor. SetPrintingOptions Introduction The SetPrintingOptions palette allows you to set options that control how a notebook is printed. You can use this palette, for example, to specify headers and footers, set the starting page number, or control the size of margins.
Headers and Footers You can specify different headers/footers for left and right pages. In addition, for each left or right page, you can specify three different types of headers/footers: left-aligned, right-aligned, and centered. To specify headers/footers for a document: 1. Open the SetPrintingOptions palette. 2. Choose Edit Headers and Footers. This brings up a dialog box. 3. Choose one of the horizontal tabs bearing the name of the header/footer you want to specify. A set of text boxes is displayed. 4. Enter the header/footer you want in the appropriate text box. You can either type text directly or choose Insert Value. This opens the InsertVariables palette for entering variables such as the filename or date. 5. To enter a running head, choose Insert Running Head, type a cell style in the dialog box that appears, and click OK. 6. When you have finished editing, click OK to close the Headers and Footers dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. To specify the facing of pages: Choose the appropriate setting for the Set Facing Pages option at the top of the dialog box. This option can be set to one of three different settings.
For the first two cases, you can specify separate headers/footers for left and right pages. For the third case, you can specify headers/footers for one type of page only. The number of text boxes available for displaying headers/footers change automatically to reflect this difference. To control whether headers/footers are printed on the first page: Click one of the radio buttons marked Yes or No after the "Header/Footer on First Page?" statement. To insert a line below/above all headers/footers: Click one of the radio buttons marked Yes or No after the "Left/Right Header/Footer Lines?" statement. Starting Page Number To specify the starting page number for the printed notebooks : 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the SetPrintingOptions palette. 3. Choose StartingPageNumber. This brings up a dialog box. 4. Enter the starting page number. 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Printing Margins To set the margins for the printed notebooks: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the SetPrintingOptions palette. 3. Choose PrintingMargins. This brings up a dialog box. 4. Enter the left, right, bottom, and top margins in printer's points (72 points equal one inch). 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Cell Brackets To specify whether cell brackets should be printed: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the SetPrintingOptions palette. 3. Choose PrintCellBrackets. This brings up an editing dialog box. 4. Click True if you want cell brackets to be printed and False otherwise. 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Selection Highlighting To specify whether the current selection should appear highlighted when a notebook is printed: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. 2. Open the SetPrintingOptions palette. 3. Choose SelectionHighlighting. This brings up an editing dialog box. 4. Click True if you want the notebook selection to appear highlighted in print and False otherwise. 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Registration Marks To specify whether trim marks should be added to indicate the corners of a printed page: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. 2. Open the SetPrintingOptions palette. 3. Choose RegistrationMarks. This brings up an editing dialog box. 4. Click True if you want trim marks to be printed and False otherwise. 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box. Multiple Horizontal Pages To specify whether cells that extend beyond the width of the page should be printed on additional pages: 1. For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the MakeProject dialog box and load the project file for your project. (If you have not already created a project file, see Creating a Project File to learn how.) 2. Open the SetPrintingOptions palette. 3. Choose MultipleHorizontalPages. This brings up an editing dialog box. 4. Click True if you want the cells to continue printing on another page. Click False if you want the cells to be chopped off at the edge of the page. 5. When you have finished editing, click OK to close the dialog box and apply the changes to your notebook. Click Cancel if you do not want the changes to be saved. Click Apply to apply the changes without closing the dialog box.
|
||||||||
About Mathematica | Download Mathematica Player Copyright © 2004 Wolfram Media, Inc. All rights reserved. |