Technical Support
Forums and Mailing Lists
Search Mackichan Web

SWP & SW
Version 5/5.5

Installation
Word Processing
Computations
Typesetting
File Issues
Graphics
Exam Builder
Style Editor
Other
Free Updates
Technical Articles

Scientific Notebook
Support Information
Troubleshooting

TeXnology
BibDB
TeXnology links

Document 551

Adding TeX and LaTeX commands to a document

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

You can use TeX commands with certain LaTeX packages to send precise typesetting instructions to LaTeX or pdfLaTeX. The documentation for each package outlines the syntax and arguments of any available commands and explains whether the commands should be placed in the preamble or in TeX fields in the body of your document.

In either case, you must make certain you enter correctly formatted LaTeX to avoid typesetting difficulties and possible damage to your document.

The preamble can contain definitions such as \newtheorem, \newcommand, \def, and \renewcommand, but must not contain any commands that generate typeset output. If you incorrectly enter any commands in the preamble, you can damage your document irreparably.

How to add a command in the preamble of your document

  1. From the Typeset menu, choose Preamble.

  2. Click the mouse in the entry area.

    CautionIf you are using Version 3.x or 4.x and you begin typing without first clicking in the area, you will overwrite any commands already in the preamble. Choose Cancel to leave the preamble unchanged.

  3. Enter the commands.

  4. Choose OK.

How to enter a TeX field

  1. If you have Version 4.0 or later, click the TeX button tex.wmf on the Typeset Object toolbar, or, from the Insert menu, choose Typeset Object and then choose TeX Field.

    If you have an earlier version, click the TeX button tex.wmf on the Typeset Field toolbar, or, from the Insert menu, choose Field and then choose TeX.

  2. In the TeX Field dialog box, type the TeX command preceded by a backslash (\).

  3. Choose OK.

The program inserts in your document a field containing the command. On the screen, the field appears as a small gray box, like this: texfield.wmf . When you save your document, the program interprets the TeX command and inserts it directly into the document file.

How to enter an encapsulated TeX field

If you want to prevent the program from interpreting the command in a TeX field, you can encapsulate and name the field. Then, when you save your document, the program stores the name and the command exactly as you entered them. The program preserves the exact syntax of the field when you save and reload the document. When you open the document again, the program displays the field on the screen as a small gray box with the field name in brackets, like this encapsulate.wmf . When you typeset the document, TeX interprets the encapsulated field and inserts the command in the DVI file.

NoteIncorrect code in an encapsulated field won't cause the program to fail when you open your document, because the code remains hidden. However, it will prevent LaTeX from typesetting the document. Incorrect code in an unencapsulated TeX field could damage your document.

  1. If you have Version 4.0 or later, click the TeX button tex.wmf on the Typeset Object toolbar, or, from the Insert menu, choose Typeset Object and then choose TeX Field.

    If you have an earlier version, click the TeX button tex.wmf on the Typeset Field toolbar, or, from the Insert menu, choose Field and then choose TeX.

  2. Check the Encapsulated box.

  3. Enter a name for the field.

  4. In the entry area, type the content and choose OK.

Last revised 01/20/06

This document was created with Scientific WorkPlace.



MacKichan Software, Inc. 19689 7th Avenue NE, Suite 183 #238 Poulsbo, WA 98370
Phone: 360-394-6033 Toll-free: 877-724-9673 Fax: 360-394-6039

Please email comments and suggestions regarding this site to webmaster@mackichan.com.
© Copyright 1998 - MacKichan Software, Inc. All rights reserved.