[comp.text] troff query: tilde and ~ in eqn with .tr ~

bobm@agsm.unsw.oz (Robert Marks) (03/08/88)

To get the diacritical tilde in troff's equation preprocessor eqn,
the correct call is !X tilde!, where ! is the eqn delimiter.
This results in something like
	~
	X
Now, the ~ symbol is used in the INPUT of equations as an unpaddable output
space (spaces themselves are internal delimiters), and users soon
become used to typing !X~Y!, say, when they want to keep X and Y
separate in the equation output. (The ^ symbol gives output spaces
half the width of those associated with ~ .)
	For the reason of the association of ~ with spaces in equations,
it seems natural to use .tr ~ to allow ~ to translate to an unpaddable
output space in ordinary, non-eqn text, tables, etc.
But we've found that, with .tr ~, the eqn tilde diacritical construct
!X tilde! doesn't produce the desired result:  the tilde seems to be
translated to a blank.
	Have others found a way around this?  Thanks,

Robert MARKS, Australian Graduate School of Management, University of
              New South Wales, PO Box 1, Kensington, NSW 2033, Australia.

PHONE:  +61 2 662-0271				Fax: +61 2 662-2451
ARPA:   bobm%agsm.unsw.oz@uunet.uu.net		ACSnet: bobm@agsm.unsw.oz
CSNET:  bobm%agsm.unsw.oz.au			JANET: agsm.unsw.oz!bobm@ukc
BITNET: bobm%agsm.unsw.oz%uunet.uu.net@HARVUNXT
BITNET: bobm%agsm.unsw.oz%uunet.uu.net@FORSYTHE
UUCP:   {uunet,hplabs,ukc,mcvax,ubc-vision,nttlab}!munnari!agsm.unsw.oz!bobm

bobm@agsm.unsw.oz (Robert Marks) (03/23/88)

Thanks to Reinhard Foessmeier <foessmeier@infovax.informatik.tu-muenchen.dbp.de>
the problem is solved.
   The problem was how to print ~ as a diacritical in eqn (using the tilde
function) while also using ~ as an unpaddable space in both ordinary text
and in eqn (where it has a special status).
   It is now clear to me that with .tr ~ on, no ~s can be printed.
(I had wondered whether eqn mightn't turn off the .tr somehow.  But
examination of diacrit.c in the eqn sources showed that it doesn't.
BTW, the examination also showed me that utilde is a supported but
undocumented eqn function, which prints understrike tildes: try x utilde.)
   Reinhard suggested a sed filter between eqn and ditroff to take advantage
of the observation that eqn adds tilde diacriticals to equations in a manner
which enables isolation of these while all other remaining ~s in the text
are stream-edited to spaces.  (eqn substitutes spaces for ~s within
equations, so these have already disappeared downstream of eqn.)
   I used the filter
	eqn file | sed '/^\.ds/!s/~/ /g' | ditroff ...
which substitutes a space for all occurrences of ~ except those
in lines beginning .ds  Since I found that eqn was putting its diacritical
tildes in .ds lines:
	.ds 13 \v'-.1m'\s+1~\s0\v'.1m'
  So now the problem is solved.

Bob Marks
Australian Graduate School of Management, University of
New South Wales, PO Box 1, Kensington, NSW 2033, Australia.

Phone:  +61 2 662-0271				Fax: +61 2 662-2451
ARPA:   bobm%agsm.unsw.oz@uunet.uu.net		ACSnet: bobm@agsm.unsw.oz
CSNET:  bobm%agsm.unsw.oz.au			JANET: agsm.unsw.oz!bobm@ukc
UUCP:   {uunet,hplabs,ukc,mcvax,ubc-vision,nttlab}!munnari!agsm.unsw.oz!bobm