Document 336

Adding a LaTeX package to SWP/SW: a closer look at some details

Version: 3.0, 3.5, 3.51, & 4.x - Scientific WorkPlace & Scientific Word

Following is another example of adding a LaTeX package to SWP/SW. This example uses the extsizes package CTAN: the Comprehensive TeX Archive Network and follows the steps in the article Using shells and typesetting specifications from outside sources.

Adding the extsizes package

The standard Latex classes (article, report, etc) support 10-, 11-, and 12-point text. These are the most commonly used sizes in publishing. However, for certain applications there may be a need for other sizes. The extsizes classes provide support for sizes 8-, 9-, 10-, 11-, 12-, 14-, 17- and 20-point type.

These instructions assume you have installed SW in the directory c:\swp35. Adjust this path as necessary for your installation.

Step 1. Locate the LaTeX package files.

In this case, the files are on CTAN in the directory macros/latex/contrib/extsizes/.

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

The new directory c:\swp35\TCITeX\TeX\LaTeX\contrib\other\extsizes was created and all of the files from CTAN were placed in this directory.

Step 3. Complete any further installation steps required for the LaTeX package.

No other steps are needed in this case.

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

A sample file is not included with this package distribution. This package implements extra base point size options for the LaTeX documentclasses article, report, book, letter, and proc. SWP and SW do not directly support the letter documentclass, so it is ignored. The following four sample documents were created to test the installation of the package:

  • Sample document 1

%testextarticle.tex

\documentclass[14pt]{extarticle}

\begin{document}

This is just some harmless text followed by some math:

$$

\frac{-b\pm \sqrt{b^{2}-4ac}}{2a}

$$

\end{document}

  • Sample document 2

%testextreport.tex

\documentclass[17pt]{extreport}

\begin{document}

This is just some harmless text followed by some math:

$$

\frac{-b\pm \sqrt{b^{2}-4ac}}{2a}

$$

\end{document}

  • Sample document 3

%testextbook.tex

documentclass[20pt]{extbook}

\begin{document}

This is just some harmless text followed by some math:

$$

\frac{-b\pm \sqrt{b^{2}-4ac}}{2a}

$$

\end{document}

  • Sample document 4

%testextproc.tex

\documentclass[9pt]{extproc}

\begin{document}

This is just some harmless text followed by some math:

$$

\frac{-b\pm \sqrt{b^{2}-4ac}}{2a}

$$

\end{document}

Each sample document was placed in the directory c:\swp35\docs and given the name indicated at the beginning of each sample. A different base point size was selected for each sample document. Each sample document was compiled using the TrueTeX Formatter started from the Windows Start Menu.

When using LaTeX to compile the sample documents, a LaTeX error will be generated if the latex_ml format file is used. This format file uses the dc font family, but the package apparently implements the ec font family. If the latex format is selected, the sample documents should compile without errors. This change can be made by selecting Typeset /Expert Settings/Format Settings, and choosing TrueTeX from the drop down list box.

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

In SWP or SW, select File /Open, highlight the four sample documents, and select Open. A message appears as each document is opened warning that the document may not open correctly. This is caused by the absence of a .cst file for the new documentclasses used by the sample documents. At this point, select Yes in answer to the question "Do you wish to continue?" and each sample document is successfully opened. Instructions for creating the .cst files are in the next step.

Save each sample document with a new name. Preview the document from inside SWP or SW and compare with the previous results. Remember, the latex_ml format file cannot be used with these documentclasses. In SWP or SW, select Typeset/Expert Settings and choose the Format Settings tab. Change TrueTeX MultiLingual to TrueTeX to change from using the latex_ml to the latex format file. Compare the preview of the sample documents saved using SWP or SW with the preview of the original sample documents. The previews should look the same.

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

When SWP or SW opens a document, it looks in several placed for a .cst file used when formatting the document for the screen. If it fails to find an appropriate .cst file, a warning message noted in the previous step is displayed. Since each documentclass implemented by this package is based on a similar standard LaTeX documentclass, an existing .cst file can be used, but it must be copied to a location needed by SWP or SW.

Create the following directories and copy and rename:

  1. extarticle: Create the directory c:\swp35\styles\extarticle. Copy the file c:\swp35\styles\article\article.cst to this new directory and rename the file so it becomes c:\swp35\styles\extarticle\extarticle.cst.

  2. extreport: Create the directory c:\swp35\styles\extreport. Copy the file c:\swp35\styles\report\report.cst to this new directory and rename the file so it becomes c:\swp35\styles\extreport\extreport.cst.

  3. extbook: Create the directory c:\swp35\styles\extbook. Copy the file c:\swp35\styles\book\book.cst to this new directory and rename the file so it becomes c:\swp35\styles\extbook\extbook.cst.

  4. extproc: Create the directory c:\swp35\styles\extproc. Copy the file c:\swp35\styles\article\article.cst to this new directory and rename the file so it becomes c:\swp35\styles\extproc\extproc.cst. Notice that article.cst file is used for extproc since the proc documentclass is not included with SW.

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

No modifications are needed to any of the .cst files used in the previous step. At this point, the sample documents can now be opened without a warning message.

Step 8. Create a new shell document.

The shell documents provided with SWP and SW typically contain many of the various document elements, but this is not strictly necessary. You can use the sample documents from step 5 above and save each sample document using the Shell (*.shl) file type in an appropriate directory, perhaps c:\swp35\Shells\Articles.

