[Prev][Next][Index][Thread]

# Portable par



Out of the past 4000 retrievals of Latex files from Boole.Stanford.EDU
(abstracts in /pub/ABSTRACTS), I have had hardly any complaints about
incompatibilities with anyone's Latex environment.  (All /pub files on
Boole are archived in both .tex and .dvi form; current retrieval
preference is running 7:1 for Latex over DVI.)  Naturally this requires
sticking to stock standard Latex, which rules out custom fonts like
stmary, and custom .sty files are explicitly inserted in each file to
be exported.

My preferred source of inverted ampersands has therefore been the
75-line sprite definition (anonymous? from McGill?) rather than one of
the metafont versions.  However it has turned out that quite a few
sites do not have sprite.sty, generating several complaints, the only
ones I've gotten in recent memory.  I've been dealing with this by
including sprite.sty itself in the .tex file, the total then coming to
140 lines.

Needing an excuse this weekend not to work on whatever it was I was
supposed to be working on, I had a hack attack which yielded the
following 6-line Tex macro package implementing a \draw command
intended mainly for drawing character-sized objects.  This allows
inverted ampersand (and any other character that might take your fancy)
to be implemented in two lines, with a drawing (hence initialization)
time of around 0.3 seconds on a 10-Mips machine (the sprite version
takes 8 seconds to initialize), plus an additional line defining a
boxed version rendering in < .02 second (the sprite boxed version is
~0.1 second).  Furthermore the boxed version uses some tricky coding to
get the bare minimum of typesetting commands per character, permitting
up to 300 of the fast boxed characters per page, compared with
approximately 20 in the sprite solution.  Usable in Tex, Latex, and
AMSTex.

At present you change drawing size when needed by redefining \scl, as
in \def\scl{.07} or \def\scl{.09}) before invoking \draw (as from
\invamp).  Someday some of these things will be more automatic.  I'd
also hoped to draw dots of size proportional to velocity, to permit
variable-width strokes (what is the smallest possible dot one can
typeset in tex?), along with various other bells, whistles, and viols
da gamba, but fortunately my hack attack expired before I got myself
any deeper into this mire.  Please feel free to hack up these or
worthier improvements yourself, provided you can do so without tripling
the size.

Incidentally I have a couple of other packages of a similar size, one
for Boolean circuits, another for Hasse diagrams, for anyone
interested.  These give a level of positioning accuracy and neatness
that is next to impossible to get with fig, at lower all round overhead
to boot.

Vaughan Pratt

%  \draw package.  Vaughan Pratt  (C) 1993
%
%	*+,-|.|/012	Table of 81 vectors in [-4,4]x[-4,4]
%	3456|7|89:;	Use as parameters to tell \draw how to step along
%	<=>?|@|ABCD	\draw zzzzzzz\end draws a straight line 7 steps
%	EFGH|I|JKLM	   down and to the right
%       ----+-+----
%	NOPQ|R|STUV	R = (0,0), C = (3,2), * = (-4,-4), r = (-4,4)
%       ----+-+----
%	WXYZ|[|\]^_	\draw -./9:CMV_gpowvukjaWNE=45\end
%	abc|d|efgh	   draws a reasonable circle
%	ijkl|m|nopq
%	rstu|v|wxyz
%
\newcount\PLv\newcount\PLw\newcount\PLx\newcount\PLy\newdimen\PLyy\newdimen\PLX
\newbox\PLdot \setbox\PLdot\hbox{\tiny.} \def\scl{.08} % resettable scale
\def\PLot#1{\PLx#1\advance\PLx-42\PLy\PLx\PLv\PLx\divide\PLy9\PLw\PLy\multiply
\PLw9\advance\PLx-\PLw\advance\PLx-4\PLy-\PLy\advance\PLy4\PLX=\the\PLx pt
\advance\PLyy\the\PLy pt\wd\PLdot=\scl\PLX\raise\scl\PLyy\copy\PLdot}
\def\draw#1{\ifx#1\end\let\next=\relax\else\PLot#1\let\next=\draw\fi\next}

%  Girard's inverted ampersand.  Usage: \invamp. Draw time @ 10 Mips: .33 sec
\def\invamp{\hbox{\PLyy=70pt\draw :::;DMV_gqppyyyyyooooxxxnnwvlutkjaWNE=5-./9%
9:::CCCC:::99/..--544=EENWWaajjjkktttttttNNNVVVVVVVV\end \hskip4pt}}
%  \Invamp = Boxed \invamp.  Draw time < .02 sec, but max ~300 chars/page
\newbox\iabox\setbox\iabox\invamp \def\Invamp{\copy\iabox}