[tex-eplain] emulating a \description environment

Guy Worthington guyw@multiline.com.au
Sat, 24 Feb 2001 17:05:18 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C09E83.F6E76C80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


A couple of days ago I asked whether anyone had a macro, that could
could do paragraph annotations, such that the paragraph is kept in
paragraph mode, but the annotation to the paragraph can have line
breaks where I select them (Donald Knuth describes this in the TeXbook
as poetry mode).  I've yet to improve on a code snippet I lifted from
ex 22.8 of Donald Knuth's "The TeXbook", the code of which is below.

Some people kindly wrote back to me informing me that the code when
compiled looked like a mess; I've looked through the code and I can't
see any dependencies on other files in my texmf tree, but with the
indulgence of everyone, I've attached a .dvi file of the code.

As can be seen from the .dvi file (hopefully) is that the left
justification of the paragraph is unsatisfactory, manually adjusting
paragraph hanging indents makes revision a pain in the arse, and the
overall effect is just amateurish.

Has anyone solved paragraph annotations?

-snip-----------------------------------------------------------
\hsize=30pc  \vsize=50pc \parindent=3pc
\parskip=\smallskipamount

\catcode`\"=\active
\catcode`\|=\active
{\gdef|{\begingroup\it \let|=\endgroup}} % for marking up a variable
{\gdef"{\begingroup\tt  \let"=\endgroup}} % for marking up literals
\def\keyword#1 {{\tt\sl#1 \/}}   % Keyword Font
{
    \parindent0pt \clubpenalty10000 \widowpenalty10000
    \def\exception_list#1&{
        \hangindent10em \hbox to9em{#1\hfill}
        \ignorespaces
    }  
    \everypar={\exception_list}
    \def\\{\leavevmode{\tt }}

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

    \vskip1\jot

    \\|wait|() & There are three overloaded versions of this method.
    This version has no parameters and suspends the current thread
    until the |notify|() method for the object to which the |wait|()
    belongs, is called.  Note that when |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 |wait|() for the same object.

    \\ & Since all version of the |wait|() method can throw an
    |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.

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

    \\|wait|(\keyword{long} |timeout|, & This version works in
    the same way as the previous version,

    \vskip-1\jot

    \\\keyword{int} |nanos|) & except that the time interval is
    specified by two arguments, the first in milliseconds and the
    second in nanoseconds.

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

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

}
-snip-----------------------------------------------------------

------=_NextPart_000_0005_01C09E83.F6E76C80
Content-Type: application/octet-stream;
	name="annot.dvi"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="annot.dvi"

9wIBg5LAHDsAAAAAA+gbIFRlWCBvdXRwdXQgMjAwMS4wMi4yNDoxNzAziwAAAAEAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////jZ/yAACOoAJYAACNoP2yAACNjZEDVVXzFxry
IlYACgAAAAoAAAAGY21ieDEwwk1ldGhvkFHHZI6RYKqzRGVzY3JpcHRpb26OnxIAAI2NkQR71/Mk
/QAnOgAKAAAACgAAAAZjbXRpMTDPd2FpdPMAS/FgeQAKAAAACgAAAAVjbXIxMKsoKY6RYve3VGhl
cmWWBHvXYXJlk3RocmVlk2+VuON2k2VybG9hZGVkmwR713aTZXJzaW9uc5hvZph0aGlzmG1ldGhv
kEcdZC6RB+VNVGhpc46kDAAAjZFkAAp2mrjjZXJzaW9ulgNo32hhc5Nub5NwYXJhbWV0ZXJzk2Fu
ZJNzdXNwkEcdZW5kc5N0aGWTY3VycmVumHSTdGhyZWFkjqGNkWQACnVumrjjdGlslgNRM3RoZZPP
bm90aWZ5qygpk21ldGhvkEcdZJNmb3KTdGhlk29ikQCOOGplY3STdG+Td2hpY5hok3RoZZPPd2Fp
dKsoKY6hjZFkAApikEc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