[comp.text] eqn and tbl

bruno@sdcc10.ucsd.edu (Bruce W. Mohler) (02/17/91)

How many times has this question been asked?

This is relative to [di]troff, tbl, and eqn (as part of the DWB).

Does anyone have any examples of incorporating equations (eqn)
into tables (tbl) that they could send me?

I haven't found any examples anywhere (I've checked the DWB
documentation, I've checked the Dougherty and O'Reilly book, 
etc.).  I've tried inline equations (without success).

Any examples or suggestions welcome!

Thanks, in advance.

Bruce

-- 
Bruce W. Mohler
Systems Programmer (aka Staff Analyst)
bruno@sdcc10.ucsd.edu
voice: 619-586-2218

henry@angel.Eng.Sun.COM (Henry McGilton) (02/19/91)

In article <16767@sdcc6.ucsd.edu>, bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes:

    *  Does anyone have any examples of incorporating equations (eqn)
    *  into tables (tbl) that they could send me?

Here is a very short example using both in-line and displayed equations
inside a table.

This subject and much more -- PICtures in tables, tables in PICtures,
equations in PICtures in tables, tables in tables, and tables in
PICtures -- is explored in depth in TYPESETTING TABLES ON THE UNIX
SYSTEM, by Mary McNabb and Henry McGilton.

    .EQ
    delim $$
    .EN
    .TS
    delim ($$) tab (@) ;
    l  l  .
    LINE@$ y = a x + c $
    .sp
    CIRCLE@$ x sup 2 + y sup 2 = r sup 2 $
    .sp
    LINE@T{
    .EQ
    y = a x + c
    .EN
    T}
    .sp
    CIRCLE@T{
    .EQ
    x sup 2 + y sup 2 = r sup 2
    .EN
    T}
    .TE

npn@cbnewsl.att.com (nils-peter.nelson) (02/19/91)

In article <16767@sdcc6.ucsd.edu>, bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes:
> How many times has this question been asked?
> 
> This is relative to [di]troff, tbl, and eqn (as part of the DWB).
> 
> Does anyone have any examples of incorporating equations (eqn)
> into tables (tbl) that they could send me?
> 
> I haven't found any examples anywhere (I've checked the DWB
> documentation, I've checked the Dougherty and O'Reilly book, 
> etc.).  I've tried inline equations (without success).
> 


The DWB 3.1 tbl documentation says:

When eqn and tbl are used together on the same file, tbl
should be used first.

There are all kinds of caveats, and some examples.
But that would be telling. Here's part of an example, though:

.EQ
delim $$
.EN
.TS
doublebox;
cB cB
1 1.
.sp 2p
Name	Definition
.vs +2p
Gamma	$GAMMA (z)~=~int sub 0 sup inf t sup {z-1} e sup -t dt$
etc.
.TE

So, at least it can be done.

rcd@ico.isc.com (Dick Dunn) (02/19/91)

npn@cbnewsl.att.com (nils-peter.nelson) writes in response to an equation-
within-table question:

> The DWB 3.1 tbl documentation says:
...
> When eqn and tbl are used together on the same file, tbl
> should be used first.

To be fair, so does the tbl documentation back at least as far as v7. 
(Sorry; I don't have anything earlier.:-)

> There are all kinds of caveats, and some examples.
> But that would be telling. Here's part of an example, though:

[excerpt of example]

Looks to be approximately the same example as in the 1979 paper by Lesk.

No intent to flame Peter, but since most of us don't have (and can't get:-(
DWB 3.x, a little software archaeology may be helpful.  The equation-
within-table example persists in BSD manuals to this day, although it may
have been dropped from some of the AT&T manuals in the interregnum.
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...But is it art?

npn@cbnewsl.att.com (nils-peter.nelson) (02/20/91)

Dick Dunn says:
>No intent to flame Peter, but since most of us don't have (and can't get:-(
>DWB 3.x, a little software archaeology may be helpful.  The equation-
>within-table example persists in BSD manuals to this day, although it may
>have been dropped from some of the AT&T manuals in the interregnum.

When I preface any of my replies by "In DBW 3.1..." all I intend
to say is "It works in DWB 3.1 and I'm too lazy to see if it
also works in DWB 2.0, groff, SunOS troff, etc." I'll leave it
to others to report whether older versions support a particular
feature. I work in Bell Laboratories, not the Smithsonian, so
I'm more interested in current and future developments than past.

In this particular case, the original poster claimed to have searched
all appropriate documentation with no success, and I took him at his
word. As Dick indicates, *all* tbl documentation, no matter how old,
seems to include the instruction to pipe tbl into eqn.

bruno@sdcc10.ucsd.edu (Bruce W. Mohler) (02/27/91)

In article <16767@sdcc6.ucsd.edu>, bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes:
> 
> Does anyone have any examples of incorporating equations (eqn)
> into tables (tbl) that they could send me?
> 
> Bruce
>

I want to that those who responded to my question above.  I am
obliged to:

	Peter Smith		pds@ms.secs.csun.edu
	Dick Dunn		rcd@ico.isc.com
	Bruce Lilly		blilly!bruce@broadcast.sony.com
	Carsten Olesen		cqo@nro.cs.athabascau.ca
	Dee Irwin		eci@sparky.acc.virginia.edu
	Henry McGilton		henry@eng.sun.com
	Nils-Peter Nelson	npn@cbnewsl.att.com
	Liam R. E. Quin		lee@sq.com

Most of the responses included actual examples.  Some were plugs
for books (which did not detract from the response).  The books
mentioned were:

	_An Introduction to Text Processing_, Peter Smith, MIT, 1990

	_Typesetting Tables on the Unix System_, McNabb & McGilton,
	Trilithon Press

My mentioning the books does not constitute a recommendation of
them.

Since most of the responses were by e-mail, I wanted to briefly 
summarize what I learned:

	*  run eqn *before* tbl

	*  don't forget the delim() commands in the tbl section

	*  don't use '#' as an eqn delimiter

	*  don't use '$' as an eqn delimiter if you're using
	   troff macros with '$'s in them

Here's a brief example:

	.EQ
	delim $$
	.EN

	.TS
	box, center, tab(@), delim($$);
	l l .
	.
	.
	.
	.TE

Note that delim defined for eqn first.  Note also the "delim($$)"
defined for tbl (that was *my* mistake).

Again, thanks for your responses!

Bruce


-- 
Bruce W. Mohler
Systems Programmer (aka Staff Analyst)
bruno@sdcc10.ucsd.edu
voice: 619-586-2218