Step 9. Add access to the documentclass options (optional step).

SWP and SW use the file c:\swp35\Typeset\classes.opt to show the available settings for a document class. Use an ASCII editor to open c:\swp35\Typeset\classes.opt and add the following:

[extarticle]

1=Body text point size

1.1=8pt,8pt

1.2=9pt,9pt

1.3=10pt - default,

1.4=11pt,11pt

1.5=12pt,12pt

1.6=14pt,14pt

1.7=17pt,17pt

1.8=20pt,20pt

2=Paper size

2.1=8.5x11 - default,letterpaper

2.2=a4,a4paper

2.3=a5,a5paper

2.4=b5,b5paper

2.5=Legal size,legalpaper

2.6=Executive size,executivepaper

3=Orientation

3.1=Portrait - default,

3.2=Landscape,landscape

4=Print side

4.1=Print one side - default,oneside

4.2=Print both sides,twoside

5=Quality

5.1=Final - default,final

5.2=Draft,draft

6=Title page

6.1=Title page,titlepage

6.2=No title page,notitlepage

7=Columns

7.1=One column - default,onecolumn

7.2=Two columns,twocolumn

8=Equation numbering

8.1=Numbers on left,leqno

8.2=Numbers on right - default,

9=Displayed equations

9.1=Centered - default,

9.2=Flush left,fleqn

10=Bibliography style

10.1=Compressed - default,

10.2=Open,openbib

[extreport]

1=Body text point size

1.1=8pt,8pt

1.2=9pt,9pt 1.3=10pt - default,

1.4=11pt,11pt

1.5=12pt,12pt

1.6=14pt,14pt

1.7=17pt,17pt

1.8=20pt,20pt

2=Paper size

2.1=8.5x11 - default,letterpaper

2.2=a4,a4paper

2.3=a5,a5paper

2.4=b5,b5paper

2.5=Legal size,legalpaper

2.6=Executive size,executivepaper

3=Orientation

3.1=Portrait - default,

3.2=Landscape,landscape

4=Print side

4.1=Print one side - default,oneside

4.2=Print both sides,twoside

5=Quality

5.1=Final - default,final

5.2=Draft,draft

6=Title page

6.1=Title page,titlepage

6.2=No title page,notitlepage

7=Columns

7.1=One column - default,onecolumn

7.2=Two columns,twocolumn

8=Start chapter on left

8.1=No,openright

8.2=Yes - default,openany

9=Equation numbering

9.1=Numbers on left,leqno

9.2=Numbers on right - default,

10=Displayed equations

10.1=Centered - default,

10.2=Flush left,fleqn

11=Bibliography style

11.1=Compressed - default,

11.2=Open,openbib

[extbook]

1=Body text point size

1.1=8pt,8pt

1.2=9pt,9pt

1.3=10pt - default,

1.4=11pt,11pt

1.5=12pt,12pt

1.6=14pt,14pt

1.7=17pt,17pt

1.8=20pt,20pt

2=Paper size

2.1=8.5x11 - default,letterpaper

2.2=a4,a4paper

2.3=a5,a5paper

2.4=b5,b5paper

2.5=Legal size,legalpaper

2.6=Executive size,executivepaper

3=Orientation

3.1=Portrait - default,

3.2=Landscape,landscape

4=Print side

4.1=Print one side,oneside

4.2=Print both sides - default,twoside

5=Quality

5.1=Final - default,final

5.2=Draft,draft

6=Title page

6.1=Title page,titlepage

6.2=No title page,notitlepage

7=Columns

7.1=One column - default,onecolumn

7.2=Two columns,twocolumn

8=Start chapter on left

8.1=No - default,openright

8.2=Yes,openany

9=Equation numbering

9.1=Numbers on left,leqno

9.2=Numbers on right - default,

10=Displayed equations

10.1=Centered - default,

10.2=Flush left,fleqn

11=Open bibliography style

11.1=Open bibliography,openbib

11.2=Closed bibliography - default,

[extproc]

1=Body text point size

1.1=8pt,8pt

1.2=9pt,9pt

1.3=10pt - default,

1.4=11pt,11pt

1.5=12pt,12pt

1.6=14pt,14pt

1.7=17pt,17pt

1.8=20pt,20pt

2=Paper size

2.1=8.5x11 - default,letterpaper

2.2=a4,a4paper

2.3=a5,a5paper

2.4=b5,b5paper

2.5=Legal size,legalpaper

2.6=Executive size,executivepaper

3=Orientation

3.1=Portrait - default,

3.2=Landscape,landscape

4=Print side

4.1=Print one side - default,oneside

4.2=Print both sides,twoside

5=Quality

5.1=Final - default,final

5.2=Draft,draft

6=Title page

6.1=Title page,titlepage

6.2=No title page,notitlepage

7=Columns

7.1=One column - default,onecolumn

7.2=Two columns,twocolumn

8=Equation numbering

8.1=Numbers on left,leqno

8.2=Numbers on right - default,

9=Displayed equations

9.1=Centered - default,

9.2=Flush left,fleqn

10=Bibliography style

10.1=Compressed - default,

10.2=Open,openbib

These settings offer the same options as the standard documentclass options, except the extra size options are added. With the above addition to classes.opt, use the menu Typeset /Options and Packages and choose the Class Options tab and the Modify button to select the available class options.

See also

Added 03/03/01; revised 04/30/02, 09/12/02

The information in this frame was created with Scientific WorkPlace.