[tex-eplain] emulating a \description environment

Guy Worthington guyw@multiline.com.au
Thu, 1 Mar 2001 10:58:35 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C0A23E.902E4F40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Finally got a \description environment that gives a satisfactory
output.  It's not pretty code, in particular I'd like to get rid of
the need to adjust two dimensions: \dimen0 in the \Annotation macro,
and \listleftindent in the \Description macro, especially since one
adds what the other removes.  I'd also like to remove the \hang macro
but can't seem to get rid of paragraph indentation any other way.

------------------------------------------------------------
\input eplain
\def\debug{\immediate\write-1}
\hsize=30pc  \vsize=50pc \parindent=3pc
\font\KeywordFont=cmsltt10

\def\Token#1{{\tt#1}}
\def\Key#1{{\KeywordFont#1}}   % Keyword Font

\def\Annotation#1&{%
   \hang
   \dimen0 = \listleftindent \advance\dimen0 by 2\parindent
   \llap{\hbox to \dimen0{#1\hss}}\ignorespaces}

% parameter #1 is a template for the widest annotation
\def\Description#1{\environment{AnnotatedParagraph}%
   % indent left margin by width(template) - 2 parindent + 1em
  \setbox0 = \hbox{#1}
  \advance\listleftindent by \wd0 
  \advance\listleftindent by -2\parindent
  \advance\listleftindent by 1em
  \def\li{\leavevmode\Annotation}% starts a new paragraph
  \beginlist}                                 

\def\endDescription{%
  \par
  \endenvironment{AnnotatedParagraph}
  \endlist}

\Description{\Token{wait(\Key{long} timeout)}}

\li{\bf Method} & {\bf Description}

\vskip1\jot

\li\Token{wait()} & There are three overloaded versions of this method.
This version has no parameters and suspends the current thread until
the \Token{notify()} method for the object to which the \Token{wait()}
belongs, is called.  Note that when \Token{wait()} is called, it
release the synchronization lock on the object, so another method or
code block synchronized on the same object can be called.  This will
allow other threads to call \Token{wait()} for the same object.

\li & \indent Since all version of the \Token{wait()} method can throw 
an \Token{InteruptedException}, you must call it in a try block with a
catch block for this exception, or indicate that the method calling it
throws this exception.

\vskip1\jot

\li\Token{wait(\Key{long} timeout)} & This version suspends the
current thread until the number of milliseconds specified by the
argument has expired, or until the \Token{notify()} method for the
object to which the \Token{wait()} method belongs is called, if that
occurs sooner.

\vskip1\jot

\li\vtop to 0pt{\hbox{\Token{wait(\Key{long} timeout,}}
             \hbox{\Token{\Key{int} nanos)}}\vss} & This version works
in the same way as the previous version, except that the time interval
is specified by two arguments, the first in milliseconds and the
second in nanoseconds.

\vskip1\jot

\li\Token{notify()} & This will restart the thread that has called the
\Token{wait()} method for the object to which the \Token{notify()} method
belongs.  If no threads are waiting, the method does nothing.

\vskip1\jot

\li\Token{notifyAll()} & This will restart all threads that have called
the \Token{wait()} for the objects to which the \Token{notifyAll()} method
belongs.

\endDescription

\bye
------------------------------------------------------------

------=_NextPart_000_0005_01C0A23E.902E4F40
Content-Type: application/octet-stream;
	name="annot6.dvi"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="annot6.dvi"

9wIBg5LAHDsAAAAAA+gbIFRlWCBvdXRwdXQgMjAwMS4wMy4wMToxMDI0iwAAAAEAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////jZ/yAACOoAJYAACNoP2yAACNjY3zFxryIlYA
CgAAAAoAAAAGY21ieDEwwk1ldGhvkFHHZI6OkWh/y0Rlc2NyaXB0aW9ujqkPAACNjY3zHd/qPHgA
CgAAAAoAAAAGY210dDEwyHdhaXQoKY6OkWh/y/MAS/FgeQAKAAAACgAAAAVjbXIxMKtUaGVyZZYD
7jthcmWTdGhyZWWTb5W443aTZXJsb2FkZWSbA+47dpNlcnNpb25zmG9mmHRoaXOYbWV0aG+QRx1k
LpEGPHpUaGlzjqQMAACNkWh/y3aauONlcnNpb26WAtjmaGFzk25vk3BhcmFtZXRlcnOTYW5kk3N1
c3CQRx1lbmRzk3RoZZNjdXJyZW6YdJN0aHJlYWSOoY2RaH/LdW6auON0aWyWBQvgdGhlk8hub3Rp
ZnkoKZOrbWV0aG+QRx1kk2ZvcpN0aGWTb2KRAI44amVjdJN0b5N3aGljmGiTdGhljqGN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