Document 301

How to add LaTeX typesetting specifications to SWP/SW: a closer look at some details

Version: 3.x - Scientific WorkPlace & Scientific Word

Following is another example of adding LaTeX typesetting specifications to SWP/SW. This example uses LaTeX typesetting files found at http://www.ai.uga.edu/ftplib/thesis/ for theses for the University of Georgia, and follows the steps in the article Using shells and typesetting specifications from outside sources.

Note that these instructions are written for SWP/SW Version 3.0, but also apply to Versions 3.5 and 3.51 with appropriate changes in the directory names used.

1. Locate the LaTeX files.

In this case, the files uga.sty and ugasample.tex are located in the 2001 version (2.0) directory of an ftp site at the University of Georgia: http://www.ai.uga.edu/ftplib/thesis/.

2. Move the LaTeX files so they will be available to TrueTeX.

The new directory c:\swp30\TCITeX\TeX\LaTeX\contrib\other\uga was created and the file uga.sty was placed in this directory. This article assumes you have installed SWP in the directory c:\swp30. Adjust this path as necessary for your installation.

3. Complete any further installation steps required for the LaTeX files.

No other steps are needed in this case.

4. Test the sample documents included with the package distribution.

The sample file ugasample.tex was copied to the directory c:\swp30\docs. The TrueTeX Formatter was started using the Start menu. No LaTeX errors were reported and the sample document compiled and was viewed using the TrueTeX Previewer without difficulty.

5. Try opening the sample document in SWP/SW.

No problem. Save the document with a new name. Preview the document from inside SWP and compare with the previous results. Compare with the preview of the sample document. The only noticeable difference is that the table of contents now comes before the Acknowledgements and Preface. This is expected since the table of contents is a front matter item and the other items are in the body of the text. The table of contents can be moved by placing an encapsulated TeX field containing \tableofcontents after the Preface and removing the Make TOC tag from the front matter. There are several screen display problems with the sample document inside of SWP. These will be addressed next by using a new .cst file.

6. If needed, create a screen style (.cst) file.

The uga style uses the standard LaTeX report document class, so report.cst is picked up as the .cst file used by the sample document. The uga package adds several elements that need corresponding entries in the .cst file, so copy the file Styles\report\report.cst to Styles\[Special]\uga.sty. In order to have the SWP sample document use the new .cst file, edit the SWP sample document and replace the line:

%TCIDATA{CSTFile=report.cst}

with:

%TCIDATA{CSTFile=uga.cst}

The %TCIDATA line is added to the document when SWP saves the document.

7. As necessary, make modifications to the .cst file.

Inspecting uga.sty shows that several new document elements are added by this style. Adding these elements to the SWP visual interface requires additional entries in the .cst file. The new elements are similar to new elements added to other thesis styles, so comparing the .cst files of other thesis styles can be helpful. Inspecting uga.sty and the sample document, the following new style elements (showing a sample usage) were found:

\pseudochapter{Acknowledgements}

\previousdegrees{B.A., The University of Georgia, 1977 \\

M.Phil., Cambridge University, 1978}

\thisdegree{Doctor of Philosophy} % or Master of Science, etc.

\thesistype{Dissertation} % or Thesis, or Technical Report

\thesisyear{1991} % year degree is to be conferred

\nocopyright % include this only if you DON'T want a copyright page

\fulltitle{Syntactic Theory in the High Middle Ages}

\professor{Abraham Baldwin} % your major professor

\indexwords{syntax, semantics, medieval~Latin, Modistae}

\begin{reflist}

Abrahams, P. W.; Berry, K.; and Hargreaves, K. A. (1990)

{\em TeX for the Impatient.} Reading, Mass.: Addison--Wesley.

Knuth, D. E. (1984) {\em The TeXbook.} Reading, Mass.: Addison--Wesley.

Lamport, L. (1986) {\em LaTeX: A Document Preparation System.} Reading,

