Index of /archives/text/CTAN/systems/unix/tex-fpc

Icon  Name                              Last modified      Size  Description
[PARENTDIR] Parent Directory - [DIR] xdvi/ 2020-10-06 22:02 - [TXT] pltotf.ch 2020-11-07 17:40 1.6K [TXT] tftopl.ch 2020-11-07 17:50 1.8K [TXT] local.mf 2020-12-24 21:51 1.1K [TXT] license 2021-01-19 23:43 1.3K [TXT] tangle.ch 2021-01-31 01:37 4.7K [TXT] tangle.p 2021-01-31 01:38 44K [TXT] gftopk.ch 2021-01-31 01:50 2.9K [TXT] gftype.ch 2021-01-31 01:56 3.5K [TXT] dvitype.ch 2021-01-31 02:02 6.3K [   ] webmac-fpc.tex 2021-02-15 23:23 492 [TXT] weave.ch 2021-02-17 00:54 4.8K [TXT] fpcbugs 2021-04-09 00:39 1.8K [TXT] tex.ch 2021-04-09 03:41 41K [   ] tex-fpc.pdf 2021-04-09 03:44 599K [TXT] mf.ch 2021-04-09 03:46 21K [TXT] history 2021-04-09 03:50 4.9K [TXT] README 2021-04-09 03:59 14K [DIR] mp/ 2021-04-09 04:33 - [DIR] shell/ 2021-04-09 04:33 - [DIR] tech/ 2021-04-09 04:33 - [DIR] trap/ 2021-04-09 04:33 - [DIR] trip/ 2021-04-09 04:33 - [DIR] twebmac/ 2021-04-09 04:33 - [DIR] MFT/ 2021-04-09 04:33 - [DIR] ch.ch/ 2021-04-09 04:33 - [DIR] dvips/ 2021-04-09 04:33 -
TeX-FPC 4th ed.                                                    2021-04-08

This directory contains change files for Donald E. Knuth's suite
of TeX related programs. The change files (.ch) and Don Knuth's WEB
files (.web) from January 2021 are the key components of a construction
kit for "TeX-FPC"---a complete TeX system based purely on the Free Pascal
Compiler (FPC), and running in any Unix environment.

These building bricks are glued together by shell scripts in
the---guess where---shell subdirectory.

The file tex-fpc.pdf shows how and why TeX-FPC differs from the original.
It was produced by two command lines:
   $ wve tex.web tex.ch
   $ dvipdf tex.dvi

The MFT directory contains shell scripts to create fonts (xxxfonts).
Its subdirectory iby shows how to add a font to TeX-FPC. In this
case a polytonic Greek font, suited for ancient Greek texts.

The directories dvips and xdvi help to get, compile and install Tom
Rokicki's dvips and Paul Vojta's xdvi.

Likewise the directory mp for John Hobby's METAPOST.

The directory tech demonstrates how to build a TeX system that
supports the german language.

The directory twebmac explains and fixes bugs of WEB macros.

And the ch.ch directory contains change files for change files.

Requirements:
============
TeX-FPC is liberal in what it accepts:
You will succeed with any flavor of the Unix operating system.
In fact, I only used stuff from:
   Kernighan, Pike: The Unix programming environment (1984) 
I have to admit, now and then I used vi instead of ed, the Unix Standard
Editor.
If TeX-FPC doesn't work on your system, it is not Unix, not even remotely so.

Any version of FPC from 3.0.0 (Nov. 2015) to 3.2.0 (June 2020)
works fine.

To build the DVI-driver xdvi and dvips a C-compiler is necessary.
To run xdvi, you need X-Window and to print your books, you either
need a postscript printer or you use ghostscript to translate
postscript to your printers language. The DVI-drivers are written in C.

Everything you need existed in the mid eighties of the last century.
All the great books produced with TeX demonstrates how much can be
done without the latest "innovations".

Overview:
=========

File formats and their documentation:
-------------------------------------
WEB files:
.web	WEB programs, "The WEB System of Structured Documentation" (webman.tex)
.ch	Change files for WEB programs (patches to be applied to .web files)
.p	Pascal source
.pool   String pool, contains the string constants of a WEB program.


METAFONT files:
.mf	METAFONT source, "The METAFONTbook" (mfbook.tex)
.base   Base file, a compact representation of METAFONT's memory.
.tfm    TeX font metric, "TeX: The Program" (tex.web) part 30
.nnngf	generic font file, "METAFONT: The Program" (mf.web), part 46
.nnnpk	packed font file, gftopk.web, modules 21-36
        The last two are bitmap font formats, where nnn is a number that
        stands for "dots per inch". The number equals resolution of the
        output device as specified in your mode times the magnification.
.log    a log file
 
TeX files:
.tex	TeX source, "The TeXbook" (texbook.tex)
.fmt    Format file, a compact representation of TeX's memory.
        contains the string pool (tex.pool) and fifty .tfm files.
.dvi	device independent file, "TeX: The Program" (tex.web), part 31
.log    a log file

