[comp.text.tex] TeXhax Digest V90 #39

TeXhax@cs.washington.edu (TeXhax Digest) (04/15/90)

TeXhax Digest    Sunday,  April 8, 1990  Volume 90 : Issue 39

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:         

                       Different versions of epic?
              Consecutive equation numbers in LaTeX report
                       Re: equation number control
                        Re: TeXhax Digest V90 #34
                  Re: TeX control words soak up spaces
              Modifying insertions with the output routine
                              cropmark.sty

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

Date: Thu, 29 Mar 90 10:36:16 METDST
From: Bo Thide <bt@irfu.se>
Subject: Different versions of epic?
Keywords: epic, version

In Mica Beck's (beck@cs.cornell.edu) very useful TransFig, which translates
from fig format to various plot formats suitable for TeX/LaTeX, I have
noticed that epic output may contain the command \texture for shading
areas.  However, the epic I picked up from sun.soe.clarkson.edu
(Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986}
does not support \texture.  Unfortunately, TransFig does not support PiCTeX
shading so it seems I will have to stick to epic.  My questions are:
Are there different versions of epic around?  If so, where can I find a
(presumably newer) version that supports \texture?


   ^   Bo Thide'--------------------------------------------------------------
  | |        Swedish Institute of Space Physics, S-755 91 Uppsala, Sweden
  |I|  [In pre-TeX3.0 Swedish: Institutet f\"or rymdfysik, Uppsalaavdelningen]
  |R|  Phone: (+46) 18-403000.  Telex: 76036 (IRFUPP S).  Fax: (+46) 18-403100 
 /|F|\          INTERNET: bt@irfu.se      UUCP: ...!mcvax!sunic!irfu!bt  
 ~~U~~ ... -- ..... -.. ..-. .-- ---------------------------------------sm5dfw

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

Date:     Thu, 29 Mar 90 03:16 PST
From: <ASND%TRIUMFER.BITNET@UWAVM.ACS.WASHINGTON.EDU>
Subject:  Consecutive equation numbers in LaTeX report
Keywords: LaTeX, equation numbers

In TeXhax #34 Martin Jourdan addressed a problem Andras Kornai had with
numbering equations consecutively across chapters.  He noted that the
equation counter must not be reset by \chapter, but the immediate solution
of redefining all macros that deal with equation numbering is a bit much.

LaTeX keeps a list of counters that are to be reset with section BAR
(BAR = chapter, section, etc.) in the macro \cl@BAR.  Clearly, what
needs to be done is to remove the equation counter from the list
\cl@chapter.  There is a simple macro to add a counter to this list
called \@addtoreset, but there is no macro for removal so I just
wrote one.  It is not as pretty as \@addtoreset, but it is harder
to remove from a list than to add to one.  Here it is:

%  \@removefromreset{FOO}{BAR} : Removes counter FOO from the list of
%                       counters \cl@BAR to be reset when counter bar
%                       is stepped.  The opposite of \@addtoreset.

\def\@removefromreset#1#2{\let\@tempb\@elt
   \def\@tempa#1{@&#1}\expandafter\let\csname @*#1*\endcsname\@tempa
   \def\@elt##1{\expandafter\ifx\csname @*##1*\endcsname\@tempa\else
         \noexpand\@elt{##1}\fi}%
   \expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
   \let\@elt\@tempb
   \expandafter\let\csname @*#1*\endcsname\@undefined}


With this, numbering equations consecutively is set up by:

   \def\theequation{\arabic{equation}}
   \@removefromreset{equation}{chapter}

These lines and the definition of \@removefromreset should be put in
a style file.

                       Donald Arseneau
                       asnd@triumfcl (.bitnet)
                       Arseneau@mtsg.ubc.ca

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

Date: Wed, 28 Mar 90 13:45 GMT
From: John MacDonald Simmie <CHESIMMIE%cs8700.ucg.ie@UWAVM.ACS.WASHINGTON.EDU>
Subject: Re: equation number control
Keywowrds: LaTeX, equation number control

 The easiest way to gain control of equation numbers in LaTeX is
 not to use them! For example, if you want to number chemical equations
 the normal LaTeX convention of chapter.no is not flexible enough and
 neither are the subeqn styles that I have seen. But \eqno() still works
 and moreover can be used AS WELL AS the LaTeX mode so that one can write:

 text text text
 \begin{equation}
 pV = nRT
 \label{gaslaw]
 \end{equation}
 text text text et cetera
 and
 $$\chem CH_4 + 2O_2 \rightarrow CO_2 + 2H_2O \eqno(7) $$
 text text text
 and the converse
 $$\chem CO_2 + 2H2_O \rightarrow CH_4 + 2O_2 \eqno(-7) $$
 or the variant
 $$\chem CH_4 + Cl_2 \rightarrow CH_3Cl + HCl \eqno(8') $$

 Of course, a complete redesign/new design of the appropiate LATEX.TEX
 can also be done ...

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

Date: Wed, 28 Mar 90 08:39:47 PST
From: lamport@src.dec.com (Leslie Lamport)
Subject: Re: TeXhax Digest V90 #34
Keywords: LaTeX, chapter number

Stephen Gildea writes:

   Styles based on the report style insert the chapter number in equation
   numbers.  To get the simpler numbering of the article style, put this
   line, copied from article.sty, in the preamble of your document:
   
   \def\theequation{\arabic{equation}}

Wrong.  Each \chapter command will reset the equation number to 1.

Leslie Lamport

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

Date: Wed, 28 MAR 90 16:04:15 GMT
From: CHAA006%vax.rhbnc.ac.uk@NSFnet-Relay.AC.UK
Subject:  Re: TeX control words soak up spaces
Keywords: TeX, control words

Bard Bloom <bard@cs.cornell.edu>, in a query entitled `Classically-expanding
macros', referred to the perennial problem of TeX control words soaking up a
following space:

>>> I have a number of documents which work fine with macros which supply their
>>> own spaces: 

        \def\If{\keywordfont{if}\ }

>>> Now, for compilers, I find that I want to use keywords in unusual ways
>>> ("scan ahead for the next \If, and ..."), and the macros insert extra
>>> spaces. It would be nice to use the same macros in both places (eg, to make
>>> changing keywords for next year's project easier). 
 
>>> The ordinary ways of making TeX pay attention to spaces after macro calls
>>> will be a major pain in this case, as I would have to put backslashes after
>>> everything I have written which uses these macros.  I'd much rather be able
>>> to modify the macro definition once.  I wanted to see if someone had already
>>> done it before I spent a week fiddling with \expandafter and similar
>>> monstrosities. 

I have experimented with Bard's idea (using \futurelet) in the past, and have 
come to the conclusion that it is not worth the hassle.  Instead, for all TeX
control words that expand to strings (or strings with kerns and raises, etc),
I have ceased using the backslash notation completely, and instead use a meta-
notion notation.

In the simplest case, one simply defines < and > as \csname and \endcsname 
respectively:

        \catcode `\< = \active 
        \catcode `\> = \active 
        \def <{\csname}
        \def >{\endcsname}

One can then write <TeX> or <MetaFont>, with or without trailing punctuation,
and the spacing is invariably correct.  

Of course, this na\"ive approach inhibits the use of less-than and greater-than
in other contexts, particularly within the scope of an \ifnum or \ifdim and 
within maths groups;  a better solution is therefore:

        \def \lt {<}
        \def \gt {>}
        \catcode `\< = \active 
        \catcode `\> = \active 
        \def <{\ifmmode \lt \else \csname \fi}
        \def >{\ifmmode \gt \else \endcsname \fi}

which allows such constructs as

        \ifnum 1 \lt 2 ... \else ... \fi
        $ 1 < 2 $

as well as <TeX>, etc.  Strangely, the simpler and more obvious alternative
of

        \let \lt = <
        \let \gt = >

before the change to the \catcodes is of no use in the \ifnum|\ifdim construct;
\ifnum and \ifdim require explicit <_{12}, =_{12} and >_{12} tokens as their
relational operators.

There remains one major problem: <undefined> expands to \relax, which is fine
if you really meant <undefined> but probably not what you wanted if you typed
<Tex> or <Metafont>; we therefore need to consider enhancing the definition
of <...>, and causing it to issue a warning message if the resulting control 
sequence is the same as \relax:

        \def \lt {<}
        \def \gt {>}
        \catcode `\< = \active 
        \catcode `\> = \active 

        \def <{\ifmmode 
                     \let \next = \lt 
               \else 
                     \let \next = \metanotion
               \fi
               \next
              }

        \def >{\ifmmode 
                     \let \next = \gt
               \else 
                     \message {Warning: I've found a `\gt' symbol outside 
                                of maths mode, which apparently doesn't close
                                a metanotion; are you sure you meant it ?}%
                    \let \next = \gt
               \fi
               \next
              }

        \def \metanotion #1>%
              {\expandafter \ifx \csname #1\endcsname \relax
                                 \message {Warning: \expandafter \string 
                                                \csname #1\endcsname
                                                \space is undefined}%   
                                  #1%
                            \else
                                 \csname #1\endcsname
                            \fi
              }

Example usage:

        <TeX> is a wonderful programming language, 
                whereas 
        <tex> is apparently unknown;
        
        \ifnum 1 \lt 2 $ 1 is < 2 $ \fi 
                whereas 
        \ifdim 2pt \gt 1pt $ 2 pt\ is > 1 pt $ \fi 
        this > shouldn't be here \dots 
	\end


                                        Philip Taylor
                            Royal Holloway and Bedford New College

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

Date: Sat, 31 Mar 90 01:47 PST
From: <ASND%TRIUMFER.BITNET@UWAVM.ACS.WASHINGTON.EDU>
Subject:  Modifying insertions with the output routine
Keywords: TeX, insertions

Larry Denenberg had problems with getting a sensible \skip\topinsert
recently.  I find TeX's insertion mechanism to be nearly impossible to
work with.  Congratulations to Leslie Lamport for ignoring insertions
when designing his floats for LaTeX!

Basically, it is impossible to recycle a page through the page builder
if there are any insertions. While \unvbox-ed material goes to the
head of the list of recent contributions, new \inserts go to the end
of the insertion lists. Holding on to the insertions in their boxes,
setting \dimen\xxxinsert=0pt, and recycling the page doesn't work either
because the waiting insertions insist on joining the page--they have
no legal breakpoints at the top after a split.  How about putting
multiple penalties at the tops of the insertions so they can split
more than once (say \penalty1\hrule height0pt\penalty100)?  Nice try,
but since split topinserts almost always have badness=10000, the split
will always happen at the later but "worse" penalty100 leaving no
breakpoints on the deferred insertion

Don't ever create new insertion classes unless they take up no space
on the page: multiple insertions collide after splitting. Knuth tries
to cover up this failing on p. 117 of the TeXbook saying
"complications can arise when you try to mix [topinserts and
footnotes] in devious ways" i.e, having the bad luck to have both
split.  Devious indeed!

