[comp.text] TeXhax Volume 88, Number 43

bts@sas.UUCP (Brian T. Schellenberger) (05/09/88)

TeXhax Digest   Friday, May  6, 1988   Volume 88 : Issue 43
                [SCORE.STANFORD.EDU]<TEX.TEXHAX>TEXHAX43.88


Moderator: Malcolm Brown

Today's Topics:

                        TeX-C bug or feature?
                       Pretty Printing with TeX
                            WEB2C is here!
                       DVI previewer for T40xx
                       overfull citation labels
               Re: Zero TFM checksums (TeXhax V88 #41)
         Re: \newread and reading and writing the same file.
                        Re: VMS manuals in TeX
                         Re: tuglist on-line
                          latex, \clearpage
                               Animals
                 LaTeX style server breakdown on 4/29
           METAFONT settings for Qume ScripTEN; TeX on PCs
             Re:  Pretty printing using TeX (TEXHAX40.88)

----------------------------------------------------------------------


Date: Thu, 28 Apr 88 13:38:08 ADT
From: Dave Dermott <DERMOTT@DREA-XX.ARPA>
Subject: TeX-C bug or feature?

 Is this a bug in TeX_C or a "feature" of some compilers?
This is in function zlinebreak()
     linediff = mem [ r + 1 ] .hh .v.LH - bestline ; 
This corresponds to  WEB listing from section 875
< Find the best active node for the desired looseness>
..
line_diff := line_number(r) - bestline;
  line_number and bestline are halfwords ( unsigned  16 bit values)
  line_diff is a integer ( long in C ie 32 bit signed)

Is the difference between 2 unsigned values unsigned? What if
line_number(r) < bestline? This happens in the TRIP test.

I tried this simple program:
unsigned int i,j; /*or  unsigned short i,j; */
long m;
main()
{
i=5;
j=7;
m=i-j;
printf(" m= %ld\n",m);
}
 With Vax-C , declaring as either unsigned short or unsigned int,
the result is m= -2. With Megamax C on the Atari ST(68000),using
unsigned int (unsigned short is not allowed) the result is 65534.
With Megamax unsigned int is 16 bits and long is 32 bits.

  It looks like VAX-C converts all 16 bit values to 32 bits, then
does the operation , making m = (2**32 -2 ).
   Is one or the other answer right or is the result system dependent?

   I got around the problem by putting (long) in front of both
variables on right side. That seemed to the last bug in the port of
TeX-C to the Atari ST, it now passes the TRIP test except for errors
of about 0.000001 is glue values.
David Dermott DERMOTT@DREA-XX.ARPA
Dartmouth NS

------------------------------

Date:     Thu, 28 Apr 88 06:15 PST
From: <ASND%TRIUMFCL.BITNET@forsythe.stanford.edu>
Subject:  Pretty Printing with TeX

Norman Ramsey's requirements for a pretty-printing package
intrigued me, and spurred me to write such a beast.  It has
not been exhaustively tested yet though. The macros are given
below, and here are the instructions:

To turn on pretty printing, use \prettyprint, most usefully
inside a group or a \vbox.  Don't set new values for \hsize,
\parindent, \indentation, \indentincrem or \availwd inside
the pretty-printing environment.  Do set \indentation and
\indentincrem to appropriate values BEFORE \prettyprint,
usually at the beginning of a document.

Program structures are grouped within square brackets; a
structure can be complex, with many clauses and sub-structures,
or as simple as a single statement.  Clauses within a structure
are either a) separated by \clause (or \lastclause) or b)
enclosed by [ ].  Pretty-print will put all of a structure on
one line unless a) it doesn't fit or b) it contains a sub-structure;
either a) or b) will cause the structure to be printed with each
clause on a separate line, with the second and ff. indented
one step futhter.  \clause before [ is redundant but does not hurt.
No \clause is assumed after ], which is in fact just an end group
character like }.

