[comp.text] Inserting text directly in ditroff output

simpson@trwrb.UUCP (10/28/87)

We have an old version of ditroff that doesn't seem to be able to give a
string directly to the postprocessor (like the \special command of TeX).
Can anyone tell me what is the string ditroff outputs when it sends a
string directly to the postprocessor?  Our troff(5) manual page lists the
following commands

	sn			Change point size
	fn			Change font
	cx			Generate character
	Cxyz			Generate special character
	Hn			Absolute horizontal
	hn			Relative horizontal
	Vn			Vertical horizontal
	vn			Relative vertical
	nnx			Horizontal motion then print character
	nb a			Eol
	w			Appears between words
	pn			Begin a page
	{			Push stack
	}			Pop stack
	txxxxx			Print string using natural width of each char
	#...\n			Comment
	Dl x y			Draw line
	Dc d			Draw circle
	De dx dy		Draw ellipse
	Da x y r		Draw arc
	D~ x y x y...		Draw spline
	x init			Initialize
	x T device		Name of typesetter
	x res n h v		Resolution
	x pause			Pause
	x stop			Stop
	x trailer		Generate trailer
	x font n name		Mount font
	x Height		Set char height
	x Slant			Set slant

That's it!  No other commands for direct commands to the postprocessor.
Help!
-- 
		Scott Simpson
		TRW Space and Defense
		...{decvax,ihnp4,ucbvax}!trwrb!simpson	(UUCP)
		trwrb!simpson@trwind.trw.com		(ARPA)

trevor@linc.cis.upenn.edu (Trevor Darrell) (10/29/87)

Alas, there is a command to pass through literal text in ditroff (DWB 2.0
or greater). Of course it is only marginally documented :-)

\X'foo' 

will casue ditroff to emit

x X foo

if memory serves correctly

moss@ptsfa.UUCP (10/30/87)

Sorry for the net response, e-mail keeps bouncing...

>We have an old version of ditroff that doesn't seem to be able to give a
>string directly to the postprocessor...

Scott,
	Ditroff (all versions that I know of) does not have any special
output command for transparent data, but it does have an escape sequence
that allows passing source lines transparently to ditroff's output.  This
is the transparent line escape "\!".  Anything that follows a \! will be
passed through (without the \!) directly to ditroff's output.  The trick
is to pass through something that is special to the postprocessor, but is
not an ordinary ditroff command such as "c", "x", etc.  For example, say
your preprocessor recognized a "B" (which is not one of the ditroff output
directives (commands)) to output a bitmapped graphic image.  The following
line appearing in the source:

\!B /usr/bitmaps/someimage 300 1200 350...

would pass the line:

B /usr/bitmaps/someimage 300 1200 350...

throught to ditroff's output.  Any letter or character that is not one
used by ditroff could be used.  It is up to the postprocessor to strip
out the line and interpret it.

Also, your version of ditroff may or may not have the ".cf" request
(copy file).  This is the equivilant of a "transparent file" request:

.cf filename

The contents of "filename" are sent unmodified to ditroff's output. This
could be useful for sending multiline output to a postprocessor.  As an
example, suppose a postprocessor recognized the lines:

X-Begin
X-End

as enclosing data that is to be passed directly to the output device.
Then the file "mydata" might contain:

X-Begin
any data here that is meaningful
to the printer including escape sequences
and special characters (metacharacters).
X-End


Enough already.  I think you get the idea.  If you have any questions,
please feel free to call me or send me mail direct.

					Ken Keirnan
-- 
Minicomputer Operations Support Staff	/ !pt05a!kk1	(415) 823-3911
{dual,ihnp4,lll-crg,ames,pyramid}!ptsfa - !pt05a!john	(415) 823-0179
"Tum podex carmen extulit horridulum!" 	\ !pt05a!mal	(916) 972-4821

mao@blipyramid.BLI.COM (Mike Olson) (10/31/87)

In article <3696@ptsfa.UUCP>, Ken Keirnan writes:
> 	Ditroff (all versions that I know of) does not have any special
> output command for transparent data, but it does have an escape sequence
> that allows passing source lines transparently to ditroff's output.  This
> is the transparent line escape "\!".

this works very well, so long as you don't try to use it in a diversion.
for example, using the -me macros:

	.(b
	some text...
	\!PASS THIS THROUGH
	some more text
	.)b

will *not* do what you expect.  in cases like this, escape the backslash
(\\!).
					mike olson
					britton lee, inc.
					...!ucbvax!ucsfcgl!blia!mao

john@basser.oz (John Mackin) (11/03/87)

In article <52@blipyramid.BLI.COM>,
	mao@blipyramid.BLI.COM (Mike Olson) writes:
> In article <3696@ptsfa.UUCP>, Ken Keirnan writes:
> > 	Ditroff [has] an escape sequence that allows passing source lines
> > transparently to ditroff's output.  This is the transparent line escape
> > "\!".
> 
> this works very well, so long as you don't try to use it in a diversion.  
> [...]
> in cases like this, escape the [exclamation mark] (\\!).

Mike's suggestion is correct.  Unfortunately, the number of backslashes
you need to use depends on the number of times the text is going to be
scanned -- something which is by no means obvious in advance, and varies
with different macro packages, keep types, etc.  A general method is to
use the following macro, by Mark Shand (now shand@cad.unsw.oz.AU):

.de !!
.ie '\\n(.z'' \!\\$1
.el \!.!! "\\$1
..

Then just .!! "anything at all".

John Mackin, Basser Department of Computer Science,
	     University of Sydney, Sydney, Australia

john@basser.oz.AU (john%basser.oz.AU@UUNET.UU.NET)
{uunet,hplabs,mcvax,ukc,nttlab}!munnari!basser.oz!john

henry@utzoo.UUCP (Henry Spencer) (11/04/87)

> We have an old version of ditroff that doesn't seem to be able to give a
> string directly to the postprocessor (like the \special command of TeX).
> Can anyone tell me what is the string ditroff outputs when it sends a
> string directly to the postprocessor? ...

The send-it-direct command at the troff input level is "\X'...'" and the
resulting output is "x X ..." (ends with a newline), at least in the
version I've got handy.
-- 
PS/2: Yesterday's hardware today.    |  Henry Spencer @ U of Toronto Zoology
OS/2: Yesterday's software tomorrow. | {allegra,ihnp4,decvax,utai}!utzoo!henry