Setting Up emTeX (fwd) [long]

Petr Sojka sojka at daeron.ics.muni.cz
Wed May 25 10:19:39 CEST 1994


Dobry den,

nas cstex je postaven na emtexu, k nemuz existuje
popularni navod Dana Lueckinga
ftp.muni.cz:/pub/tex/CTAN/info/setting-up-emtex.tex
ktery byl prave rozsiren o nekolik zajimavych kapitol (viz nize).

Happy emtexing!

Petr <sojka at muni.cz>

-------------------------------------------------
Forwarded message:
Date: Tue, 24 May 1994 17:15:00 -0500 (CDT)
From: "Daniel H. Luecking" <luecking at comp.uark.edu>
Subject: Setting Up emTeX

Dear emTeX'ers

I have yielded to overwhelming popular demand (3 correspondents) and have
added four sections to the popular document "Setting Up emTeX (under
MSDOS".  These 4 sections are included here below my signature. If
anything is incorrect, please let me know before I release a
less-than-perfect version of the whole thing. (Next week... maybe.)

Thanks,

Dan Luecking

luecking at comp.uark.edu               |   Anti-disclaimer:
Department of Mathematical Sciences  |   You are free to ascribe any
University of Arkansas               |   opinions herein contained
Fayetteville, AR 72701 USA           |   to anyone or anything.

%%%%%%%%%%% Addenda to setting-up-emtex.tex %%%%%%%%%%%%%%%%%%
%             This is file addenda.524
%
%   I have attempted to make this file "easy" to read without having to
% TeX it. To make it even easier you could try:
%  (1) Blanking every line that begins in column 1.
%  (2) Removing every "|" character.
%  (3) Removing every "{" and "}" character and every "\" not between two |
%      (But leave those in the figure in Section 9.)
%
%   Do not try to TeX this file or append it to setting-up-emtex.tex.
% This file assumes a completely changed set of definitions. The most
% significant change is that the characters *, |, and _ are active and
% produce special formating effects. I did this to clean up the ascii
% source, hoping to make it less cluttered and easier to read.
%

\section
                 8. \Metafont{}ing: Alan Jeffrey's |bbold|

\item{}
({\it
     From here on the sections are written long after the fact,
     still from experience, but without notes to help my memory}.)

    The success with |mfjob| and \Metafont\ encouraged me to experiment
  with new fonts. I (like many) was dissatisfied with the \AMS\ version
  of Blackboard bold. I prefer to use plain bold---|cmbx|---for
  portability, but many readers (students mostly) prefer to see the old
  familiar face. The \AMS\ fonts version is more an outline version of
  |cmbx| than the face most people are used to (that being a sort of
  {\it sans serif\/} face like the one used by Springer in {\it
  Function Theory in the Unit Ball in $\IC^n$}, by W. Rudin). On advice
  from |comp.text.tex| I tried Alan Jeffrey's |bbold| font, downloaded
  from CTAN in |/tex-archive/fonts/blackboardbold|.
_
     | ftp> bin                    | (to transfer in binary mode)
     | ftp> get blackboardbold.zip |
_
  and obtained an archive |blackboardbold.zip| containing the contents
  of the |blackboardbold| directory. I downloaded this to my
  PC.%
\footnote
    {I am now networked and can do this without using floppy disks. I
     can, in fact, now download without going through the UNIX host, but
     I prefer not to because of filename restrictions that I constantly
     forget. The extra step forces me to remember where I am.}