Dependencies of files:
File		depends on
----		----------
xxx		xxx.p
xxx.p		xxx.web, xxx.ch
tex.pool	strings in tex.web or tex.ch
plain.fmt	plain.tex
		.tfm files (cf. plain.log)
		hyphen.tex
		tex.pool
mf.pool		strings in mf.web or mf.ch
plain.base	plain.mf
		local.mf
		mf.pool

Dependencies of programs
Program		depends on
-------		----------
initex		TeXformats/tex.pool
tex		TeXformats/plain.fmt
inimf		MFbases/mf.pool
mf		MFbases/plain.base

Files and their processors:
--------------------------
WEB:
		  tangle
     x.web, x.ch --------> x.p, x.pool

                  fpc
             x.p  --------> x (to compile tex and mf you need some units:
                               fpc -FaUnix,sysutils,baseunix)
                   tgl
      x.web, x.ch --------> x (combines the last two steps, no pool)

                   itgl
      x.web, x.ch --------> inix.p, inix, x.pool (like tgl, but with pool)

		   weave
        .web, .ch --------> .tex (description of the program)

		  wve
        .web, .ch --------> .dvi (linking the above step and tex)


METAFONT and TeX metric fonts:
                              inimf
  mf.pool, local.mf plain.mf --------> plain.base

                              mf
             plain.base, .mf --------> .tfm

                              mkfont
                         .mf --------> TeXfonts/.tfm

TeX:
		                         initex
 tex.pool, hyphen.tex, plain.tex, .tfm  --------> plain.fmt

                                         tex
                  plain.fmt, .tfm, .tex --------> .dvi

DVI drivers and bitmap fonts:
   			mf 
    plain.base, .mf --------> .nnngf
  		     gftopk
             .nnngf --------> .nnnpk

                     MKTeXPK
                 .mf --------> PKfonts/.nnnpk (combining the above steps)

 
                     dvips
 .tfm, .nnnpk, .dvi --------> .ps, PostScript printer

                     xdvi
 .tfm, .nnnpk, .dvi --------> X-Window

The dvi-drivers dvips and xdvi will call MKTeXPK to install .nnnpk
on demand.


File names:
-----------
TeX-FPC searches files in subdirectories of the working directory:
	TeXinputs  .tex
	TeXfonts   .tfm
	TeXformats .pool, .fmt
	MFinputs   .mf
	MFbases    .pool, .base
	PKfonts    .nnnpk
	DVIPSconf  .pro, .ps, .map (Header and configuration files for dvips)

To run tex or initex the working directory must contain the first
three directories from the list above. Likewise for mf or inimf and
the last four directories from the list. The dvi driver xdvi and
dvips will invoke mf to create PK fonts whenever needed. So you
might need to install the mf-directories when printing.

To avoid copying the directories to each directory where you want
to run TeX, create one set of "master directories" and use symbolic
links to your working directory like:

	ln -s ~/TeXformats .

The scripts mk_TeX_dir and mk_MF_dir help do just this automatically.
Adapt these scripts to the locations of your master directories.

TeX-FPC's path searching applies to file names without directory
components, i.e. without a /:
	.tex	    working directory and then TeXinputs 
	.mf         working directory and then MFinputs
	.tfm        working directory and the TeXfonts
        .fmt        working directory and then TeXformats
         plain.fmt  hard coded (!) TeXformats/plain.fmt
        .base       working directory and then MFbases
         plain.base hard coded (!) MFbases/plain.base
        .pool       hard coded (!) in TeXformats, MFbases 

Depending on the context, TeX-FPC programs append ".mf", ".tex", ".fmt",
".base" or ".tfm" to file names without extensions.

Fonts in TeX-FPC:
----------------
For each font, TeX needs one .tfm file. For each font and
resolution/magnification the DVI drivers need one .nnnpk file.
The script mkfont will install both a .tfm and an .nnnpk file, the
script mkpkfont will install an .nnnpk file only.  You specify the
resolution in your METAFONT mode and the magnification as an optional
second argument to mkpkfont or mkfont.  The DVI drivers will invoke
mkpkfont automatically to create missing .nnnpk files.

Running TeX-FPC
===============
Missing files
-------------
Search missing macro files like webmac.tex in Knuth's lib
directory and copy them to the working directory or to TeXinputs.
The .ch files import webmac-fpc.tex; move it to TeXinputs.

Search the sources of missing fonts in the lib directory (.mf),
copy them to MFinputs and use the scripts mkfont  or mkpkfont to
create and install .tfm files respective .pk files. The shell scripts
assume the METAFONT mode localfont which is defined in MFT/local.mf.
Remember, you've loaded local.mf into the file plain.base. Or you
might want to grep for font assignments in your .tex files. The
command line
	grep '\\font.*=' plain.tex > plainfonts
creates a list of the font names used by plain.tex. I edited
plainfonts to convert it to a shell script that creates all fonts
of the plain format. In the MFT directory you'll find other examples.
If the generation of a font failed, the failing command is written
to the file trouble in the working directory. You might want to fix
the error and rerun the file trouble, (sh trouble). If the error
persists though, you might end up in a loop.

Installing new fonts from CTAN
------------------------------
The directory MFT/iby contains instructions on how to install a font
from CTAN, in this case ibygrk to typeset polytonic ancient Greek.