Also the TeXbook is uncharacteristically vague in discussing exactly
what happens with inserts and output, and there are mistakes too!
It says that topinserts begin with \penalty0 when they start with
\penalty100; \supereject wouldn't work if it was \penalty0.  It also
says that the \outputpenalty is zero if the pagebreak did not happen
at a penalty; I find it to be 10000.  (I'm sure my cheque is in the
mail).

Anyway, my way of generating a sensible skip under topinserts is to
add the skip and recalculate the page break directly with \vsplit:

\catcode`\@=11
%
% Don't use \skip\topinsert, use this instead:
\newskip\topinskip \topinskip=20pt plus 10pt minus 10pt
\newbox\@utbox
%
\output={\specialoutput\plainoutput}
%
\def\specialoutput{%
   \ifvoid\topins \else   % only when there is a topinsert...
      \ifdim\ht\topins=\z@ \else  % that isn't empty, and...
         \dimen@\ht\@cclv
         \ifdim\dimen@=\z@ \else  % only if there is text on the page...
            \boxmaxdepth\maxdepth \splittopskip\topskip
            \setbox\@utbox\vbox{\vskip\topinskip\unvbox\@cclv}%
%        ...add \topinskip below topinsert, and recalculate pagebreak.
            \setbox\@cclv\vsplit\@utbox to\dimen@ \unvbox\@utbox
%           TeXbook lies on p.125: says \outputpenalty is zero when
%           page break is not at a penalty, but I find it to be 10000.
            \ifnum\outputpenalty=\@M\else\penalty\outputpenalty
   \fi\fi\fi\fi}

                      Donald Arseneau
                      asnd@triumfcl (.bitnet)
                      Arseneau@mtsg.ubc.ca

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

Date:    Thu, 29 Mar 90 10:46
From: Wujastyk (on GEC 4190 Rim-D at UCL) <UCGADKW%euclid.ucl.ac.uk@NSFnet-Relay.AC.UK>
Subject: cropmark.sty
Keywords: LaTeX, style file

Here is a (resend of) cropmark.sty, a LATEX style for putting those
little tick marks at all four corners that publishers like, to show
the size of paper on which the page will be printed.

Set the page/paper size at the beginning of cropmark.sty as indicated.

Enjoy.


 Dominik Wujastyk,         | Janet:                  wujastyk@uk.ac.ucl.euclid
 Wellcome Institute for    | Bitnet/Earn/Ean/Uucp:   wujastyk@euclid.ucl.ac.uk
  the History of Medicine, | Internet/Arpa/Csnet:        dow@wjh12.harvard.edu
 183 Euston Road,          |    or:     wujastyk%ucl.euclid@nsfnet-relay.ac.uk
 London NW1 2BN, England.  | EVEN NEWER PHONE NO.:      London 383-4252 ext.24

% cropmark.sty, for use with LaTeX 2.09
% ver. 1
% January 11, 1990
% Dominik Wujastyk
% Wellcome Institute for the History of Medicine
% 183 Euston Road
% London NW1 2BP
% England
% JANET: wujastyk@uk.ac.ucl.euclid
% Internet: dow@wjh12.harvard.edu
%
%
%             |                                 |
%             |                                 |
%         ---                                     ---
%                  This is a LaTeX style that
%                prints crop marks (or corner
%                 rules) at the four corners of
%                 the page, to help with
%                 cutting and pasting.
%                 Loosely based on Knuth's
%                 \setcornerrules (TeXbook,
%                 pp.416f.).
%         ---                                     ---
%             |                                 |
%             |                                 |
%
%
%
% Usage: set the two parameters \@@@paperheight and \@@@paperwidth below
%        to the size you wish: these are the distances between the rules.
%
%        Then include this style as a LaTeX style option:
%               \documentstyle[cropmarks]{book (or whatever)}
%
%        That's it.  Enjoy.  Bug reports and improvements, please.
%
%
\newdimen\@@@paperwidth \newdimen\@@@paperhmargin
\newdimen\@@@paperheight \newdimen\@@@papervmargin
%
% Set the desired paper size here:
%
\@@@paperheight=8.5in
\@@@paperwidth=3.89in
%
\def\@@@line{\hbox to \textwidth}
%
% Definition of \topticks and \botticks
%
\def\topticks{\vbox to 0pc{%
  \vskip-36.2pt % = the depth of the following vertical list
  \vskip-\@@@papervmargin
  \@@@line{\llap{\vrule width.2pt height2pc depth0pt\kern\@@@paperhmargin}\hfil
           \rlap{\kern\@@@paperhmargin\vrule width.2pt height2pc depth0pt}}\nointerlineskip
  \kern1pc
  \@@@line{\llap{\vrule width2pc height.2pt depth0pt\kern1pc\kern\@@@paperhmargin}\hfil
           \rlap{\kern\@@@paperhmargin\kern1pc\vrule width2pc height.2pt depth0pt}}%
  \kern\@@@papervmargin}}
\def\botticks{\vbox to 0pt{%
  \vskip\@@@papervmargin
  \@@@line{\llap{\vrule width2pc height.0pt depth.2pt\kern1pc\kern\@@@paperhmargin}\hfil
           \rlap{\kern\@@@paperhmargin\kern1pc\vrule width2pc height0pt depth.2pt}}\nointerlineskip
  \kern1pc
  \@@@line{\llap{\vrule width.2pt height0pt depth2pc\kern\@@@paperhmargin}\hfil
        \rlap{\kern\@@@paperhmargin\vrule width.2pt height0pt depth2pc}}%
  \vskip-\@@@papervmargin
  \vskip-36.2pt}} % = the depth of the preceding vertical list
%
% Modified LaTeX output routine:
%
\def\@outputpage{\begingroup\catcode`\ =10
   % Do the following calculations inside \@ouputpage so that the
   % most current values of the page dimensions are used.
   \advance\@@@paperwidth by -\textwidth
   \divide\@@@paperwidth by 2
   \@@@paperhmargin=\@@@paperwidth
