[comp.text] TeXhax Digest V89 #54

TeXhax@cs.washington.edu (TeXhax Digest) (06/21/89)

TeXhax Digest    Tuesday, May 23, 1989  Volume 89 : Issue 54

Moderators: Tiina Modisett and Pierre MacKay

%%% The TeXhax digest is brought to you as a service of the TeX Users Group %%%
%%%       in cooperation with the UnixTeX distribution service at the       %%%
%%%                      University of Washington                           %%%

Today's Topics:         

                         Three column LaTeX style file
                    Re: AMS symbols not seen in the preview
                          Re: Lost \special in LaTeX
                            \ifs nested ever deeper
                     Macro to help display parsing trees
                              Article on AMS Euler

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

Date: Tue, 23 May 1989 09:36:55.62 CDT
From: <bed_gdg%SHSU.BITNET@UWAVM.ACS.WASHINGTON.EDU> (George D. Greenwade)
Subject: Three column LaTeX style file
Keywords: LaTeX, three column layout

Hello (La)TeX-ers.  Per the discussion of three column layout in LaTeX for
things like newsletters, I have developed a **primitive** threecolumn.sty for
use and development.  I am not a style writer (as can be seen) and am (at best)
a weak hacker, just an economist and editor (so please, give me a break in
evaluating this).  The header material basically explains what the style does,
and I would appreciate comments and suggestions from the wizards out there.
The goal (which is basically met...sort of) is to design a LaTeX three column
output which allows the user to utilize standard LaTeX commands, etc.  This is
attempted to NOT have to make any major re-writes of standard output routines
so that the style file (alone) help generate the output.  I have attempted to
make this somewhat analogous to \twocolumn.  Please give me some input as to
what needs to be done to fix the limitations listed in the header material
(especially multiple column floats, \maketitle, and extra pages on changing the
number of columns).  Given the interest in this sort of file (as seen by
requests and discussions in recent issues of TeXhax), this may provide a
starting point to get the three column job done.  THREECOLUMN.STY follows my
signature block.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
George D. Greenwade, Director                            Bitnet:  BED_GDG@SHSU
Center for Business and Economic Research                THEnet: SHSU::BED_GDG
Sam Houston State University                     Internet: BED_GDG@SHSU.BITNET
Huntsville, Texas  USA  77341-2056                       Voice: (409) 294-1518
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Document sub-style threecolumn.sty   May 23, 1989
%
% Author: George D. Greenwade, Director, Center for Business and Economic
%  Research, Sam Houston State University, Huntsville, TX 77341-2056
%  Voice: (409) 294-1518    Bitnet: BED_GDG@SHSU.BITNET
%
% Date of Release:  May 23, 1989  (original version)
% Revision History:
%
% Purpose: To create LaTeX output in three columns without corrupting the
%  general uses of LaTeX.  This version is not suggested for use unless the
%  ENTIRE DOCUMENT is to be in a three column output with no multiple column
%  floats.
%
% Usage:  Preamble: \documentstyle[...,threecolumn]{...}
%         In text:  \threecolumn
%
% Features: Addition of \photo{height}{caption} to create an empty box of the
%  dimension \columnwidth wide and specified height (#1), with a caption below
%  set in the \sl font.  Height MUST be specified, caption may be blank, but
%  must be left as a null entry (i.e., \photo{2in}{} for a 2-inch blank space).
%  \photo is placed on a minipage within a table[ht].  The caption is photo-
%  specific and does not step the table counter (as best as I can tell).
%
% Known Limitations (which would be nice ot fix):  May 23, 1989
%  (1) \threecolumn does NOT presently handle MULTIPLE COLUMN table and figure
%      floats properly, but does properly handle footnotes; however, there are
%      no apparent float handling problem in \twocolumn or \onecolumn.
%  (2) Switching from \onecolumn to \twocolumn and \onecolumn to \threecolumn
%      behave properly.  Switching from \threecolumn to \twocolumn,
%      \threecolumn to \onecolumn, \twocolumn to \theeecolumn, and \twocolumn
%      to \onecolumn generates a blank (but numbered) page.  As a rule,
%      \twocolumn presents strange output results in this sub-style.
%  (3) \maketitle is inoperable in \threecolumn.
%
% Copyright (c) 1989 by George D. Greenwade
% Permission to copy all or part of this work is granted, provided that the
% copies are not made or distributed for resale, and that the copyright notice
% and this notice are retained.
%
% THIS WORK IS PROVIDED ON AN "AS IS" BASIS.  THE AUTHOR PROVIDES NO WARRANTY
% WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK, INCLUDING
% WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
% PURPOSE.
%
% Please forward all fixes and improvements which do not otherwise corrupt the
% operation of the LaTeX document processing program to the author.
\typeout{Document Style Option 'threecolumn'.  Released 23 May 1989}

\hoffset -.4in                  % Generalized page layout for three column
\voffset -.3in                  %  output.  Certainly, these are subject to
\columnsep 15pt                 %  customization, but these definitions seem to
\textwidth 7.2in                %  provide efficient default margins.
\textheight 9.5in               %
\topmargin 0pt                  %
\headsep 0pt                    %
\headheight 0pt                 %
\oddsidemargin 0pt              %
\pretolerance=500               % Needed pretolerance and tolerance to assure
\tolerance=10000                %  text generally fits the columns
\doublehyphendemerits=100000    % Inhibit consecutive line hyphens
\brokenpenalty=10000            % Inhibit broken words across columns/pages
\widowpenalty=10000             % Inhibit widows at bottom of page
\clubpenalty=10000              % Inhibit orphans at top of page

\newif\if@threecolumn   \@threecolumnfalse   % New ifs used in routine
\newif\if@secondcolumn  \@secondcolumnfalse  %
\newif\if@thirdcolumn   \@thirdcolumnfalse   %
\newbox\@centercolumn                        % New box to place center column
\newdimen\photoblock \photoblock=0pt         % New dimension used in \photo

\def\onecolumn{\clearpage             % Redefine \onecolumn without corruption
     \global\columnwidth\textwidth
     \global\hsize\columnwidth \global\linewidth\columnwidth
     \global\@twocolumnfalse \global\@threecolumnfalse
     \global\@secondcolumnfalse \global\@thirdcolumnfalse
     \@floatplacement}

\def\twocolumn{\clearpage             % Redefine \twocolumn without corruption
     \global\columnwidth\textwidth
     \global\advance\columnwidth -\columnsep \global\divide\columnwidth\tw@
     \global\hsize\columnwidth \global\linewidth\columnwidth
     \global\@twocolumntrue \global\@threecolumnfalse
     \global\@firstcolumntrue \global\@secondcolumnfalse
     \global\@thirdcolumnfalse
     \@dblfloatplacement\@ifnextchar[{\@topnewpage}{}}

\def\threecolumn{\clearpage             % Define \threeecolumn (very rough;
     \global\columnwidth\textwidth      %   handles floats poorly, if at all)
     \global\advance\columnwidth -\columnsep
     \global\advance\columnwidth -\columnsep \global\divide\columnwidth\thr@@
     \global\hsize\columnwidth \global\linewidth\columnwidth
     \global\@twocolumnfalse \global\@threecolumntrue \global\@firstcolumntrue
     \global\@secondcolumnfalse \global\@thirdcolumnfalse
     \@dblfloatplacement\@ifnextchar[{\@topnewpage}{}}

\def\@doclearpagethree{\ifvoid\footins  % Define variation of \@doclearpage
        \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
        \setbox\@tempboxa\box\@ccl
        \xdef\@deferlist{\@toplist\@botlist
            \@deferlist}\gdef\@toplist{}\gdef\@botlist{}\global\@colroom\@colht
             \ifx\@currlist
              \@empty\else\@latexerr{Float(s)
                 lost}\@ehb\gdef\@currlist{}\fi
       \@makefcolumn\@deferlist
        \@whilesw\if@fcolmade \fi{\@opcol
                                  \@makefcolumn\@deferlist}\if@threecolumn
           \if@firstcolumn
             \xdef\@dbldeferlist{\@dbltoplist
                 \@dbldeferlist}\gdef\@dbltoplist{}\global\@colht\textheight
              \begingroup \@dblfloatplacement \@makefcolumn\@dbldeferlist
               \@whilesw\if@fcolmade \fi \endgroup
           \if@secondcolumn
             {\@outputpage\@makefcolumn\@dbldeferlist} \fi \endgroup
           \else \vbox{}\clearpage
        \fi\fi
     \else\setbox\@cclv\vbox{\box\@cclv\vfil}\@makecol\@opcol
      \clearpage
     \fi}

\def\@specialoutput{\ifnum\outputpenalty > -\@Mii  % Redefine \@specialoutput
    \if@threecolumn \@doclearpagethree             %  to handle \threecolumn
    \else \@doclearpage \fi                        %  environment.
  \else
    \ifnum \outputpenalty <-\@Miii
       \ifnum\outputpenalty<-\@MM \deadcycles\z@\fi
       \global\setbox\@holdpg\vbox{\unvbox\@cclv}
    \else \setbox\@tempboxa\box\@ccl
        \@pagedp\dp\@holdpg \@pageht\ht\@holdpg
        \unvbox\@holdpg
        \ifvoid\footins\else\advance\@pageht\ht\footins
          \advance\@pageht\skip\footins \advance\@pagedp\dp\footins
          \insert\footins{\unvbox\footins}\fi
        \@next\@currbox\@currlist{\ifnum\count\@currbox >\z@
            \@addtocurcol\else\@addmarginpar\fi}\@latexbug
    \ifnum \outputpenalty <\z@ \penalty \z@ \fi
  \fi\fi}

\def\@opcol{\global\@mparbottom\z@   % Redefine \@opcol to handle \threecolumn
    \if@twocolumn\@outputdblcol \fi  %   environment without corruption
    \if@threecolumn\@outputtplcol\else
    \@outputpage \global\@colht\textheight \fi}

\def\@skipcolumn{\if@firstcolumn  % Tentatively define \@skipcolumn (for future
  \global\@firstcolumnfalse       %  use in two-column-wide material in the
  \global\@secondcolumnfalse      %  \threecolumn environment)  NOT EMPLOYED!
  \global\@thirdcolumntrue \fi
  \if@secondcolumn \global\@firstcolumntrue \global\@secondcolumnfalse
  \global\@thirdcolumnfalse \fi}

\def\@outputtplcol{\if@firstcolumn     % Define \@outputtplcol (analogous to
    \global\@firstcolumnfalse          %  \@outputdblcol, but for \threecolumn)
    \global\@secondcolumntrue \global\@thirdcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
\else
  \if@secondcolumn \global\@secondcolumnfalse \global\@thirdcolumntrue
   \global\setbox\@centercolumn\box\@outputbox
\else
\global\@thirdcolumnfalse \global\@firstcolumntrue
    \setbox\@outputbox\vbox{\hbox to\textwidth{\hbox to\columnwidth
      {\box\@leftcolumn \hss}\hfil \vrule width\columnseprule\hfil
\hbox to\columnwidth
      {\hss \box\@centercolumn \hss}\hfil \vrule width\columnseprule\hfil
       \hbox to\columnwidth{\box\@outputbox \hss}}}\@combinedblfloats
       \@outputpage \begingroup \@dblfloatplacement \@startdblcolumn
       \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}\endgroup
    \fi \fi}

\def\photoblocksize{\global\photoblock=\columnwidth   % Define width of the
   \advance \photoblock -\columnsep                   %  photo block
   \if@threecolumn \advance \photoblock -\columnsep \fi}

\def\photo#1#2{\photoblocksize   % Define \photo{height}{caption} as floating
 \begin{table}[ht]               %  blank space for photo insertions to be used
\begin{minipage}{\photoblock}    %  in final paste-up.
\rule{0pt}{#1}   \\              % #1 is height
\end{minipage}                   % width defaults to column width
\begin{center} {\sl \ #2}        % #2 is caption set in the \sl font face
\end{center}
\end{table}}

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

Date: Tue, 23 May 89 08:54:54 BST
From: Jon Warbrick <C20222%prime-a.poly-south-west.ac.uk@NSFnet-Relay.AC.UK>
Subject:  Re: AMS symbols not seen in the preview
Keywords: AMS, ArborText

In a recent TeXHax, Michael Maschler asked why some additional AMS
symbols would not display on the screen when using ArborText's
PREVIEW.  I suspect that the problem lies in the PREVIEW.FNT file in
the \ARBORTXT\PREVIEW directory.  It lists all of the magnifications
of all of the fonts that Preview can use, and if something isn't in
there then it doesn't get used!  This is mentioned in the
documentation (somewere).

Jon.


Jon Warbrick, Computing Service,          Plymouth (0752) 233913 (ddi)
Polytechnic South West,
Drake Circus,               JANET:
Plymouth PL4 8AA UK.        J.Warbrick @ UK.AC.POLY-SOUTH-WEST.PRIME-A

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

Date: Tue, 23 May 89 09:37:19 BST
From: David Shepherd <des@inmos-c>
Subject: Re: Lost \special in LaTeX
Keywords: LaTeX, \special

Not sure why the specials don't get into the .DVI file .... but I recognize
the problem. The basic problem seems to be that in LaTeX specials *only* get
emitted if they are after output material on a page, or are specially handled
in the \output routine.

There are two solutions to use.

1) for "prolog" files -- e.g. files of PostScript definitions -- use a
    \specialtop mechanism as in Arbortext DVILASER manual. Basically
    \specialtop builds up a list of specials which get emitted at the
    start of the page output in the \output routine. This is the only
    way to emit \specials from the preamble.

2) for anything just precede all \specials with a \mbox{} as LaTeX considers
   this to be something worth outputting so the following special works.

david shepherd
INMOS ltd

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

Date: Mon, 22 May 89 23:10:24 PDT
From: Donald_Arseneau@mtsg.ubc.ca
Subject: \ifs nested ever deeper
Keywords: nested ifs

Stephan Bechtolsheim's question about nested \if's has raised
quite a fuss.  While the responses have generally been accurate, 
I have to take issue with two of them.
 
While most people rightly pointed out that there is no property 
of if-ness that can be assigned to a macro, Mike Schmidt said 
that simply using macro names starting with \if or \if@ would 
make nesting work. That's not true.  The macro name is irrelevant;
you could even call the macro \ifnum and it still wouldn't work!
 
The common solution given was to have two commands: a macro for
the test followed by an \if; e.g.,
 
    \newif\ifreal 
    \def\testreality#1{{...\ifx#1 %%% Or some other primitive if
          \aftergroup\realtrue \else \aftergroup\realfalse \fi}}
    ...(nested \if's)...
      \testreality{dream}\ifreal...\else...\fi
    ...(nested \fi's)...
 
But there is another solution (that I had sent directly to Stephan 
Bechtolsheim) which doesn't use \newif, but instead uses 
\if...\then ...\else...\fi.  Philip Taylor says such a construction
is IMPOSSIBLE!  It sure IS possible; here's how:
 
     \let\then\iftrue  % (or \let\then\if, or \newif\then or...)
     \def\ifsomething#1\then{...(unbalanced \if)...}
 
Use like "\ifsomething{here}\then do this \else do that \fi";
or, more usefully,
 
    %   \ifsame : checks if its two parameters are the same.
    %
    \let\then\iftrue
    \def\ifsame#1#2\then{\def\@tempa{#1}\def\@tempb{#2}%
             \ifx\@tempa\@tempb}
 
    ...(nested \if's)...
    \ifsame{this}{that}\then ERROR\else the other thing\fi
    ...(nested \fi's)...
 
This works when being skipped because the \then (\iftrue) 
matches the \fi.  Normally, macro expansion eats the \then and
replaces it with another primitive conditional.  So the macro 
looks like an \if whether or not it is being expanded.
 
                                 Donald Arseneau
                                 asnd@triumfcl.bitnet
                                 arseneau@mtsg.ubc.ca

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

Date: Mon, 22 May 89 22:49:14 EDT
From: INHB000 <INHB%MCGILLC.BITNET@UWAVM.ACS.WASHINGTON.EDU>
Subject: Macro to help display parsing trees
Keywords: macros, parsing trees

Paul Krause wanted some macros to help him display parsing trees.  The
enclosed is not the best possible solution, but it is a start.  It can
be improved in various ways.  The most important is to reduce the number
3000 that \hsep defaults to.  It is that large only so that very short
two word phrases will still have their parse lines; with a smaller value
you come up to a shorter distance than latex can draw a slant line.  The
best thing is to use a smaller value, 1500 looks good, and increase it
if the resultant line is too short.  Then the positioning is not
perfect.  This appears to be the result of the boxes produced by the
\picture environment being too wide by 3.333333pt.  It might be better
if the lines lower in the tree had steeper slope.  This would introduce
all sorts of complications.

Some might object to the syntax.  It was chosen to make the rather ugly
recursive structure as readable as possible and, not coincidentally,
come as close as possible to the alternate notation used in Chomsky's
``Aspects of Syntax''.  In fact, a different definition that reproduces
that alternate notation appears at the end.  I would have preferred the
syntax without the slashes, but I could not figure out how to implement
that.  A couple of caveats.  Since I have changed their \catcode's, [,]
and / cannot be used inside the trees.  Since I have never seen them so
used, this seems safe.  Of course, the brackets can all be replaced by
braces and the opening slashes changed to \tree or something.

The only sane way to use this macro is to define a key in your editor
that produces the string [/;,/] and four backspaces with a single
keystroke and leaves you in insert mode.  This will help enormously in
getting the syntax correct.

Michael Barr

\documentstyle{article}
\textwidth=6.5in \leftmargin=0in
\begin{document}
\unitlength=.001em

\newcount\xa \newcount\xb \newcount\xc
\newcount\ya \newcount\yb \newcount\yc \newcount\ym
\newcount\Xa \newcount\Xb \newcount\Xc
\newcount\Ya \newcount\Yb \newcount\Yc
\newcount\hsep \newcount\vsep
\newcount\tempa \newcount\tempb \newcount\tempc
\newbox\boxa \newbox\boxb \newbox\boxc
\newcount\offset \newcount\offseta \newcount\offsetb \newcount\offsetc
\newcount \hsep \newcount \vsep
\hsep=3000
\newcount \wide \newcount \high
\newcount\correction
\newdimen\tempdimen
\tempdimen=3.3333333pt
\divide\tempdimen by \unitlength
\correction=\tempdimen

\def\chomsky{\bgroup\catcode`\/=\active \catcode`\[=1 \catcode`\]=2}
\def\endchomsky{\egroup}

\chomsky

\gdef/#1;#2,#3/{{%
\setbox\boxa=\hbox{${\rm#1}$}
\offset=0 \setbox\boxb=\hbox{\strut#2}\offsetb=\offset
\offset=0 \setbox\boxc=\hbox{\strut#3}\offsetc=\offset
\xa=\wd\boxa \divide \xa by \unitlength
\ya=\ht\boxa \divide \ya by \unitlength
\xb=\wd\boxb \divide \xb by \unitlength
\yb=\ht\boxb \divide \yb by \unitlength
\xc=\wd\boxc \divide \xc by \unitlength
\yc=\ht\boxc \divide \yc by \unitlength
\ifnum\offsetb=0 \offsetb=\xb \divide \offsetb by 2 \fi
\ifnum\offsetc=0 \offsetc=\xc \divide \offsetc by 2 \fi
\ifnum\xc=0 \onebox \else \twobox \fi}}

\gdef\onebox{{%
\Xa=\offsetb
\vsep=2000
\Ya=\yb \advance \Ya by \vsep
\wide=\xb
\high=\yb \advance \high by \vsep {\divide \ya by 2 \global\advance
     \high by \ya}
\advance\wide by -\correction
\begin{picture}(\wide,\high)
\put(\Xa,\Ya){\makebox(0,0){\usebox{\boxa}}}
\put(0,0){\usebox{\boxb}}
\global\offset=\Xa
\advance \Ya by -\ya \advance \Ya by -100
\advance \vsep by -\ya \advance \vsep by -400
\put(\Xa,\Ya){\line(0,-1){\vsep}}
\end{picture}
}}

\gdef\twobox{{%
\ifnum\yb<\yc \ym=\yc \else \ym=\yb \fi
\Yb=\ym \advance \Yb by -\yb
\Yc=\ym \advance \Yc by -\yc
\Xc=\xb \advance \Xc by \hsep
\vsep=\xb \advance \vsep by -\offsetb \advance \vsep by \offsetc
   \advance \vsep by \hsep \divide \vsep by 2
\Xa=\offsetb \advance \Xa by \vsep \advance\Xa by \correction
\Ya=\ym \advance \Ya by \vsep
\wide=\xb \advance \wide by \xc \advance \wide by \hsep
\advance\wide by -\correction
\high=\Ya {\divide \ya by 2 \global\advance \high by \ya}
\begin{picture}(\wide,\high)(\correction,0)
\put(\Xa,\Ya){\makebox(0,0){\usebox{\boxa}}}
\put(0,\Yb){\usebox{\boxb}}
\put(\Xc,\Yc){\usebox{\boxc}}
\global\offset=\Xa
\advance \Ya by -\ya \advance \Ya by -200
\advance \vsep by -\ya \advance \vsep by -500
{\advance\Xa by -\ya \advance\Xa by -200
\put(\Xa,\Ya){\line(-1,-1){\vsep}}}
\advance\Xa by \ya \advance \Xa by 200
\put(\Xa,\Ya){\line(1,-1){\vsep}}
\end{picture}
}}

\endchomsky

\chomsky

[/S;[/NP;[/Det;The,/],[/N;man,/]/],%
[/VP;[/V_t;bit,/],[/NP;[/Det;a,/],[/N;dog,/]/]/]/]

\endchomsky


\end{document}
\gdef/#1;#2,#3/{\lbrack$_{\rm#1}\,$#2 #3\rbrack$_{\rm#1}\,$}

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

Date: Tue, 23 MAY 89 13:51:08 BST
From: STEPHEN%VAX.OXFORD.AC.UK@UWAVM.ACS.WASHINGTON.EDU
Subject: Article on AMS Euler
Keywords: AMS Euler, fonts

TeXland may be interested in the latest number of 'Scholarly Publishing'
which has an article by DEK and Zapf on AMS Euler --

Knuth, Donald E. & Hermann Zapf (1989).
   AMS Euler -- a new typeface for mathematics,
   Scholarly Publishing, Vol. 20, No. 3, April, pp. 131-57.

stephen miller
oxford

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

%%% Concerning subscriptions, address changes, unsubscribing:
%%%  BITNET: send a one-line mail message to LISTSERV@xxx
%%%          where xxx is the nearest geographical site in the
%%%          tree shown below
%%%         SUBSCRIBE TEX-L <your name>    % to subscribe
%%%      or UNSUBSCRIBE TEX-L
%%% Here is the BITNET re-distribution tree as shown in a recent
%%% REVIEW (The geography is guessed at from the subscription list)
%%%
%%%                        CLVM    TAMVM1      FINHUTC
%%%                           |    |     (Finland, UK, Scand, CERN)
%%%                           |    |           |
%%%  TeXhax ----> UWAVM ----- MARIST ----- EB0UB011 ----- BNANDP11
%%%                           |     (France,Italy,Spain)  (Belgium)
%%%                           |                |
%%%                        UBVM      HEARN --- DEARN
%%%                              (Netherlands) (Germany)
%%%
%%% Internet: send a similar one line mail message to
%%%           TeXhax-request@cs.washington.edu
%%%     Please be sure you send a valid internet address!!
%%%        in the form name@domain or name%routing@domain
%%%     and use the style of the Bitnet one-line message, so that
%%%     we can find your subscription request easily.
%%%
%%% All submissions to: TeXhax@cs.washington.edu
%%%
%%% Back issues available for FTPing as:
%%%          machine:              directory:  filename:
%%%   JUNE.CS.WASHINGTON.EDU         TeXhax/TeXhaxyy.nn
%%%              yy = last two digits of current year
%%%                       nn = issue number
%%%\bye
%%%

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