Mass.: Addison--Wesley.

\end{reflist}

The \pseudochapter is a new division element. Unfortunately, the division elements are hard coded in SWP and a new division element cannot be added via the .cst file. The \pseudochapter elements will appear as TeX fields in the document.

The front matter elements (\previousdegrees through \indexwords in the above list) can be implemented using QTagDef statements in the [Filters] section and then appropriate corresponding sections in the body of the .cst file. The following lines were added to the [Filters] section:

\QTagDef{previousdegrees}{101}{}

\QTagDef{thisdegree}{102}{}

\QTagDef{thesistype}{103}{}

\QTagDef{thesisyear}{104}{}

\QTagDef{fulltitle}{105}{}

\QTagDef{professor}{106}{}

\QTagDef{indexwords}{107}{}

\QTagDef{nocopyright}[0]{108}{}

and the following corresponding items were added to the body of the .cst file:

[f_101]

ALIAS=previousdegrees

TAG_TYPE=FIELD

TAG_LEADIN=Previous Degrees:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_102]

ALIAS=thisdegree

TAG_TYPE=FIELD

TAG_LEADIN=This Degree:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_103]

ALIAS=thesistype

TAG_TYPE=FIELD

TAG_LEADIN=Thesis Type:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_104]

ALIAS=thesisyear

TAG_TYPE=FIELD

TAG_LEADIN=Thesis Year:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_105]

ALIAS=fulltitle

TAG_TYPE=FIELD

TAG_LEADIN=Full Title:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_106]

ALIAS=professor

TAG_TYPE=FIELD

TAG_LEADIN=Professor:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_107]

ALIAS=indexwords

TAG_TYPE=FIELD

TAG_LEADIN=Index words:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

[f_108]

ALIAS=nocopyright

TAG_TYPE=FIELD

TAG_LEADIN=Nocopyright

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

LEADIN_BACKGROUND_COLOR=R:225 G:225 B:225

LEADIN_FONT_FACE=Arial

LEADIN_FONT_WEIGHT=700

LEADIN_LABELSEP=4

LEADIN_LABELwidth=62

PARAGRAPH_INDENT_REST=48

PARAGRAPH_INDENT_RIGHT=-18

The new front matter elements were located in the preamble of the document, so an ASCII editor was used to move them after the \begin{document} statement so the elements would appear properly in the front matter.

The LaTeX report document class does not use the abstract object, so a corresponding entry is missing from the .cst file. To add the SWP screen appearance for the abstract, add the following to the .cst file:

[abstract]

TAG_TYPE=FIELD

TAG_LEADIN=Abstract:

TAG_BEHAVIOR=FRONTMATTER\NOSTRUCTURETAGS\NOENVTAGS

The uga style also implements a reflist environment for creating a bibliography, but since the normal manual entry bibliography method supported by SWP is also allowed, the reflist environment is not used.

Another environment implemented by the uga style is singlespace. It can be used inside of the verse environment to allow single spaced text instead of the normal double spaced text. The singlespace environment is not supported by the SWP visual interface. You can use this environment by adding encapsulated TeX fields at the beginning and ending of the single spaced text. Be careful that each encapsulated TeX field containing \begin{singlespace} has a matching \end{singlespace} encapsulated TeX field.

8. Create a new shell document.

The shell documents provided with SWP typically contain many of the various document elements. When theorem-like elements were added to the existing sample document, LaTeX errors resulted because the appropriate \newtheorem statements were not in the preamble of the document. After copying the appropriate \newtheorem statements to the preamble (see Numbering of theorem environments to select the theorem numbering style), the new sample document compiled without errors. The sample document was saved as Thesis - University of Georgia.shl in the directory c:\swp30\Shells\Other Documents using the Shell *.shl Save as Type.

See also

Revised 03/06/01, 06/13/02, 9/12/02, 07/23/04

This document was created with Scientific WorkPlace.