## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Chapter 13. Non-commercial Environments

This chapter offers an overview of several common free and shareware TeX systems. If you notice any conflicts between the information in this chapter and the documentation that comes with the software, please consider the documentation to be more accurate and up-to-date. I've attempted to provide hints and practical suggestions, but software installation is largely dependent on your system configuration and the way you want to use TeX.

## Web2C

The official sources for all of the standard TeX programs are distributed in a format known as \web.[122] \web is an implementation of a programming style known as “literate programming.” One central tenet of literate programming is that source code and documentation should be written in parallel. Literate programming enforces this tenet by combining the two in a single file. \web source files contain a mixture of source code and documentation.

In \web files, the documentation is written in TeX, and the source code is written in Pascal. (Other literate programming environments use different documentation and programming languages.) To print the documentation, a special preprocessor called weave transforms the \web source into a TeX document that can be formatted and printed. Another preprocessor, called tangle, transforms the \web source into a Pascal program that can be compiled and executed.

In practice, it is far more likely that you have access to a C compiler than to a Pascal compiler. This is where Web2C comes in. Web2C is a special-purpose Pascal-to-C translator that makes it possible to compile and build the TeX sources in most unix environments (and probably many other environments as well).

Karl Berry maintains the Web2C distribution. You can retrieve it from the CTAN archives in the directory systems/unix/web2c.

Preparing to build TeX with the Web2C distribution is very straightforward. Unpack the archive files, read the file named README, and follow the instructions in the file named INSTALL. Many people have built TeX using these sources. If you have difficulty, readers of the Info-TeX mailing list or the comp.text.tex newsgroup will almost certainly be able to help.

In my experience, there are only two parts of the installation that are likely to cause any difficulty: compiling tangleboot.c and building the X Windows support in MetaFont.

Because tangle is written in \web, there is an obvious bootstrapping problem (how do you tangle tangle.web in order to compile tangle?). The Web2C distribution includes a small C program called tangleboot.c, which overcomes this hurdle. It's possible that getting tangleboot.c to compile on your machine may require some tinkering. I had this problem on one machine with one release of Web2C. Subsequent releases of Web2C seem to have corrected this problem (in my case, at least).

Compiling X Window support for MetaFont has regularly been a thornier problem. If you are not comfortable programming in C, I cannot suggest a simple way to correct these difficulties in the general case. (However, asking for help in the appropriate newsgroups is very likely to produce a solution for any particular problem.)

The most common errors that I've encountered in building the X Windows support for MetaFont are conflicting prototypes and type definitions. My solution to these problems, inelegant though it may be, has generally been to “correct” or remove the offending declarations from the MetaFont sources. (Note: the X Window support is written directly in C, not \web, so it is considerably easier to edit.) In my experience, this has always been successful, but your mileage may vary.

## emTeX

The emTeX distribution is a very complete, free distribution of TeX for MS-DOS and OS/2 systems. emTeX will run on any 80x86 processor, although some of the larger, faster executables require at least a 386. There is no single right way to install TeX, so what follows is only one possible installation. This installation uses the default directories and assumes a single-user environment. Installing emTeX in a network environment is mentioned briefly in “the section called “Installing emTeX on a Network”,” later in this chapter. Incorporating the more recent, beta test versions of emTeX is described in the section called “the section called “Environment variables”.” emTeX is available on CTAN in the directory systems/msdos/emtex.

On the whole, the installation instructions for emTeX are provided in the distribution. Begin by reading the English or German versions of the documentation provided. Additionally, you should read the DVI driver documentation at least once. (It's quite long, and you may not remember all of it after a single reading, but at least you'll have a feel for what can be done.)

Table 13.1 summarizes the files in the distribution. The standard emTeX distribution occupies six high-density floppy disks. A complete installation requires more than 12 megabytes of storage without fonts. You must also get a set of fonts (available in font library format for emTeX) or set up automatic font generation.

Table 13.1. Summary of the \protect\emTeX Distribution

For simplicity, the discussion that follows assumes that you have enough disk space to install the entire 12Mb distribution. If you can't get that much space (even temporarily), you can perform the steps discussed in the section “the section called “Installing Fonts”” as you install.

### Where to Start

Begin by reading the English (*.eng) or German (*.ger) documentation files on the first disk. Where there is disagreement between this book and those files, believe the files---especially if a new version of emTeX has been released.

### Unpacking the Archives