Each structure at the outermost level is typeset as a paragraph,
so try not to enclose a whole program in [ ] or the paragraph may get
too big.  At the outermost level, the brackets are not necessary for
short, simple lines. \obeylines is in effect so there are linebreaks
between statements.

Of course the names of the macros can be changed, and the definitions
customized to a particular (programming) language.  For example, in C,
one could make { and } do the work of [ and ], with echoing, and use
some other characters for ordinary TeX grouping.

%%.......................Macros........................

% Pretty-printing program listings;
%           by Donald Arseneau
\newif\ifononeline     % should this structure try to fit on one line?
\newdimen\indentation  % total indentation (set to initial value before using)
\newdimen\indentincrem % increment for each level of nesting
\newdimen\availwd      % width available to a sub-structure
\newbox\structure      % one structure of the program (contents of [])

%   turn on program listing style (should probably be in a group)
\def\prettyprint{%
    \parindent=\indentation % initial indentation
    \availwd=\hsize
    \advance\availwd by-\indentation\advance\availwd by-\indentincrem
    \advance\availwd by-\rightskip \advance\availwd by-\leftskip
    \ononelinetrue
    \catcode`[=\active
    \catcode`]=2 % closing
    \obeylines}  % obeylines only affects outermost level

%   the [ character
\def\startgrouping{\global\ononelinefalse  % all super-structures multiline
    \ononelinetrue  % This structure tries to be one line
    \newpar         % start a new line, and indent
    \afterassignment\startstructure  % do \startstructure in the hbox
    \setbox\structure=\hbox\bgroup}  % box this structure

\def\newpar{\par\noindent\hskip\indentation\relax} % at outer level, use par

%    first thing in hbox
\def\startstructure{%
     \let\newpar=\clause % nested structures are \clause s, not \par s
     \aftergroup\endstructure  % after the hbox, end structure
     \advance\indentation by \indentincrem % increase indentation for clauses
     \advance\availwd by -\indentincrem
}

%    first thing after hbox
\def\endstructure{%  decide how to output structure,
                  %  on one line (\box) or multiline (\unhbox):
     \let\next=\unhbox
     \ifononeline \ifdim\wd\structure<\availwd
           \let\next=\box
     \fi\fi
     \next\structure
     }

%    set the breakpoint between clauses.
\def\clause{\ifdim\lastskip=\indentation \else % \clause\clause acts as one
     \hfil\penalty-200  \hskip-\indentation\relax
     \null\nobreak\hskip\indentation\relax
     \fi}
%    a clause that should not be indented as far as others
%    e.g., ...\lastclause ENDIF]
%    (could instead use simply:  ...]\clause ENDIF )
\def\lastclause{\clause
     \hskip -\indentincrem}