Printing the web-programs
-------------------------
The weave program generates an xxx.tex file from an xxx.web file
and a xxx.ch file. Use tex to generate an xxx.dvi file. This is
done by the script wve. For example, to view the description of
TeX-FPC, use
	wve tex.web tex.ch && xdvi tex
The web-macros need another font. Run MFT/webfonts to install it.
And run MFT/mfwebfonts for mf.tex.
The file tex-fpc.pdf provides the doc independent of an installed
TeX system. It describes how I adopted TeX to FPC, the features and
and differences of TeX-FPC.

TRIP TRAP
---------
Both tests are passed by TeX-FPC. See the trip and the trap directories..

Hints to build and install TeX-FPC from Knuth's sources.
========================================================
Create the master directories if you haven't done so allready.
Create links to the master directories in tex-fpc:
	mk_TeX_dir
	mk_MF_dir

Get Knuth's source files:
------------------------
Get some directories of Knuth's distribution from
	tug.org/tex-archive/systems/knuth/dist.zip
Unpack dist.zip in the parent directory of tex-fpc and move the files from
Knuth's distribution to tex-fpc.
  $ mv dist/* tex-fpc

This directory, i.e. tex-fpc will be our stage directory, that is
all compiling etc. will be done in tex-fpc and it's subdirectories.

Install the files from cm to MFinputs:
	mv cm/* MFinputs

And copy the .mf files from the lib directory to MFinputs.
        cp -p lib/*.mf MFinputs

All path names are given relative to tex-fpc.

Building from WEB sources, (xxx.web and xxx.ch --> xxx, xxx.pool)
----------------------------------------------------------------
The general procedure to build a binary xxx from its WEB files is:
Move xxx.ch to the directory that contains xxx.web, apply tangle
to xxx.web and xxx.ch to generate xxx.p, and compile the
Pascal source with fpc. The command line
   tgl xxx.web xxx.ch
will do all that. It produces xxx that you need to move to your binary
directory. Note tgl will not create xxx.pool, since this is only needed
by the ini-versions that are to be built by itgl.

METAFONT and TEX come in two versions: An initialization version
(initex, inimf) and a production version (tex, mf). To build the
initialization version, edit the change file to deactivate the change
blocks marked by "ini", and use itgl. To build the production version,
activate the change blocks marked by "ini" and use tgl.

A change block is active, if each of the web commands @x, @y and
@z are at the start of their lines, inactive if none of the web
commands are at the start of their lines.
See webman.tex, for a short description of change files (look for @x).

Step by step procedure to bootstrap TeX-FPC
-------------------------------------------
Install the Free Pascal Compiler (3.0.0+)
	https://freepascal.org/download.html 

Create the master directories (see above).

Copy the shell scripts from tex-fpc/shell to your binary directory.


0. Compile tangle                                       tangle.p --> tangle
----------------------------------------------------------------------------
Compile tangle.p (fpc tangle.p) and move tangle to your
binary directory.

1. Make inimf and initex
------------------------
    mf.web,  mf.ch --> inimf, inimf.p, mf.pool
    ------------------------------------------

    tex.web, tex.ch --> initex,initex.p tex.pool
    --------------------------------------------

Build the ini-programs using itgl and save them as initex, resp. inimf in your
bin directory.  Save tex.pool in  TeXformats and mf.pool in MFbases.

2. Make plain.base                   lib/plain.mf --> MFbases/plain.base
------------------------------------------------------------------------
Go to tex-fpc/mf and use inimf to create plain.base.
The file local.mf contains mode definitions for my HP LaserJet 1320
printer. Adapt local.mf to your printer.
	inimf ../lib/plain input ../MFT/local dump

Move plain.base to MFbases.

3. Make mf 					    mf.web, mf.ch --> mf
------------------------------------------------------------------------
goto mf and use  ../ch.ch/mkprod mf to activate the inimf-change
block in mf.ch, build mf with tgl, save mf in your bin directory.


4. Install TFM-fonts:                   MFinputs/*.mf --> TeXfonts/*.tfm
------------------------------------------------------------------------
Run the shell script MFT/plainfonts.
Check the file trouble that might contain commands that failed.

5. Make plain.fmt                 lib/plain.tex --> TeXformats/plain.fmt
------------------------------------------------------------------------
Copy lib/hyphen.tex to TeXinputs and go to tex to build plain.fmt.
This command line will do 
    initex ../lib/plain \\dump # one backslash is consumend by sh!
Move plain.fmt to TeXformats.

6. build tex                                     tex.web, tex.ch --> tex
------------------------------------------------------------------------
Use ../ch.ch/mkprod to activate the initex-change block in tex.ch
and build tex with tgl.

Step 6 completes the minimal installation of TeX-FPC, which enables
you to study, change, build, and test the six programs tangle,
weave, inimf, mf, initex, and tex. Run them to typeset your book,
create your font, and last but not least to try literate programming
and write your own web programs.

Happy weaving and typesetting,
Wolfgang Helbig,

Comments welcome: helbig@mailbox.org