The emTeX distribution is a collection of ZIP files spread over six disks. You must install these files into your hard drive. If you have more than one hard disk, you may install emTeX on any drive you choose. Select one with more than 12Mb of free space, at first. You can copy the files onto another drive after you've deleted things that you don't need.

All of the emTeX files are installed in a subdirectory tree rooted at emtex. If you absolutely must use a different subdirectory tree, unpack each archive file into a temporary directory and then copy the files into the subtree you want to use. You will have to do much more extensive customization of the batch files and configuration files before emTeX will work. That sort of customization isn't described here in detail.

Make the root directory of the hard disk that you wish to install onto the current directory, and then use the pkunzip program distributed on the first disk, or any later version of pkunzip, to unpack each of the archive files. You can also use the Info-Zip version of unzip (version 5.0 or later) to unpack the archives. If you do not want the German versions of the TeX macro files, do not bother to unpack the lkurz.zip or g*.zip files on disk six.

After you have unpacked the files, you will have a directory tree rooted at \bs EMTEX containing about 12Mb of files and the following additional directories: bibinput, bmfbases, btexfmts, doc, mfbases, mfinput, MFjob, remove, texfmts, texinput, and tfm.

### Setting Up the Environment

A lot of information about where and how things are installed for emTeX is stored in the \glo{environment}. If you are unfamiliar with the DOS or OS/2 environment, consult your operating system reference for more details. In brief, the environment is a collection of named strings. For example, your PATH is in the environment.

The emTeX distribution includes a batch file called set-tex, which sets all of the environment variables that emTeX uses. Edit this file and change all references to C: to the drive where you installed emTeX. If you installed emTeX on drive C:, you needn't change anything. The section “the section called “Deleting extra documentation”” later in this chapter describes the variables used by emTeX in greater detail.

If you are using MS-DOS and haven't already made the environment larger than its default size, you may need to do so in order to use emTeX. Insert the following command, or something like it, in your CONFIG.SYS file:

SHELL=C:\COMMAND.COM /P /E:1024

This is very system-dependent. You will have to use different settings if you keep COMMAND.COM in a subdirectory or if you use a different command processor.

### Testing the Installation

After you have set up the environment, make the emtex directory the current directory and test TeX by typing:

C:\ttbackslash{}EMTEX>{\bf tex}
This is emTeX, Version 3.0 [3a] (no format preloaded)
**{\bf \ttbackslash{}relax}

*{\bf This is a test}

*{\bf \ttbackslash{}bye}
[1]
Output written on texput.dvi (1 page, 224 bytes).
Transcript written on texput.log.

This will produce a small DVI file called texput.dvi. Keep this file; you can use it in a few minutes to test the previewer.

To test LaTeX, enter the command:

#### Setting up configuration files

Configuration file options are described completely in the DVI driver documentation that accompanies emTeX. Read the English or German versions of dvidrv.doc carefully. The “out of the box” configuration is sufficient for most uses, but specifying a new configuration file is a convenient way to alter the default size of the page in preview mode or set up emTeX to print pages in “two-up” or “four-up” variations (for printing booklets, for example).

### Installing the Beta Test Versions of emTeX

It has been several years since the standard distribution of emTeX was assembled. In that time, several other releases have been made. These are beta test releases, but they are as rock-solid as the standard distribution. Personally, I encourage you to install the beta test versions, especially because they offer features not found in the standard release.

