|
Document 146
How to use a LaTeX style not provided with SW
Version 2.5 - Scientific Word
You can use your favorite LaTeX style in version 2.5 of SW if you place it in
the correct directory, then modify the .lat file associated with the type of
document the style creates (for example, if the style is a report style, the
.lat file is report.lat). Modifying the .lat file ensures that the name of the
style you add appears as an option when you want to choose a style using the
New command on the File
menu.
About the .lat file
Each .lat file contains a section for each style with which the .lat file is
associated. Each section has these entries:
[stylename]
DESCRIPTION=My Favorite Style
DOCSTYLE=entry
SHELLFILE=entry
CSTFILE=entry
DOCCLASS=entry
PACKAGES=entry
When you add a style, you must modify the associated .lat file by adding a
section for the new style. However, you must change the .lat file very
carefully, because this action has serious consequences:
-
The information you enter in the DOCCLASS, DOCSTYLE and PACKAGES statements
for a given style is placed directly in any .tex document that you create with
the style.
-
The .lat file entries determine the version of LaTeX with which you can use a
given style.
-
To use a style with LaTeX 2.09, the DOCSTYLE item must have an entry and the
entry must be correct. If the entry is wrong, documents created with the style
won't compile. To prevent a style from being used with LaTeX 2.09, leave the
DOCSTYLE entry blank.
-
To use a style with LaTeX 2e, the DOCCLASS item must have an entry and the
entry must be correct. If the entry is wrong, documents created with the style
won't compile. To prevent a style from being used with LaTeX 2e, leave the
DOCCLASS entry blank.
-
Use the PACKAGES statement only for LaTeX 2e styles. LaTeX 2.09 ignores
PACKAGES entry. Include only one package in the PACKAGES statement.
-
To use a style with both LaTeX 2.09 and LaTeX 2e, create an entry for all
three items: DOCSTYLE, DOCCLASS and PACKAGES.
-
Some examples:
The following entries support a style that can be used with LaTeX 2.09:
[section name]
DESCRIPTION=a description
DOCSTYLE=[options]{basestyle}
SHELLFILE=shellfile
CSTFILE=cstfile
DOCCLASS=
PACKAGES=
The following entries support a style that can be used with LaTeX 2e:
[section name]
DESCRIPTION=a description
DOCSTYLE=
SHELLFILE=shellfile
CSTFILE=cstfile
DOCCLASS=[options]{baseclass}
PACKAGES=[options]{pkg}
The following entries support a style that can be used with both LaTeX 2.09
and with LaTeX 2e.
[section name]
DESCRIPTION=a description
DOCSTYLE=[options]{basestyle}
SHELLFILE=shellfile
CSTFILE=cstfile
DOCCLASS=[options]{baseclass}
PACKAGES=[options]{pkg}
Adding a style
To add another style:
Remember
The information in .lat files
is delicate and changing it incorrectly can cause serious difficulties. You
may want to consult with a local LaTeX expert before undertaking this action.
-
Place the LaTeX style file in the \sw25\tex\macros directory.
-
Add a section to the .lat file:
-
Using an ASCII editor, open the .lat file for the type of style you want to
add.
The file will be located in one of the subdirectories of the sw25\styles
directory.
-
Add these lines to the end of the file, substituting the name of your style
file:
[stylename]
DESCRIPTION=My Favorite Style
DOCSTYLE=
SHELLFILE=entry
CSTFILE=entry
DOCCLASS=
PACKAGES=
-
Save the file.
-
Modify the new section:
Perhaps the easiest and best way to find correct content for the .lat file
statements is to copy it from a .tex file that uses the style in question or,
in the case of the SHELLFILE and CSTFILE statements, from other sections in
the .lat file.
-
To create the SHELLFILE and CSTFILE statements:
-
Using an ASCII editor, open the .lat file.
-
Search the .lat file for the section pertaining to a style similar to the one
being added.
-
Find the SHELLFILE statement and copy the entry to the SHELLFILE field in the
new section.
-
Find the CSTFILE statement and copy the entry to the CSTFILE field in the new
section.
-
Save the .lat file.
-
To copy the DOCSTYLE statement from an existing .tex file:
-
Using an ASCII editor, open a .tex file that uses the style in question.
-
Find the LaTeX \documentstyle statement, which looks something like this:
\documentstyle[opt1,opt2,...]{basestyle}
-
Copy the [opt1,opt2,...]{basestyle}part of the
statement.
-
Paste the copied information into the DOCSTYLE field in the new section of the
.lat file, so that the statement reads
DOCSTYLE=[opt1,opt2,...]{basestyle}
-
Save the .lat file.
-
To copy the DOCCLASS statement from an existing .tex file:
-
Return to the .tex file that uses the style in question.
-
Find the LaTeX \documentclass statement, which has this form:
\documentclass[opt1,opt2,...]{basestyle}
-
Copy the [opt1,opt2,...]{basestyle}part of the
statement.
-
Paste the copied information into the DOCCLASS field in the new section of the
.lat file, so that the statement reads
DOCCLASS=[opt1,opt2,...]{basestyle}
-
Save the .lat file.
-
To copy the PACKAGES statement from an existing .tex file:
-
Return to the .tex file that uses the style in question.
-
Find the LaTeX \usepackage statement, which has this form:
\usepackage[option]{pkgname}
-
Copy the [option]{pkgname}part of the statement.
-
Paste the copied information into the PACKAGES statement in the new section of
the .lat file, so that the statement reads
PACKAGES=[option]{pkgname}
-
Note that it isn't possible to have the .lat file generate more than one
\usepackage statement.
-
Save the .lat file.
-
Check that the file has been installed correctly:
-
Start SW.
-
From the File menu, choose
New.
-
Make sure your style is listed among the available styles.
Last revised 02/27/06
This document was created with Scientific WorkPlace.
|