%
   \advance\@@@paperheight by -\headheight
   \advance\@@@paperheight by -\headsep
   \advance\@@@paperheight by -\textheight
   \advance\@@@paperheight by -\footskip
   \divide\@@@paperheight by 2
   \@@@papervmargin=\@@@paperheight
%
    \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
    \if@specialpage
     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
     \if@twoside
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
            \let\@themargin\oddsidemargin
          \else \let\@thehead\@evenhead
          \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
     \fi\fi
     \shipout
     \vbox{\normalsize \baselineskip\z@ \lineskip\z@
           \let\par\@@par %% 15 Sep 87
           \vskip \topmargin \moveright\@themargin
           \vbox{\topticks
                 \setbox\@tempboxa
                   \vbox to\headheight{\vfil \hbox to\textwidth
                                       {\let\label\@gobble \let\index\@gobble
                                         \@thehead}} %% 22 Feb 87
                 \dp\@tempboxa\z@
                 \box\@tempboxa
                 \vskip \headsep
                 \box\@outputbox
                 \baselineskip\footskip
                 \hbox to\textwidth{\let\label\@gobble
                           \let\index\@gobble  %% 22 Feb 87
                           \@thefoot}%
                 \nointerlineskip\botticks}}%
     \global\@colht\textheight
     \endgroup\stepcounter{page}\let\firstmark\botmark}

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

%%% Further information about the TeXhax Digest, the TeX
%%% Users Group, and the latest software versions is available
%%% in every tenth issue of the TeXhax Digest.
%%%
%%% Concerning subscriptions, address changes, unsubscribing:
%%%
%%%  BITNET: send a one-line mail message to LISTSERV@xxx
%%%         SUBSCRIBE TEX-L <your name>    % to subscribe
%%%      or UNSUBSCRIBE TEX-L
%%%
%%% Internet: send a similar one line mail message to
%%%           TeXhax-request@cs.washington.edu
%%% JANET users may choose to use
%%%           texhax-request@uk.ac.nsf
%%% 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
**************************
-------