The beta test versions are stored in a series of ZIP files at CTAN in the directory systems/msdos/emtex/betatest. Table 13.4 summarizes the files in the beta test distribution.\footnote{As this chapter is being written, Eberhard Mattes\index{Mattes, Eberhard} is working on a new version of \emTeX. This new version will, at some point, replace the existing beta test files, making this section somewhat out of date. Use the READ.ME files in the actual distribution as the definitive source of information.

Table 13.4. The Beta Test Files for \protect\emTeX

 \bf File \bf Contents \it btexb8.zip Big \TeX executables \it dvidrv_1.zip New drivers and support files \it dvispell.zip \program{dvispell} \it maketcp.zip \program{maketcp} \it mfb1.zip \MF executables \it MFjob11l.zip \program{MFjob} \it mfpm.zip OS/2 support for \MF preview \it pkeditpm.zip OS/2 PM version of \program{PKEdit} \it tex386b8.zip 386 version of \TeX \it texb5.zip Small \TeX executables

To install the beta test versions, simply unpack the archives into your \bs emtex directory, replacing any existing files with the new versions. After you have installed the beta test versions, you can repeat the space-saving steps suggested earlier in this chapter.

What are the advantages of the beta test versions?

• Automatic font generation is supported. This means that you do not need large font library files.
• The beta test versions are TeX version 3.141; the standard distribution is the slightly older version 3.0.
• The beta test distribution includes a 386-specific version of TeX, which is much faster than other versions.
• For OS/2 users, a Presentation Manager DVI previewer is provided.

### Running emTeX 386 in Windows

The 386-specific version of TeX provided by the beta test distributions of emTeX has some compelling advantages over the other TeX executables: it's a big TeX and it's fast. Unfortunately, it does not run in Windows (or some other MS-DOS environments).

The problem is memory management. In order to be large and fast, the tex386 executable relies on some advanced features of the 386 (and higher) processors. These features are provided under MS-DOS by a “DOS extender.” The DOS extender allows MS-DOS applications to use “protected mode,” where they can address more than 640Kb of memory. There are several competing standards for protected mode memory management. emx, the extender implemented in emTeX, is not compatible with the DPMI standard used by Microsoft Windows and some other MS-DOS extenders (for example, MS-DOS sessions under OS/2).

Luckily, there is a freely available MS-DOS extender, which is compatible with both DPMI and emTeX, the RSX extender. Starting with version beta-11 of emTeX, the is very easy to use.[124]

There are two versions of the extender: rsx, for use in MS-DOS with DPMI extenders, and rsxwin, for use in Windows. Both versions are available on the CTAN archives in the directory support/msdos/dpmi/rsx.

To use the RSX extender in MS-DOS with tex386 version beta-11 or later, simply put rsx.exe somewhere on your PATH. When emTeX discovers a DPMI extender, it will use rsx instead of emx.

To use the RSX extender in Windows, you must modify the command line that is executed to run tex386. Where you currently use:

d:{\bs}path1\bstex.exe options

you must now use:

d:{\bs}path2\bsrsxwin.exe -e d:\bs path1\bstex386.exe options

The rsxwin extender will set up an extender for emTeX and then run TeX.

### Note

Automatic font generation is not supported by the standard distribution of emTeX. You must install the beta test versions to use automatic font generation.

The new versions of the emTeX DVI drivers include a program called dvidrv, which handles automatic font generation. The dvidrv program runs the driver and if the driver indicates that fonts are missing, gives you the opportunity to use font substitution or build new fonts. The MFjob program is used to build the fonts. MFjob runs the MetaFont and GFtoPK to produce and install the necessary fonts. MFjob installs the PK files into the first directory on the font path.

The dvidrv program can be replaced by a batch file that can select an appropriate font-rendering program (something other than MetaFont, for example) to build the necessary fonts. This feature is only available in the OS/2 versions of emTeX releases 1.4t and later. The batch file in Example D.3 in Appendix D, Appendix D, is a replacement for dvidrv. It uses ps2pk to make PK versions of PostScript Type 1 fonts if an appropriate PFB file can be found. Otherwise, it calls MFjob in the same way that dvidrv does.

### Installing emTeX on a Network

Ordinarily, emTeX does not require write access to any of its data files, so installation on a network is not a problem. The location of temporary files that must be writable is controlled with environment variables. If automatic font generation is being used, there are two applicable cautions.

First, if you use the batch file approach to automatic font generation in order to support different rendering software, be aware that your batch file must handle the fact that multiple files may be written to the same directory from different users. Don't let filenames collide.

Second, it is ideal if you can provide a single world-writable location for automatically generated fonts. If multiple users are working with similar documents, each will not need private copies of the fonts they require. If your networking software tracks the time of last file access, you can determine which files to delete from this global font area on a regular basis.

## texas

texas is a 32-bit MS-DOS version of TeX. It is a big TeX. Unlike tex386, which comes with emTeX, the texas executable uses a royalty-free, commercial DOS extender. The advantage of this extender is that it can run under Windows and other protected-mode environments such as DESQview.

Before you install texas, you should get a complete TeX system from some other location (emTeX or gTeX, for example). The texas distribution does not include anything other than the TeX executable and the MS-DOS extender---no format files, no input files, nothing.

The -i switch runs texas in iniTeX mode. Using the instructions from Chapter 4, Chapter 4, you should be able to build new format files for use with texas if you have another TeX distribution to work from.

texas uses the following environment variables:

TEXINPUTS

Defines the directories that texas uses when searching for TeX input files. You would typically leave the defaults in this path and extend it with directories of your own in place of C:{\bs}MYTEX.

TEXFORMATS

Specifies where texas looks for format files. Typically you would leave this set as is and add new format files to that directory.

TEXFONTS

TeX uses the directories stored in this variable when searching for TFM files for fonts used in your documents. If you install new fonts, you should put the TFM files in their own directory and add the name of that directory to the TEXFONTS path.

TEXPOOL

Specifies where texas looks for its pool file. Unless you have installed texas in an unusual way, you will not have to change this setting.

DOS4GVM

texas uses a DOS extender to overcome memory limitations under MS-DOS. If the extender runs out of memory, it writes parts of the memory-image that it is maintaining out to disk. This environment variable specifies where that information should be written. You do not usually need to change this setting.

## sbTeX

sbTeX is another MS-DOS implementation of TeX. The sb38tex distribution includes TeX and iniTeX executables, TFM files for the Computer Modern Roman fonts, and TeX sources for the Plain TeX format. This is TeX version 3.141. You will have to get DVI drivers and other TeX tools from a different package.

The sb32xet distribution is \XeT version 3.1.[125] The source files for the \XeT nailp format are included, as well as the supporting files for Hebrew.

The sbmf13 distribution is MetaFont version 2.71. Only the sources for the Plain MetaFont base file are provided. Like the sbTeX distribution, this is a very minimal set of files. Only the GFtoPK utility is included; all of the other MetaFont programs you need will have to be obtained from another package.

The default directories for sbTeX are \bs TEX\bs INPUTS for input files, \bs TEX\bs FORMATS for format files, and {\bs TEX\bs FONTTFMS} for TFM files. The default drive is C:, but that can be changed with the sb38set program.

You can also modify these paths by setting the TEXINPUTS environment variable for input files, the FMTSB environment variable for format files, and the FONTTFMS environment variable for TFM files. Additionally, sbTeX uses the SBFTMP environment variable to determine where temporary files should be located if font caching is performed. Here is a more complete description of sbTeX's environment variables:

TEXINPUTS

Defines the directories that sbTeX uses when searching for TeX input files. You would typically leave the defaults in this path and extend it with directories of your own in place of C:{\bs}MYTEX.

FMTSB

Specifies where sbTeX looks for format files. Typically you would leave this set as it is and add new format files to that directory.

FONTTFMS

TeX uses the directories stored in this variable when searching for TFM files for fonts used in your documents. If you install new fonts, you should put the TFM files for these fonts in their own directory and add the name of that directory to the FONTTFMS path.

SBFTMP

When font-caching is enabled, sbTeX writes cached information to disk when it runs out of memory. This environment variable specifies where that information should be written. You do not usually need to change this setting.

## gTeX

The gTeX package is distributed in two ways. One way is intended to supplement (actually, replace part of) the emTeX distribution. The advantage of gTeX executables over emTeX is that they will run under Windows. The 386 versions of emTeX executables will not run under Windows. On the other hand, although gTeX will run in an MS-DOS session under OS/2, only the emTeX executables will actually run in a native OS/2 session. The other distribution is a complete set of TFM files, source, and input files for Plain TeX, LaTeX, and AMSTeX. In either distribution, you must get DVI drivers and some ancillary programs from another complete package (like emTeX).

The following programs are included in the gTeX distribution:

\begin{tabular}{lll}
&BibTeX; & <command>GFtoPK</command> & <command>VFtoVP</command> \\
<command>DVItype</command> & <command>MFT</command> & <command>VPtoVF</command> \\
<command>DVIcopy</command> & <command>PKtoGF</command> \   & <command>MakeIndx</command> \\
<command>GFtoDVI</command> \   & <command>PKtype</command> & &MF; \\[2pt]
\multicolumn{3}{l}{\program{amSpell}  (a third party spell-checker, not traditionally part of \TeX)}\\[2pt]
\multicolumn{3}{l}{\program{MEwin}  (an Emacs-like editor for Windows, also not traditionally part of \TeX)}\\
\end{tabular}

The gTeX executables use the same environment variables as emTeX.

[122] {Hence the spider on the cover, by the way.}

[123] {One of the reasons I don't recommend it is that it isn't easy to determine precisely what the compiled-in defaults are, and they may change without notice.}

[124] {Earlier versions of tex386.exe had the emx extender “bound” into the executable, which made the process more complicated. The emx extender had to be unbound before the new one could be used.}

[125] {\XeT is a variant of TeX that can typeset in both left-to-right and right-to-left modes.}

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required