[comp.unix.questions] troff cs problem stumps local experts

abrams@mitre.arpa (02/05/87)

I am having a problem with troff that has stumped everyone here who I
thought was an expert.  I have some figures and tables sent to me by
several non-Unix users for incorporation in a document.  When the
commitee working on the document comes to agreement, I will convert
these to pic and tbl, but in the meantime I want to include them in
the drafts being produced using troff.

I am using cs to emulate monowidth when printing these figures and
tables.  Sometime is works, sometimes it doesn't! I have constructed a
test file, attached below, to demonstrate the problem.  When I run
this thru troff -ms, the first table comes out OK, then everything breaks
until I reach the figure in section 0.0.1.  I have tried all
combinations of commands to try to trick troff into working.  

Any and all suggestions would be appreciated.  Please respond
directly; I am not on this list.  Thank you.

Sincerely,

 - Marshall D. Abrams, phone: (703) 883-6938
   The MITRE Corporation, 7525 Colshire Drive
   Mail Stop Z670, Mc Lean, VA   22102

.sp 2
.KS 
.nf 
.cs R 24 
 



.ce 1 
B2 TABLE 2 
.sp
  ID |  EVAL. | SND | RCV| MAX | MIN 
 ----+--------+-----+----+-----+---- 
  C  |   B2   | TS  |S,TS| TS  | S 
 ----+--------+-----+----+-----+---- 
.sp 

.fi
.KE 
.sp 
.KS 
.cs R 24 

.nf 

.ce 1 
B2 TABLE 1 blank line added

 ID |  EVAL. | SND | RCV| MAX | MIN 
----+--------+-----+----+-----+---- 
 A  |   B2   | S   | S  | S   | S 
----+--------+-----+----+-----+---- 
 B  |   B2   | C-S | C-S| S   | C 
----+--------+-----+----+-----+---- 
.fi
.cs R
.KE 
.sp 
.KS 
.ss 24
.cs R 24 
.nf 
.ce 1 
B2 TABLE 1  also set ss
.ce 0
.sp
 ID |  EVAL. | SND | RCV| MAX | MIN 
----+--------+-----+----+-----+---- 
 A  |   B2   | S   | S  | S   | S 
----+--------+-----+----+-----+---- 
 B  |   B2   | C-S | C-S| S   | C 
----+--------+-----+----+-----+---- 
.fi
.cs R
.ss
.KE 
.sp 
.KS 
.br
.cs R 24 
.nf 
.ce 1 
B2 TABLE 1  break inserted
.ce 0
.sp
 ID |  EVAL. | SND | RCV| MAX | MIN 
----+--------+-----+----+-----+---- 
 A  |   B2   | S   | S  | S   | S 
----+--------+-----+----+-----+---- 
 B  |   B2   | C-S | C-S| S   | C 
----+--------+-----+----+-----+---- 
.fi
.cs R
.KE 
.sp 
.KS 
.cs R 24 
.nf 
.ce 1 
B2 TABLE 1 
.ce 0
.sp
 ID |  EVAL. | SND | RCV| MAX | MIN 
----+--------+-----+----+-----+---- 
 A  |   B2   | S   | S  | S   | S 
----+--------+-----+----+-----+---- 
 B  |   B2   | C-S | C-S| S   | C 
----+--------+-----+----+-----+---- 
.fi
.cs R
.KE 
.sp 3 
.KS 
.nf
.ce 1
Center before cs
.cs R 24
.sp
  ID |  EVAL. | SND | RCV| MAX | MIN 
 ----+--------+-----+----+-----+---- 
  C  |   B2   | TS  |S,TS| TS  | S 
 ----+--------+-----+----+-----+---- 
.sp 
.fi 
.cs R 
.KE 
.KS 
.nf
.cs R 24

  ID |  EVAL. | SND | RCV| MAX | MIN 
 ----+--------+-----+----+-----+---- 
  C  |   B2   | TS  |S,TS| TS  | S 
 ----+--------+-----+----+-----+---- 