%
  I created a directory |C:\bbold| to test the fonts and unzipped the
  archive there. (This requires the program |unzip|, which can be
  obtained from CTAN, or |pkunzip| version 2.x.)

    I thought with my newly found insights into \Metafont, I would
  easily be able to generate the fonts. I thought of letting |dvidrv| do
  it by writing a |.tex| file that loaded them, typeset one character
  from each font at each required |\magstep| and then trying to view the
  resulting |.dvi| file. But after a little trial and error I found I
  could not make \TeX\ communicate a font to the |.dvi| file unless a
  |.tfm| file is available (and the automatic font generation mechanism
  only deals with information in the |.dvi| file). And of course, it is
  the processing of the |.mf| file by \Metafont\ that creates the |.tfm|
  file at the same time it produces the font. So that approach was out.

    [Later I hit on the idea of renaming some other |.tfm| to
  |bbold10.tfm| to trick \TeX\ into putting the name of the font into
  the |.dvi| file, but I rejected that without testing when later I
  learned that MFjob deletes the new |.tfm| files made by \Metafont\
  along with all other auxiliary files created en route to the |.pk|
  file.]

    I decided I had to run \Metafont\ myself. An idea that I didn't
  think of at the time would have been to generate only |\magstep0| of
  the fonts (|bbold5,6,7,8,9,10,12,17|). That would produce the |.tfm|
  files and then |dvidrv|+MFjob could generate the remaining
  |\magstep|'s as they were needed.

    Trying to figure out what to run \Metafont\ on, I looked for one
  file (with a name something like `|bboldall.bat|') that would generate
  all the point sizes, but there wasn't one. From examining the chain of
  `|input|' commands in various files, I deduced that one had to run
  \Metafont\ on each file |bbold5.mf| through |bbold17.mf| separately. I
  tried this naively on |bbold10|:
*
     | mf bbold10 |
*
  and got a file |bbold10.260| as a result. This looked very familiar:
  I remembered a file posted to the net by Geoffrey Tobin called
  `Metafont for Beginners.' I found |metafont-for-beginners.tex| on
  CTAN. (I found it by first downloading and uncompressing |FILES.Z| and
  searching the resulting file |FILES|. This contained a list of the
  contents of the tex archive. A better way would have been the
  |quote site index| command mentioned in Section~1, but CTAN was new
  at the time and I didn't know about that command.)

     In `Metafont for Beginners' I found that a command that would
  probably work was
*
     | mf \mode=localfont; input bbold10 |
*
  I tried this and, to my amazement, I found the files |bbold10.tfm| and
  |bbold10.300| were created. Then I ran
*
     | gftopk bbold10 |
*
  but I got the complaint from |gftopk| that it could not find
  |bbold10.gf|. I then tried
*
     | gftopk bbold10.300 |
*
  and I got a new file |bbold10.pk|. (In `Metafont for Beginners' it is
  made clear that the |bbold10.300| would have been |bbold10.300gf| and
  |bbold10.pk| might have been |bbold10.300pk| in an OS without
  unreasonable file naming restrictions). I moved the |.pk| file to
  |C:\texfonts\pixel.lj\300dpi|. Then (still experimenting, really) I
  repeated the the \Metafont\ command with a change (which I deduced from
  examples in MFB):
*
     | mf \mode=localfont; mag=magstep(1); input bbold10 |
*
  This gave me the magnified font |bbold10.360| and |gftopk| gave me a
  new |bbold.pk| which I moved to |C:\texfonts\pixel.lj\360dpi|.
  Experimentation showed there didn't seem to be a |magstephalf| in
  \Metafont\ but I found that |mag=magstep(0.5)| worked and also
  |mag=1.095|.%
\footnote
    {I know now that they give slightly different fonts, the first
     corresponding to a magnification by $\sqrt{1.2} = 1.09544\ldots$}
%
  I wrote a batch file that generated all the fonts |bbold5| through
  |bbold10| at resolutions 300dpi through 746dpi to give me |bbold| at
  six point sizes in seven magnifications. I then copied the |.tfm|
  files to the |\emtex\tfm| directory (the batch file copied the |.pk|
  files to the appropriate |\texfonts\pixel.lj\???dpi| directory as they
  were made). Now I had my new fonts installed.

  Using them was another thing, but I had some experience along these
  lines. I use only plain \TeX, so the following series of commands in my
  macro file worked nicely:
_
     | % Register the fonts:                                  |
     | \font\tenbbb=bbold10                                   |
     | \font\sevenbbb=bbold7                                  |
     | \font\fivebbb=bbold5                                   |
     | % Allocate a new math family:                          |
     | \newfam\bbbfam                                         |
     | % Inform TeX what fonts to use in text and subscripts: |
     | \textfont\bbbfam=\tenbbb                               |
     | \scriptfont\bbbfam=\sevenbbb                           |
     | \scriptscriptfont\bbbfam=\fivebbb                      |
     | % Define a command to select the font:                 |
     | \def\Bbb\{\tenbbb\fam\bbbfam\}                         |
_

    I now decided to try out the program `|gftodvi|' that is supposed to
  produce a graphical image of one's new font. (It is intended for font
  design, but I wanted to play around with my new toys). The idea of
  |gftodvi| is to produce a |.dvi| file which, when viewed or printed,
  will show you a magnified image of each character in the font. I
  didn't know how it worked, I just regenerated |bbold10.300|(|gf|) and
  issued the command
*
     |gftodvi bbold10.300|
*
  But |gftodvi| complained of not being able to find the font `|gray|'.
  I checked the list of fonts stored in the |.fli| files (the list is in
  |readme.eng|) and `|gray|' was not among them. I looked in my
  |pixel.lj\???dpi| directories: no `|gray.pk|'. I looked in the
  |\emtex\mfinputs| directory: no `|gray.mf|', but there were
  `|grayf.mf|' `|grayfx.mf|' and `|graylj.mf|'. Reasoning that \emTeX\
  had provided for |gray|'s for different devices, I generated the
  `|gray|' font by
_
     | mf  \mode=localfont; input graylj                    |
     | gftopk  graylj.300                                   |
     | copy  graylj.pk  C:\texfonts\pixel.lj\300dpi\gray.pk |
     | copy  graylj.tfm  C:\emtex\tfm\gray.tfm              |
_
  and now `|gftodvi bbold10|' followed by `|v bbold10|' presented me
  with the |bbold10| font, one character to a page, with the characters
  built out of pixels that looked like tiny gray squares. In practice,
  you should generate |bbold10.260|. For example, by omitting any
  |mode=| command \Metafont\ will enter ``proof'' mode and build
  |bbold10.2602gf| with its extension truncated to |.260| under DOS.
  Then |gftodvi| will create a |.dvi| file with each character presented
  as a nice, large, well-labeled picture.

\section
                        9. Using |fontlib|

    If you really want to set up automatic font creation, you probably
  don't want to have large amounts of fonts taking up disk space. I
  decided to break the font libraries |*.fli| into individual files and
  delete large numbers of them, as follows:

    What I had were all the |lj_*.fli| of laserjet fonts and |p6l_*.fli|
  of 180 dpi dot matrix fonts. I deleted |lj_3,4,5.fli| and
  |p6l_3,4,5.fli| keeping only |\magstep 2| and smaller. Then I
  `unlibraried' the fonts with commands like the following, entered
  while in |c:\texfonts| where the |.fli| files are stored.
*
      |fontlib /v /b300 /d lj_2 =pixel.lj\%rdpi :2 #*.*|
*
%
  Note that the |/b300| refers to the base resolution (i.e. the printer
  resolution the fonts are designed for), while |%r| refers to the
%
\midinsert
\figure
 ;                          fontlib /v /b300 /d lj_2 =pixel.lj\%rdpi :2 #*.*
 ;                                   |    |   |  |    --------------  | | |
 ;                                   |    |   |  |           |        | | |
  Meaning:                           |    |   |  |           |        | | |
  Verbose mode_______________________|    |   |  |           |        | | |
  Base resolution is 300 dpi______________|   |  |           |        | | |
  Create directories as needed________________|  |           |        | | |
  Name of library fonts are copied from__________|           |        | | |
  Directory to put fonts into (%r means resolution)__________|        | | |
  Magnifications to select (lj_2 has only \magstep 2)_________________| | |
  Operation (# means copy from library to individual files)_____________| |
  All matching fonts______________________________________________________|
~
\centerline{%
                                Figure 1}
\endinsert
\noindent
  actual resolution (or size) after magnification is taken into account.
  This is calculated by |fontlib| itself from 300 times (1.2)$^2$ where 2
  is from the |:2| parameter. This produces |432dpi| for the directory
  |%rdpi| in this example. The only thing that needs changing in this
  command line to extract fonts from another library is the name of the
  library and the |:2|. (The documentation, |fontlib.doc|, seems to
  state that |%s| should be used instead of |%r|, but this is incorrect.
  Also, under 4DOS, the use of |%| sign will be interpreted differently
  than under |command.com|. If you have 4DOS, use |%%r| instead of
  |%r|.)

    I issued such commands four times altogether, for the libraries
  |lj_0|, |lj_h|, |lj_1| and |lj_2| in turn, with corresponding changes
  to the |\magstep| parameter (This could have created new directories
  but did not, because I already had subdirectories |pixel.lj\300dpi|,
  etc., containing the AMS fonts.) I did the same for the |p6l_0.fli|
  through |p6l_2.fli|. Then I deleted the |.fli| files and went through
  the directories of |.pk| fonts and deleted fonts that I thought would
  be seldom used (the |cminch| for example and the cyrillic fonts |wnc*|
  from  \AMS fonts). I made sure before I deleted a font that I had the
  corresponding |.mf| file in |\emtex\mfinput| so the font could be
  recreated again.

    Adding fonts to existing libraries is very similar to the above, the
  only change being the use of |+| instead of |#| in the command line.
  Creating a new library is like adding files to an existing one, except
  that the option |/c| is included. Now, after several months under this
  system, I have recreated the libraries. They are much smaller now,
  even with additional (non-|cm|) fonts included. From time to time I
  examine the |pixel_*\|nnn|dpi| directories and copy some of the fonts
  into the existing libraries.

    There is an advantage to keeping fonts in a library. Consider the
  following statistics: I have 117 individual font files with total size
  of 690K, but because my disk space is allocated in clusters of size
  2K, they actually occupy 756K. One of my libraries contains 147 fonts
  with a total size of 807K. The size of the library (fonts plus header
  information) is 809K and the alocated disk space is 810K. The wasted
  space due to unfilled clusters for individual files is 66K, while for
  the single library, the total wasted space is 3K. There is also a vast
  simplification in moving fonts from one place to another if they are
  packed in libraries.

\section
                  10. Automating the process: MFjob.

    This generation of families of fonts can be automated by recourse to
  MFjob. In the tradition of our founder Donald E. Knuth, I have told
  some white lies: I actually did only a fraction of the steps in
  Section~8 and created the rest of the |bbold| fonts using MFjob. This
  required quite a lot of study of the documentation. (The
  time-consuming aspect is not in trying to figure out what things mean,
  but what is their significance and what are their implications.)

    I created a file |bbold.mfj| which consists of the following lines:
_
     | input [modes];       % inputs a definition file |
     | def s=[s0 sh s1 s2]; % "s" for scaling          |
     | {                                               |
     | base=plain;                                     |
     | fonts=bbold8 bbold9 bbold10 bbold12 bbold17;    |
     | mags=s; lj;                                     |
     | }                                               |
_
  MFjob has a kind of simple macro facility (using |def|) so the `|s|'
  in the last line expands to |s0 sh s1 s2|,  and then |s0| means
  |magstep(0)|, etc. `|input [modes]|' means input the files |modes.mfj|
  which define some of the abbreviations. In particular it defines |lj|
  to expand to certain commands that explain where to put the fonts, where to
  find the font libraries (which MFjob checks to see if the font already
  exists), etc. You have to edit |modes.mfj| to match your installation
  (in particular I had to replace references to |C:\newfonts| with
  |C:\texfonts|). To figure out how to change |modes.mfj|, check the
  definition of |lj| (look for |def lj=[...]|) and then check each
  variable inside the braces and see what it expands to, and so on until
  actual directories or other real information is reached. It should be
  fairly clear what each means, but here is an example. The 4 most
  important lines in my |modes.mfj| now appear:
_
     | def lj= [mode_lj;  output_lj;  tfmlog];                      |
     | def mode_lj= [mode=hplaser[300]];                            |
     | def output_lj= [output=pk[$DVIDRVFONTS:pixel.lj\@Rrdpi\@f]]; |
     | def tfmlog=[output=tfm[$TEXTFM:@f] log[D:\temp\@f];];        |
_
  Thus, the single expression |lj| in |bbold.mfj| first expands to
*
     | mode_lj;  output_lj;  tfmlog|
*
  and ultimately to
_
     | mode=hplaser[300];                          |
     | output=pk[$DVIDRVFONTS:pixel.lj\@Rrdpi\@f]; |
     | output=tfm[$TEXTFM:@f] log[$TEMP:@f];       |
_
  which tell MFjob to use the \Metafont\ mode `hplaser', to put the
  |.pk| files in the same place as the |lj.cnf| instructs the drivers to
  look (compare with the listing of |lj.cnf| in Section~7), to place the
  |.tfm| files in the directory pointed to by the environmental variable
  |TEXTFM| (the current directory if |TEXTFM| is not set) and, finally,
  to put the \Metafont\ |.log| files in my |TEMP| directory (a ramdisk).

    If everything was correct, all I had to do was type
*
       | mfjob bbold |
*
  but I was uneasy and instead used
*
      | mfjob /cbbold.bat bbold |
*
  The `|/cbbold.bat|' says to do nothing except write a batch file
  |bbold.bat| that would create the fonts if run. This way, I could
  debug the file |bbold.mfj| (which I had to do several times, mostly to
  insert missing semi-colons---every command has to terminate with one).
  If you have not renamed your |mf386.exe| to |mf.exe| as I did, you
  should also use the switch `|/3|' which says to use |mf386.exe| as the
  metafont executable.

    I finally ran the batch file when I was satisfied with the result.
  It is a fairly simple batch file to understand. Here is a sample of
  part of |bbold.bat| produced from the above command:
_
     | mkdir mfj47227.tmp                                          |
     | chdir mfj47227.tmp                                          |
     | mf.exe /n &plain \mode=hplaser; mag=1.0000; input bbold8    |
     | if errorlevel 1 goto end                                    |
     | copy bbold8.log d:\temp\bbold8.log                          |
     | del bbold8.log                                              |
     | copy bbold8.tfm c:\emtex\tfm\bbold8.tfm                     |
     | del bbold8.tfm                                              |
     | gftopk.exe bbold8.300 c:\texfonts\pixel.lj\300dpi\bbold8.pk |
     | if errorlevel 1 goto end                                    |
     | del bbold8.300                                              |
_
  After a repetition of a similar sequence of lines for each
  font\slash magnification combination, the file ends with
  the commands
_
     | :end               |
     | chdir ..           |
     | rmdir mfj47227.tmp |
_
  to delete the temporary directory. Running the batch file caused no
  problems and I now use the |bbold| fonts regularly.

    The |bbold.mfj| listed above inputs |modes.mfj| in which certain
  paths are defined, some abbreviations are defined and an |output=|
  declaration appears. This |output| declaration tells what to do with
  the various files (|.tfm|, |.log|, |.pk|. etc.) created during a
  font-making run. When MFjob is called by |dvidrv.exe| for on-the-fly
  font generation, many things are different. Having encounterer a font
  in the |.dvi| file that is unavailable, the \emTeX\ drivers will write
  a temporary file (usually named |dv1.mfj| in my experience). This file
  contains it's own |output=| declaration. The difference is that this
  declaration essential tells MFjob to keep only the |.pk| file. This is
  natural, since a font name can never get into the |.dvi| file unless a
  |.tfm| file was available, and the other files (e.g., |.log|) are not
  useful except for debugging.

    Another difference is that |dv1.mfj| begins with |input [dvidrv]|,
  and the file |dvidrv.mfj| from directory |\emtex\mfjob| is input at
  the start. By changing this file, some default behavior might be
  changed (but at present I am not sure how to do this. The format of an
  |.mfj| file is rather rigid and a block structure essentially limits
  the contents of |dvidrv.mfj| to definitions.)

\section
                  11. The Sauter fonts and |dc| fonts.

    The Sauter fonts (actually the |cm| fonts with the Sauter point-size
  interpolation scheme) are a way to further streamline the font
  manipulations. The idea of the Sauter system is to create an |.mf|
  file (such as |cmr10.mf|) containing only two lines
_
     | design_size:=10; |
     | input b-cmr      |
_
  The file |b-cmr.mf| contains some calculations that set various
  parameters required to generate the font |cmr10| and then inputs the
  same files (essentially) that the original |cmr10.mf| would have input
  and with the same parameter values. That is, this version of
  |cmr10.mf| plus |b-cmr.mf| is equivalent to the original |cmr10.mf|.
  The beauty of the system is that to create |cmr12| one has only to
  change the |10| to |12| and rename |cmr10.mf| to |cmr12.mf|. One can
  also create |cmr13|, which is not normally possible. This lends itself
  beautifully to the automatic generation of fonts because MFjob
  understands this system and {\it does not need an |.mf| file to
  generate most |cm| fonts}. The way this works is via the lines in the
  file |dvidrv.mfj|:
_
    | rule=cm*           % Sauter fonts       |
    | {                                       |
    | name=[@f at s];                            |
    | commands=[design_size:=@s; input b- at f]; |
    | base = cm;                              |
    | }                                       |
_
  The essence of these lines is that if, for example, |cmr10| is required
  to be generated and the file |cmr10.mf| cannot be found, then MFjob
  will parse the font name into |@f="cmr"| and |@s="10"|. Then it will
  feed to \Metafont\ (by writing a temporary file) the commands
  listed in the sample |cmr10.mf| above.

    When I stumbled on this I immediately wanted to delete all
  my |cm*.mf| files. I was a little too cautious to do that right away,
  but that is indeed what I have done. Similarly, I have acquired the |dc|
  fonts (which come, for example, with a file |dcr10.mf| similar to
  |cmr10.mf| above, plus |dcr.mf|, which plays the role of b-cmr.mf),
  generated their |.tfm| files only via the following |.mfj| script:
_
  | input [dvidrv]; input [modes];                                         |
  | {                                                                      |
  | fonts=dccsc10 dcr10 dcsl10 dcss10 dcti10 dctt10 dcbx7 dcr7 dcbx5 dcr5; |
  | mags=s0; mode_lj; output=tfm[\$TEXTFM:@f];                             |
  | }                                                                      |
_
  and now let MFjob make them when needed, without need for individual
  |.mf| for each point size. (The |dc| fonts use the same mechanism and
  |dvidrv.mfj| has also a |rule=dc*| declaration similar to the |rule=cm*|
  one above.)

\subsection\bf
                          Acknowledgements

      [Not completed, but surely to mention Eberhard Mattes]

%%%%%%%%%%%%%%%%%%%%%% End of addenda.524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%




More information about the csTeX mailing list