Installing TDS at Sussex

Alan Jeffrey
Thu, 7 Sep 95 17:21 BST

I've just spent a merry few days installing a TDS compliant TeX using
web2c TeX.  Oh what fun it was.  The main customization I had to do
was produce a new MakeTeXPK, which I'll attatch for those interested.
It's not exactly a work of art, and it's site-specific, but it may be
of some use for others...

There's no TDS directory specified for images, which is odd, since
they have to be on the TEXINPUTS path in order for graphics.sty to
pick them up.  I ended up using texmf/images/<type>/<group>/<file>, eg
texmf/images/epsf/sussex/ssxcrest.eps for our crest.

The main point where I disagreed with TDS was the specification that
local files should be put outside the heirachy.  There's no way on
earth I'm going to duplicate all of the TDS structure, so I used files
like texmf/tex/latex/sussex/ssxlet.cls for our letter class.

This makes our TEXINPUTS .:$TEXMF/tex//:$TEXMF/images//

Anyway, it all worked, the punters haven't complained too much so


--- that MakeTeXPK script in full ---

# Filename: MakeTeXPK
# Author: Alan Jeffrey
# Date: 1995/09/05
# This is the COGS script to generate missing PK files.
# It's based very loosely on Karl Berry's, but is almost entirely new.
# This script must echo the name of the generated PK file (and nothing
# else) to standard output.
# Parameters:
#   name dpi bdpi magnification [mode]
#   `name' is the base name of the font, such as `cmr10'.
#   `dpi' is the resolution the font is needed at.
#   `bdpi' is the base resolution, used to intuit the mode to use.
#   `magnification' is a string to pass to MF as the value of `mag'.
#   `mode', if supplied, is the mode to use. Unless it's `default', in
#     which case we guess. (This is so people can specify a destdir
#     without a mode.)
# Any other parameters are ignored (in particular, other MakeTeXPKs
# accept an optional destination directory argument, which we ignore).

# Where to find fonts
: ${TYPEONEDIR=/local/texmf/fonts/type1}
: ${MFDIR=/local/texmf/fonts/source}
: ${AFMDIR=/local/texmf/fonts/afm}

# Where to put fonts
: ${PKDIR=/local/texmf/fonts/pk}

# Where to find helper applications
: ${METAFONT=/local/texmf/bin/solaris/mf}
: ${GFTOPK=/local/texmf/bin/solaris/gftopk}
: ${GSFTOPK=/local/texmf/bin/solaris/gsftopk}
: ${FIND=/usr/bin/find}

# Where the file is
: ${PSFONTSMAP=/local/texmf/dvips/}

# TEMPDIR needs to be unique for each process because of the possibility
# of processes simultaneously running this script.

# Check we've got enough arguments.

if test $# -lt 4; then
  echo "Usage: $0 name dpi bdpi mag [mode]." >&2
  exit 1


# Print out a `friendly' banner.

echo "" >&2
echo "This is MakeTeXPK, COGS Version $VERSION." >&2
echo "" >&2
echo "This script is called because you are the first person at COGS" >&2
echo "to use the bitmapped font $NAME.$DPI""pk." >&2
echo "It will take a few moments to make the bitmap." >&2
echo "The bitmap will be filed, so it will not be created by this script again." >&2
echo "" >&2

# If MODE is empty or "default", then make it cx.

if test -z "$MODE" || test "$MODE" = default; then

# OK, now we try to find the font, first looking for a MF font.

FONTHOME=`$FIND $MFDIR -name $ -print`

if test -z "$FONTHOME" ; then
     # If we can't find an MF font, then we look in the
     # file to see if we can find an entry with a downloaded .pfa or .pfb
     TYPEONEFILE=`egrep "^$NAME .*\.pfa" $PSFONTSMAP | sed 's/.*\([a-zA-Z0-9]*\.pf.\).*/\1/'`
     if test -z "$TYPEONEFILE" ; then
          # Otherwise, the font is a resident font, and we search for
          # an AFM file that is the same, possibly with the encoding
          # 8r replaced by 8a.
          AFMFILE=`echo $NAME | sed -e 's/8r/8a/'`
          FONTHOME=`$FIND $AFMDIR -name $AFMFILE.afm -print`
          # If we can, we use find to find the file.

# If we've still got an empty FONTHOME, then we give up.

if test -z "$FONTHOME"; then
     echo "$0: Failed to find $NAME." >&2
     echo "$0: This shouldn't happen!" >&2
     echo "$0: Please send a bug report to texpert@cogs." >&2
     exit 1

# We now tear FONTHOME apart to get the location of the font.

echo "Font source: $FONTHOME" >&2

set `echo $FONTHOME | sed -e 's/^.*\([^/.]*\)\/\([^/.]*\)\/\([^/.]*\)\/\([^/.]*\)\.\([^/.]*\)$/\2 \3 \5/'`


if test "$TYPE" != "mf"; then



echo "Font target: $DESTDIR/$PKNAME" >&2
echo "" >&2

# Allow fonts to be read and written (especially in case we make
# directories) by everyone.  
umask 0

# Make sure the destination directory exists.


# Clean up on normal or abnormal exit. 
trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15

# Go to the unique working directory.
test -d $TEMPDIR || mkdir $TEMPDIR 
cd $TEMPDIR || exit 1

# Make that bitmap!

if test "$TYPE" = "mf" ; then
     # Got a Metafont source, so run Metafont.
     echo $METAFONT "\mode:=$MODE; mag:=$DPI/300; scrollmode; input $NAME;" >&2
     $METAFONT "\mode:=$MODE; mag:=$DPI/300; scrollmode; input $NAME;" >&2 || exit 1
     echo $GFTOPK $GFNAME >&2
     $GFTOPK $GFNAME >&2 || exit 1
     # Got a Type 1 source, so run gsftopk.
     echo $GSFTOPK $NAME $DPI >&2
     $GSFTOPK $NAME $DPI >&2 || exit 1

# Look to see if another MakeTeXPK job has already made the bitmap

if test -r $DESTDIR/$PKNAME; then
    echo "$0: $DESTDIR/$PKNAME already exists." >&2
    exit 0

# Install the PK file carefully, since others may be working simultaneously.
mv $PKNAME $DESTDIR/pktmp.$$ \
  || { echo "$0: Could not mv $PKNAME $DESTDIR/pktmp.$$." >&2; exit 1; }

cd $DESTDIR || exit 1
mv pktmp.$$ $PKNAME

echo "" >&2
echo "Installation successful" >&2

# If this line (or an equivalent) is not present, dvipsk/xdvik/dviljk
# will think MakeTeXPK failed.  Any other output to stdout will also lose.

# That's it!