.fi 
.cs R 
.KE 
.IP 4) 
After all the tables have been constructed then the 
Evaluation Class of each table is compared to the Maximum and 
Minimum for the Table with regard to the rules specified by 
the Yellow Book. 
.IP 5) 
If all Tables satisfy the assurance requirements for the 
Yellow Book then the Network passes the assurance 
requirements.  If any of  the Tables provide a greater risk 
range than is permitted by the Yellow Book then the Network 
Fails. 
.NH 3 
Sample network and tables 
.PP 
Here is a copy of a sample network and the tables that are 
produced for it. 
.sp 2
.KS 
.nf 
.cs R 24 
 
      A               B              C 
     ---------       ---------       --------- 
     |A1     |       |C2     |       |C2     | Network Audit 
     |C-TS/ML|       |S-TS/SH|       |       | Collection 
     ----^----       ----^----       ----^---- (Write-Only) 
         |               |               | 
         |               |               | 
         |            D  |               | 
 
         |           ----v----           | 
         o----------->A1     <-----------o 
         o----------->       <-----------o 
         |           ---------           | 
         |        MLS Packet Switch      | 
         |                               | 
      E  |                           F   | 
     ----v----                       ----v---- 
     |B1   | |                       |B2     | 
     |C-S/SH |                       |S-TS/ML| 
     ---------                       --------- 




.ce 1 
B2 TABLE 2 
.sp
  ID |  EVAL. | SND | RCV| MAX | MIN 
 ----+--------+-----+----+-----+---- 
  C  |   B2   | TS  |S,TS| TS  | S 
 ----+--------+-----+----+-----+---- 
.sp 

.fi
.KE 

lapoint@BRL.ARPA (02/05/87)

Haven't had a chance to do more than scan your file at this point, but the
use of -ms with the commands therein rings lots of warning bells. In general,
one is well advised to avoid the native troff commands when using the ms
macros -- they screw each other up.

"Typing Documents on the UNIX System: Using the -ms Macros with Troff and
Nroff" by M. E. Lesk, p 5, lists only 4 commands guaranteed to work with
ms (admittedly, the implication is made that others work).

The MS(7) man page states explicitly that "many" troff requests are unsafe,
and then lists 6 which are known to be safe.

strong@amber.berkeley.edu.UUCP (02/06/87)

The problem was with many
.KS
.cs R 24
...
.KE

.cs "mode must still or again be in effect when the characters are
physically printed." (pg 10, troff manual)
I believe the multiple KS/KE on one page are the problem.
Try using DS/DE.  Also possible to use \!.cs.
Tom Strong	ucbvax!ucbamber!strong

chris@mimsy.UUCP (02/10/87)

In article <2459@jade.BERKELEY.EDU> strong@amber.berkeley.edu (Tom
Strong) writes:
>.cs "mode must still or again be in effect when the characters are
>physically printed." (pg 10, troff manual)
>I believe the multiple KS/KE on one page are the problem.
>Try using DS/DE.  Also possible to use \!.cs.

Alas, as the manual says, that mode `must still or again' be set:
using \!.cs (if I properly understand what it does) is insufficient.
Using .cs *and* \!.cs will work if the keep is evaluated exactly twice.
The more often the keep is reevaluated, the more `.cs's are needed.

Troff stores diversions and strings by scanning the input with the
regular input code, but stashing the result in a buffer somewhere
instead of typesetting it.  All other processing (e.g., number
register expansion) is done immediately.  When the string or
diversion is called forth, input is redirected to the buffer, then
takes place as though nothing special were happening.  All processing
(e.g., number register expansion) is done immediately.  This
repeats *ad nauseam* until the result is finally typeset.

For much text, this little detail is irrelevant: a page number
expands immediately to a string of digits, which then forever
remains a string of digits.  A diversion, though, might have been
made with `\\(ddt)' as input text.  At reevaluation, this reads
`\(ddt)', which is interpreted as `\(dd' (double dagger) followed
by `t)'.  On occasion, this is even what one wants.

I may have some of the particulars wrong, for it has been some time
since last I dealt with troff.  This sort of headache was one reason
I switched to TeX:  Making it reevaluate things is harder, and
tends not to occur by accident.  (And, sometimes, not when it
should, either.  TeX's evaluation rules also are not entirely
straightforward.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris@mimsy.umd.edu