\catcode`[=\active \let[=\startgrouping \catcode`[=12

%............... Now to test ..............
\let \\=\clause
\begingroup
\indentation=1in  \indentincrem=1.5em
\hsize= 3in  %%%%  try different values:  fails below 2.8in
\prettyprint

% don't need [ ] at outer level, and \obeylines is in effect
program test
variables are nonsense
[$a:=3$;]
% use [ ] to delimit clauses forces separate lines:
[if $a=3$ [then $b:=2$;] [else $b:=0$;];]
% use \clause (alias \\) to delimit clauses:
[for all $i$: \\ $at:=at+v(i)$;;]
[for all $j$:
%  note no obeylines inside a structure
  [if $v(j)>1$ \\then $v(j):=1/v(j);$ \\[else if $v(j)<0$
    \\then $v(j):=v(j)~2$; \\else $v(j)=\sqrt{v(j)}$;];]
\\$bt:=bt+v(j)$;]
exit
[end]

\endgroup
\bye
                              Donald Arseneau
                              asnd@triumfcl.bitnet
                              userasnd@mtsg.ubc.ca

------------------------------

Date: Thu, 28 Apr 88 10:50:26 PDT
From: mackay@june.cs.washington.edu (Pierre MacKay)
Subject: WEB2C is here!

# It looks as if this was one of the files caught in the SCORE disk
# crash, so here it is again.

Tim Morgan has released the more general version of WEB-to-C, a follow-up
to TeX-to-C.  This will be of especial interest to all the many Unix sites
with versions of SystemV Unix that have had difficulty with BSD-based
pascal change files.

WEB-to-C includes change files for C compilation of TeX, METAFONT and TeXware.
Work is proceeding on a change file for BibTeX.  What we need now are
change files for METAFONTware, and this is an invitation to any volunteers
out there to make up such files along the model of the TeXware files.
Change files for things like dviimp.web are also needed.

Tim Morgan recommends experimentation with register variables in compilation,
but I would add a caution that even after a register-variable TeX has
passed trip, a really complex file (LaTeX + PicTeX, for instance) can get
register allocation out of sync.  This is a C compiler problem, not a
problem with WEB-to-C.  

I would like to ask as many people as possible to exercise versions of
the GNU gcc compiler on this software.  There are reports that gcc
1.19 and 1.20 works well on most machines, but sometimes coughs when
optimization is turned on.  If that turns out to be so, please help
the Free Software Foundation out by submitting precise accounts of the
bugs you have smoked out, using the forms outlined in the gcc
documentation. In the future, I hope to send out this distribution
with the strongest possible recommendation to use gcc for compilation.
(With gcc, the risks of register variables are irrelevant.)

As the README file that comes with WEB-to-C shows, the system has already
proved successful with a wide variety of architectures and flavors of
Unix.  In time it should replace pascal compilation altogether.  (No 
reflection on pascal as a language, it is just that in the Unix environment,
C is the obvious tool, especially where I/O efficiency is in question.)
We hope to see the widest possible variety, particularly of SystemV
sites try this out, and we welcome the details of any adjustments that
are needed.  There is no configure file now---the package is too new, 
but with enough information from a variety of sites, we hope it will
be possible to produce something like the splendid configure file that
comes with the "patch" utility.  

At the price of some intensive work converting simple arrays to pointer 
structures, it should be possible for even Xenix sites to make use of the
WEB-to-C system.  The problem is in dealing with the 286 segmented 
architecture.  TeX likes to treat arrays as continuously addressable
over a really wide range, and 64KB is not, by modern standards, a wide range.
I recently used WEB-to-C to provide TeX with a million nodes of
general purpose memory (boxes, macros, etc.) and it runs very fast
if you can afford a 9 megabyte core image.  64KB is a bit restrictive.

web2c.shar.Z is available for FTP on ~ftp/pub at
june.cs.washington.edu.  I have chosen a shar archive rather than tar,
so that a variety of SystemV sites can make use of it.  If you don't
have a working tangle, get tangle.c from the same source.  If anyone
has a good bridging system and can conveniently pass this file on
to the TAMVM BITNET server, please do so with our blessing.

Remember.  METAFONTware, and associated change files are urgently needed
to add to this package, and any help and advice with the development of
a configure file will be very much appreciated.

Email:  mackay@june.cs.washington.edu		Pierre A. MacKay
Smail:  Northwest Computing Support Group	TUG Site Coordinator for
	Lewis Hall, Mail Stop DW10		Unix-flavored TeX
	University of Washington
	Seattle, WA 98195
	(206) 543-6259

------------------------------

Date: Thu, 28 Apr 88 16:37:47 CDT
From: paul  gilna <pgil@sphinx.uchicago.edu>
Subject: DVI previewer for T40xx

Quickly now,
Where can I FTP a DVI to tek previewer to run on (a) VAX/VMS and (b) SUN
-paul gilna-	pgil@sphinx.uchicago.edu.		thanks
There!

------------------------------

From:     FISHER%SCR.SDSCNET@Sds.Sdsc.Edu
Subject: overfull citation labels

I am using the article.sty file from LaTeX in combination with BibTeX 0.98i 
to generate a document with citations and am having some overfull 
box problems.  Due to the unfortunate circumstances I find myself in,
I need to use a .bst file on the order of Oren Patashnik's natsci.bst.
When I use this .bst, the citation labels in the text get rather lengthy,
and can extend over the righthand margin considerably, so I get something
that looks like:

      |-----------------text--------------------|
      |-----------------text--------------------|
      |-----------------text---------[Johnson and Johnson, 1988].
      |-----------------text--------------------|
      |-----------------text--------------------|

I have seen this occur with standard .bst files that generate lists of 
numbers in the text that extend beyond the margin as well, although the 
problem in this case is usually less severe.  Is there some trick to 
getting this to work right (i.e., splitting the cite across two lines)?

------------------------------

Date:    Thu Apr 28 18:57:35 MET 1988
From: XITIJSCH%DDATHD21.BITNET@forsythe.stanford.edu
Subject: Re: Zero TFM checksums (TeXhax V88 #41)

In TeXhax #41 Pierre MacKay writes

>  It is part of the specifications for a DVI driver that the occurrence of
>  a xero checksum in either the DVI specification or the associated
>  rasterized file (gf, pk, or pxl, for instance) should shut off checksum
>  validation in the driver.
>
>  [...]
>
>  It is a funny case:  If checksum values have disappeared,. the problem
>  may only have been revealed by a non-standard feature in the driver,
>  but it is still a non-standard feature.  The standard feature, which
>  shuts off checksum comparison if either is 0 can be very useful.

I would like to point out that (to my knowledge) in the whole
TeX related documentation there are only two places where the
ignoring of zero checksums is handled:
 (1) In TeX, the program. (section 542, where the TFM format
     is explained -- the remark about zero checksums is parenthesized)
 (2) In the article of David Fuchs about the PXL file format (Type 1001).
     This article appeared in TUGboat, Vol. 2 (1981) [sic!], No. 3.

A driver writer doesn't have to bother with TeX (the program) or
with TFM files (all needed information is available in the font files).
And nowadays only a few people still know about the article of
David in 1981, the PXL format has gone...

So, if there's a driver which doesn't follow the ``standard
specification,'' don't blame the author, blame the documentation.
Constructively spoken, this ``standard feature'' should be
specified in the documentation of the (GF and PK) font file formats.
Btw, our first drivers didn't ignore the zero checksum, either.
Now, they do.

                                Joachim

P.S.: Concerning ``standard specification'' -- what about
      all those drivers which ignore the x-escapement (the width
      of a character in pixels) in the fonts? Note, that it
      can differ in at most one pixel from the TFM-width. D. Knuth
      states that the x-escapement should be used and rounding
      errors should be corrected according to DVItype. Especially
      at low resolutions (<= 300 dpi) this is very important.



   TH Darmstadt
   Institut f\"ur Theoretische Informatik
   Joachim Schrod
   Alexanderstr. 24            Bitnet: XITIJSCH@DDATHD21
                                  (Please try again if I don't answer ---
   D-6100 Darmstadt               our Bitnet connection is very instable...)
   West Germany

------------------------------

Date: Fri 29 Apr 88 00:28:19-PDT
From: Barbara Beeton <BEETON@Score.Stanford.EDU>
Subject: Re: \newread and reading and writing the same file.

in answer to darren stalder's questions about files:
1.  \newread is defined in plain to be outer (texbook, p 347); therefore it
    can't be used within another definition.
2.  assuming that the file that is being read was opened by \openin , to
    use it again it would have to be closed and reopened, by \openout if
    it is to be written to.  it may also have to be declared with a
    \newwrite , which is subject to the same outer restriction as \openin .
					-- barbara beeton

------------------------------

Date: Fri 29 Apr 88 00:35:33-PDT
From: Barbara Beeton <BEETON@Score.Stanford.EDU>
Subject: Re: VMS manuals in TeX

dec is using tex as a back end for a rather elaborate system based on
sgml-type element tagging and a database.  they've "productized" this
system now -- i think they call it "document".  i'm not sure whether
the tex macro package is part of the product; i do know that they
consider it to be proprietary, though, since it was developed for them
under contract by a consultant.
					-- barbara beeton

------------------------------

Date: Fri 29 Apr 88 01:11:23-PDT
From: Barbara Beeton <BEETON@Score.Stanford.EDU>
Subject: Re: tuglist on-line

the tug database is now maintained on a pc, and the tex file generated
to produce the printed list is somewhat inscrutable, as well as large.
but i will make this request known to the tug steering committee, and
perhaps they will come up with something.  jane colman is listed as being
at lawrence berkeley lab -- jane@lbl-rtsg .
	extra printed copies of the membership list can be obtained from
tug (there's a charge, but i don't know what it is).  tug's e-mail address
is tug@seed.ams.com.  and by the way, tug is moving as of may 1.  the
post office box address remains the same:
	TeX Users Group
	P O Box 9506
	Providence, RI 02940-9506
but the street address changes to
	653 North Main Street
	Providence, RI 02904
					-- barbara beeton

------------------------------

From: Eric Ole Barber <mcvax!nw.stl.stc.co.uk!sizex@uunet.UU.NET>
Date: Thu, 28 Apr 88 14:32:23 BST
Subject: latex, \clearpage

I'm using \clearpage to force all figures in a section into the same section,
and start a new section on a fresh page. If \clearpage has to force out a page
of floats, then no figures appear on the first page of the next section. Since
I have a section with a tiny bit of text and a tiny figure following a section
where \clearpage has forced out a page of floats, I get 2 pages with not much
on them rather than 1 which looks a bit healthier.
Does anyone have a fix, or a pointer (to the manual ;-))? Thanks Eric Barber

------------------------------

From: <amgreene@ATHENA.MIT.EDU>
Subject: Animals
Date: Fri, 29 Apr 88 18:26:35 EDT

Here's a small diversion for those who are sick and tired of TeX files that
produce useful output.

It's an implementation of the classic pseudo-Artificial-Intelligence game
``Animals.''  For those who are unfamiliar with the game, the user thinks
of an animal, and the program asks a whole bunch of yes/no questions about
the animal, stepping down a binary tree until it gets to a guess:  ``Is it
a fish?''  If the guess is wrong, the program adds the user's animal and
a question to tell them apart to the database.

This program was written to prove that TeX can really be used as a regular
programming language.  Thanks for inspiration go to Mark Eichin and
Jonathan Kamens, both members of the Studnet Information Processing Board
at MIT, for telling me they'd believe it could be done when they saw it.

There are two places in the program where filenames appear.  These will
have to be modified for your system, unless you have a directory called
/mit/amgreene/texhax.  These can be found quickly by searching for the
flag *FLAG*.

- Andrew Marc Greene (amgreene@athena.mit.edu)
  Student Information Processing Board, MIT


%%% As amsuing as Andrew's submission is, it is too large 
%%% for distrbution via the digest. It
%%% is available for FTP retrieval on the machine SCORE.STANFORD.EDU
%%% under the filename
%%%    <TEX.TEXHAX>ANIMALS.TXH
%%% A copy of the file has been sent to TEX-L for BITNET access.  Malcolm

------------------------------

Subject: LaTeX style server breakdown on 4/29
Date: Fri, 29 Apr 88 19:10:33 -0400
From: Ken Yap <ken@cs.rochester.edu>

We had some problems with our network software and this interacted with
some less than robust software of mine to trash one day's worth of
requests. If you submitted a request around that time, please resubmit.

/* mild flame on */

I would also like to take this chance to mention that if you don't get
any reply from the server, please read the instructions again. I have
seen requests with addresses that won't work e.g. wiscvm.wisc.edu is no
longer, neither is seismo talking to us (try uunet.uu.net), and our
mailer doesn't expand .uucp suffixes. Also requests that are missing
essential lines. One request used wildcards - those don't work. I
have nothing against wildcards, but there are too many interpretations
out there and how much pain is it to type in a couple more filenames
anyway?

I'm sorry to make the software so rigid about the format, but it was
thrown together in a hurry and I don't have time to develop it
further.  You could do worse than take the example in my directory
postings and edit that for your use.

/* mild flame off */

If you can't figure out a legal address, send mail to me
(ken@cs.rochester.edu) and I will return your message, headers and all,
to give you some clues.  I will use the best return path to you I know
of. If my mail bounces, well, c'est la vie...

Thanks for your patience.

	Ken

------------------------------

Date: Wed, 20 Apr 88 19:54:17 EDT
From: jonradel (Jon Radel)
Subject: METAFONT settings for Qume ScripTEN; TeX on PCs

(1)
Has anyone come up with nice settings to make fonts for the Qume 
ScripTEN PostScript printer?  It uses the Hitachi SL-100 300dpi, 
write-white engine.  Thanks.

(2) 
I realize that the majority of the readers of this digest are running 
TeX on workstations or bigger, and that most of you have the same, or 
better, access to the worldnet that I do.  Despite this, I've seen 
enough pleas for information on running TeX on an IBM PC here that 
I'll make a more formal announcement of what Ken Yap announced 
tangentially in the most recent LaTeX-style announcement.
 
I'm offering TeX materials for PCs (IBM and clone) on floppies.  I'll 
be the first to admit that the collection isn't terribly exciting at 
the moment, consisting of Common-TeX v2.1*, the Rochester LaTeX-style 
collection, the source files from Stanford, back issues of TeXhax and 
TeXMaG, MakeIndex*, and some fonts in GF and PK. (*with MS-DOS 
executables)  However, since I'm working on making it better, bigger, 
and ever so much shinier, there is hope for the future.  
 
The stuff is available on floppy disk only:
 
formatted floppy, SASE, $1.50 per disk
-or-
$6.00 per disk
 
SASE for the current list of material---which is essentially 
unreadable without the table macros I use, and I can't distribute 
those.  (In other words, you really want a hard copy.)
 
Send above to:
               Jon Radel
               P.O. Box 2276
               Reston, VA  22090
 
If you have anything you'd be willing to donate to the collection, I 
promise to treat it with respect.
 
--Jon Radel
jonradel@icecream.princeton.edu
jonradel%icecream.princeton.edu@princeton.edu

------------------------------

From: Mike Wray <mcvax!upper.ist.co.uk!mjw@uunet.UU.NET>
Date: Fri, 29 Apr 88 09:36:02 BST
Subject: Re:  Pretty printing using TeX (TEXHAX40.88)

 I quote
	``Pugh and Sinofsky at Cornell have come up with a novel scheme
	for specifiying (sic) line breaks when prettyprinting program text.
	The basic idea is this: a ``group'' structure is defined on the
	text, and objects called ``conditional line breaks'' are introduced."

 This is hardly ``novel". See ``Prettyprinting", Derek C. Oppen,
 ACM TOPLAS, 2(4), Oct. 1980.  The conditional line breaks described
 by Norman correspond to Oppen's consistent breaks --- other
 sorts are possible too.  Although Oppen's paper gives the algorithm
 in Mesa, which makes it hard to understand, it can be
 simply implemented in Lisp in 30-40 lines.  Lists can be done
 in TeX, but I wouldn't fancy doing it that way myself. 
 Don't get me wrong, I like what TeX can do, but as a programming
 language I prefer something easy, like binary :-).
 
 	Mike Wray (mjw@ist.co.uk)


------------------------------

%%%
%%% Concerning subscriptions, address changes, unsubscribing:
%%%     BITNET: send a one-line mail message to LISTSERV@TAMVM1.BITNET:
%%%         SUBSCRIBE TEX-L <your name>    % to subscribe
%%%
%%%     All others: send mail to
%%%           texhax-request@score.stanford.edu
%%%     please send a valid arpanet address!!
%%%
%%%
%%% All submissions to: texhax@score.stanford.edu
%%%
%%%\bye
%%%

------------------------------

End of TeXhax Digest
**************************
-------




-- 
                                                         --Brian.
(Brian T. Schellenberger)				 ...!mcnc!rti!sas!bts

. . . now at 2400 baud, so maybe I'll stop bothering to flame long includes.