summaryrefslogtreecommitdiff
path: root/web/latexspider/weave.ltx
blob: 7b5454fee677685a7651d6014b8bcf35f84b9f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
% This is `weave.ltx' to fix spidery weave for LaTeX.  See
% `web.doc' for some comments about how it works.

% changes copyright D.Love, SERC Daresbury Laboratory
% (d.love@daresbury.ac.uk) under the same conditions as the Spider
% distribution.

%$Header: /home/users0/fx/ltxspiderweb/master/weave.ltx,v 1.4 91/03/22 11:24:35 fx Exp $

 l 11 (remove \batchmode so we can see what's happening)
@x
% Here is TeX material that gets inserted after \input webmac

\message{Entering \string\batchmode...}
\batchmode
@y
% Here is TeX material that gets inserted after \documentstyle[web]...

% we turn off batch mode for debugging purposes

%\message{Entering \string\batchmode...}
%\batchmode
@z

 l 16 (swicth for LaTeX or plain)
@x
\def\hang{\hangindent 3em\indent\ignorespaces}
\font\ninerm=cmr9
\let\mc=\ninerm % medium caps
\def\cee{C}
\def\Pascal{Pascal}
\def\PASCAL{Ada}
\def\pb{$\.|\ldots\.|$} % C brackets (|...|)
\def\v{\.{\char'174}} % vertical (|) in typewriter font
\def\dleft{[\![} \def\dright{]\!]} % double brackets
\mathchardef\RA="3221 % right arrow
\mathchardef\BA="3224 % double arrow
\def\({} % kludge for alphabetizing certain module names

\def\title{Spidery WEAVE}
\def\contentspagenumber{1} % should be odd
\def\topofcontents{\null\vfill
  \titlefalse % include headline on the contents page
  \def\rheader{\hfil}
  \centerline{\titlefont The {\ttitlefont Spidery WEAVE} processor}
  \vfill}
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iftrue
@y
\ifx \enddocument\undefined	% are we using LaTeX? 
  \font\ninerm=cmr9		% no...
  \let\mc=\ninerm % medium caps

\def\title{Spidery WEAVE}
\def\contentspagenumber{1} % should be odd
\def\topofcontents{\null\vfill
  \titlefalse % include headline on the contents page
  \def\rheader{\hfil}
  \centerline{\titlefont The {\ttitlefont Spidery WEAVE} processor}
  \vfill}
  \pageno=\contentspagenumber \advance\pageno by 1
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}%
\else				% yes...
  \documentstyle[web]{article}
  \let\.=\str			% new name
  \title{Spidery WEAVE}  \date{}
\fi

\def\hang{\hangindent 3em\indent\ignorespaces}
\def\cee{C}
\def\Pascal{Pascal}
\def\PASCAL{Ada}
\def\pb{$\.|\ldots\.|$} % C brackets (|...|)
\def\v{\.{\char'174}} % vertical (|) in typewriter font
\def\dleft{[\![} \def\dright{]\!]} % double brackets
\mathchardef\RA="3221 % right arrow
\mathchardef\BA="3224 % double arrow
\def\({} % kludge for alphabetizing certain module names

\let\maybe=\iffalse		% only changed sections -- perhaps you
				% want to change this if you're
				% weaving WEAVE for the first time

@z

 l 39
@x
@* Introduction.
\.{CWEAVE} has a fairly straightforward outline.  It operates in
three phases: first it inputs the source file and stores cross-reference
data, then it inputs the source once again and produces the \TeX\ output
file, and finally it sorts and outputs the index.  It can be compiled
with certain optional flags, |DEBUG| and |STAT|, the latter being used
to keep track of how much of \.{WEAVE}'s resources were actually used.
@y
@* Introduction.
\.{CWEAVE} has a fairly straightforward outline.  It operates in
three phases: first it inputs the source file and stores cross-reference
data, then it inputs the source once again and produces the \TeX\ output
file, and finally it sorts and outputs the index.  It can be compiled
with certain optional flags, |DEBUG| and |STAT|, the latter being used
to keep track of how much of \.{WEAVE}'s resources were actually used.

This version has changes to make it work with \LaTeX{} as the
formatter, rather than plain \TeX\@@.  The sections which are changed
for \LaTeX{} are indicated by |#ifdef LaTeX|, so you can define the
|LaTeX| switch when you compile it.  You could generate a new
\.{weave.web} using \.{wmerge} or \.{tie} which you could use for
either plain or \LaTeX, since the limbo section will check for the
existence of \.{\\enddocument} (which presumably indicates \LaTeX).
@z

 l 361
@x
@d underline = @'176 /* this code will be intercepted without confusion */
@d param = @'177 /* ASCII delete will not appear */
/* identifier =200 or octal @'310 */
@#/* following three must be conseccutive for indexing to work */
@d xref_roman = (identifier+roman) /* control code for `\.{@@\^}' */
@y
@d underline = @'176 /* this code will be intercepted without confusion */
@d param = @'177 /* ASCII delete will not appear */
/* identifier =200 or octal |@'310| */
@#/* following three must be consecutive for indexing to work */
@d xref_roman = (identifier+roman) /* control code for `\.{@@\^}' */
@z

 l 1140
@x
  for (k=p->byte_start; k<k_end; k++) {
    if (*k=='$') {out('\\'); out('D'); out('O'); out(' ');}
    else if (*k=='&') {out('\\'); out('a'); out('m'); out('p');}
	else {
  if (*k=='_' || *k=='%' || *k=='#' || *k=='^' || *k=='{' || *k=='}') 
@y
  for (k=p->byte_start; k<k_end; k++) {
    if (*k=='$') {out('\\'); out('D'); out('O'); out(' ');}
    else if (*k=='&') {out('\\'); out('a'); out('m'); out('p'); out(' ');}
	else {
  if (*k=='_' || *k=='%' || *k=='#' || *k=='^' || *k=='{' || *k=='}') 
@z

 l 1159
@x
No `\.{@@}' signs should occur in such material except in `\.{@@@@}'
pairs; such pairs are replaced by singletons.

@u copy_limbo()
@y
No `\.{@@}' signs should occur in such material except in `\.{@@@@}'
pairs; such pairs are replaced by singletons.
For \LaTeX{} we have to introduce the start of the {\tt document}
environment.@^LaTeX{}@>

@u copy_limbo()
@z  

 l 1172
@x
      if (c!='z' && c!='Z') {
        out(at_sign);
        if (c!=at_sign) err_print("! Double @@ required outside of sections");
@.Double \AT! required...@>
      }
    }
  }
}
@y
      if (c!='z' && c!='Z') {
        out(at_sign);
        if (c!=at_sign) err_print("! Double @@ required outside of sections");
@.Double \AT! required...@>
      }
    }
  }
#ifdef LaTeX
  out_str("\n\\begin{document}\\maketitle\n");
#endif LaTeX
}
@z

 l 1368
@x
\.{\\mathrel\{} and \.{\\mathbin\{}, respectively.
Also |math_op| to \.{\\mathop\{}.
Other control sequences in the \TeX\ output will be `\.{\\\\\{}$\,\ldots\,$\.\}'
surrounding identifiers, `\.{\\\&\{}$\,\ldots\,$\.\}' surrounding
reserved words, `\.{\\.\{}$\,\ldots\,$\.\}' surrounding strings,
@y
\.{\\mathrel\{} and \.{\\mathbin\{}, respectively.
Also |math_op| to \.{\\mathop\{}.
Other control sequences in the plain \TeX\ output will be `\.{\\\\\{}$\,\ldots\,$\.\}'
surrounding identifiers, `\.{\\\&\{}$\,\ldots\,$\.\}' surrounding
reserved words, `\.{\\.\{}$\,\ldots\,$\.\}' surrounding strings,
@z

 l 1374
@x
`\.{\\X$n$:}$\,\ldots\,$\.{\\X}' surrounding module names, where
|n| is the module number.

@d math_bin = @'205  /* should these be octal or decimal? */
@y
`\.{\\X$n$:}$\,\ldots\,$\.{\\X}' surrounding module names, where
|n| is the module number.
@^\LaTeX{}@>
In the \LaTeX\ output we'll have `\.{\\id\{}$\,\ldots\,$\.\}'
surrounding identifiers, `\.{\\res\{}$\,\ldots\,$\.\}' surrounding
reserved words, `\.{\\str\{}$\,\ldots\,$\.\}' surrounding strings,
`\.{\\cee\{}$\,\ldots\,$\.\}$\,$|force|' surrounding comments, and
`\.{\\X$n$:}$\,\ldots\,$\.{\\X}' surrounding module names, where
|n| is the module number.
@.\\id@>@.\\res@>@.\\str@>
  
@d math_bin = @'205  /* should these be octal or decimal? */
@z

 l 1472
@x
\yskip\item{$\bullet$}ASCII codes and special codes like |force| and
|math_rel| represent themselves;

\item{$\bullet$}|id_flag+p| represents \.{\\\\\{{\rm identifier $p$}\}};

\item{$\bullet$}|res_flag+p| represents \.{\\\&\{{\rm identifier $p$}\}};

\item{$\bullet$}|mod_flag+p| represents module name |p|;

\item{$\bullet$}|tok_flag+p| represents token list number |p|;

\item{$\bullet$}|inner_tok_flag+p| represents token list number |p|, to be
translated without line-break controls.
@y
\begin{itemize}
\item ASCII codes and special codes like |force| and
|math_rel| represent themselves;

\item |id_flag+p| represents \.{\\\\\{{\rm identifier $p$}\}} in the
plain \TeX\ version or \.{\\str\{{\rm identifier $p$}\}} in the \LaTeX\
version;

\item |res_flag+p| represents \.{\\\&\{{\rm identifier $p$}\}} in
plain or \.{\\id\{{\rm identifier $p$}\}};

\item |mod_flag+p| represents module name |p|;

\item |tok_flag+p| represents token list number |p|;

\item |inner_tok_flag+p| represents token list number |p|, to be
translated without line-break controls.
\end{itemize}
@z

 l 1501
@x
  else for (j=*p; j<*(p+1); j++) {
    r=*j%id_flag;
    switch (*j/id_flag) {
      case 1: printf("\\{"); print_id((name_dir+r)); printf("}"); break;
 /* |id_flag| */
@y
  else for (j=*p; j<*(p+1); j++) {
    r=*j%id_flag;
#ifdef LaTeX
    switch (*j/id_flag) {
      case 1: printf("\id{"); print_id((name_dir+r)); printf("}"); break;
 /* |id_flag| */
      case 2: printf("\res{"); print_id((name_dir+r)); printf("}"); break;
 /* |res_flag| */
      case 3: printf("<"); print_id((name_dir+r)); printf(">"); break;
        /* |mod_flag| */
      case 4: printf("[[%d]]",r); break; /* |tok_flag| */
      case 5: printf("|[[%d]]|",r); break; /* |inner_tok_flag| */
      default: @<Print token |r| in symbolic form@>;
    }
@.\\id@>@.\\res@>
#else
    switch (*j/id_flag) {
      case 1: printf("\\{"); print_id((name_dir+r)); printf("}"); break;
 /* |id_flag| */
@z

 l 1512
@x
      default: @<Print token |r| in symbolic form@>;
    }
  }
}
@y
      default: @<Print token |r| in symbolic form@>;
    }
#endif LaTeX
  }
}
@z

 l 2075
@x
  
@<Append a string or...@>=
if (next_control==constant) app_str("\\O{");
@.\\O@>
@y
  
@<Append a string or...@>=
#ifdef LaTeX
if (next_control==constant) app_str("\\const{");
@.\\const@>
else if (next_control==string) app_str("\\str{");
@.\\str@>
else app_str("\\vstr{");
@.\\vstr@>
#else
if (next_control==constant) app_str("\\O{");
@.\\O@>
@z

 l 2079
@x
@.\\.@>
else app_str("\\={");
@.\\=@>
while (id_first<id_loc) {
  if (*id_first==at_sign) {
@y
@.\\.@>
else app_str("\\={");
@.\\=@> /* verbatim string */
#endif LaTeX
while (id_first<id_loc) {
  if (*id_first==at_sign) {
@z

 l 2197
@x
breaks are inserted after the result of tokens like |break_space| and
|force|.  (d) The final line break should be suppressed, and there should
be no |force| token output immediately after `\.{\\Y\\P}'.

@ The output process uses a stack to keep track of what is going on at
@y
breaks are inserted after the result of tokens like |break_space| and
|force|.  (d) The final line break should be suppressed, and there should
be no |force| token output immediately after `\.{\\Y\\P}' (or `\.{\\Y\\code}'
with \LaTeX{}).@^\LaTeX@>

@ The output process uses a stack to keep track of what is going on at
@z

 l 2394
@x
looks slightly better if set in a math-italic font instead of a (slightly
narrower) text-italic font. Thus we output `\.{\\\char'174a}' but
`\.{\\\\\{aa\}}'.

@<Output an identifier@>=
out('\\');
if (a==identifier)
  if (length(cur_name)==1) out('|')@;
@.\\|@>
@y
looks slightly better if set in a math-italic font instead of a (slightly
narrower) text-italic font. Thus we output `\.{\\\char'174a}' but
`\.{\\\\\{aa\}}'.  In \LaTeX\ we use `\.{\\ida a}' and `\.{\\id\{aa\}}'.
@^\LaTeX{}@>

@<Output an identifier@>=
#ifdef LaTeX
out('\\');
if (a==identifier)
  if (length(cur_name)==1) out_str("ida ");
@.\\ida@>
  else out_str("id");
@.\\id@>
else out_str("res"); /* |a==res_word| */
@.\\res@>
#else
out('\\');
if (a==identifier)
  if (length(cur_name)==1) out('|')@;
@.\\|@>
@z

 l 2045
@x
else out('&')@; /* |a==res_word| */
@.\\\&@>
if (length(cur_name)==1) out((cur_name->byte_start)[0])@;
else out_name(cur_name);
@y
else out('&')@; /* |a==res_word| */
@.\\\&@>
#endif LaTeX
if (length(cur_name)==1) out((cur_name->byte_start)[0])@;
else out_name(cur_name);
@z

 l 2430
@x
the largest one is used. A line break also occurs in the output file,
except at the very end of the translation. The very first line break
is suppressed (i.e., a line break that follows `\.{\\Y\\P}').

@<Look ahead for st...@>= {
@y
the largest one is used. A line break also occurs in the output file,
except at the very end of the translation. The very first line break
is suppressed (i.e., a line break that follows `\.{\\Y\\code}').
@^\LaTeX{}@>

@<Look ahead for st...@>= {
@z

 l 2442
@x
    if ((a!=' ' && a<indent) || a==backup || a>big_force) {
      if (save_mode==outer) {
 if (out_ptr>out_buf+3 && strncmp(out_ptr-3,"\\Y\\P",4)==0)
   goto reswitch;
        @<Output saved |indent| or |outdent| tokens@>;
@y
    if ((a!=' ' && a<indent) || a==backup || a>big_force) {
      if (save_mode==outer) {
#ifdef LaTeX
 if (out_ptr>out_buf+3 && strncmp(out_ptr-3,"\\Y\\code",4)==0)@^\LaTeX{}@>@.\\code@>
#else
 if (out_ptr>out_buf+3 && strncmp(out_ptr-3,"\\Y\\P",4)==0)
#endif LaTeX
   goto reswitch;
        @<Output saved |indent| or |outdent| tokens@>;
@z

 l 2632
@x
  
@ @<Translate an octal constant appearing in \TeX\ text@>= {
out_str("\\O{\\~");
  while ('0'<=*loc && *loc<'8') out(*loc++);
out('}');
@y
  
@ @<Translate an octal constant appearing in \TeX\ text@>= {
#ifdef LaTeX
out_str("\\code{\\~"); /* this occurrence of \.{\~} is OK for \LaTeX\ since
the control sequence is only defined within the scope of the \.{\\code}
macro */@^\LaTeX{}@>@.\\code@> 
#else
out_str("\\O{\\~");
#endif LaTeX
  while ('0'<=*loc && *loc<'8') out(*loc++);
out('}');
@z

 l 2638
@x
  
@ @<Translate a hex constant appearing in \TeX\ text@>= {
out_str("\\O{\\^");
  while (isxdigit(*loc)) {
	out(islower(*loc) ? toupper(*loc):*loc);
@y

@ @<Translate a hex constant appearing in \TeX\ text@>= {
#ifdef LaTeX
out_str("\\code{\\^"); /* OK for \LaTeX{} as above */
@^\LaTeX{}@>@.\\code@>
#else
out_str("\\O{\\^");
#endif LaTeX
  while (isxdigit(*loc)) {
	out(islower(*loc) ? toupper(*loc):*loc);
@z

 l 2662
@x

@ The |finish_C| procedure outputs the translation of the current
scraps, preceded by the control sequence `\.{\\P}' and followed by the
control sequence `\.{\\par}'. It also restores the token and scrap
memories to their initial empty state.
@y
  
@ The |finish_C| procedure outputs the translation of the current
scraps, preceded by the control sequence `\.{\\P}' (`\.{\\code}' in
\LaTeX{}) and followed by the@^\LaTeX{}@>
control sequence `\.{\\par}'. It also restores the token and scrap
memories to their initial empty state.
@z

 l 2674
@x
{
  text_pointer p; /* translation of the scraps */
  out_str("\\P"); app_tok(force); app_scrap(SP_ignore_scrap,no_math);
  p=translate();
@.\\P@>
@y
{
  text_pointer p; /* translation of the scraps */
#ifdef LaTeX
  out_str("\\code"); app_tok(force); app_scrap(SP_ignore_scrap,no_math);
@.\\code@>@^\LaTeX{}@>
#else
  out_str("\\P"); app_tok(force); app_scrap(SP_ignore_scrap,no_math);
#endif LaTeX
  p=translate();
@.\\P@>
@z

 l 2710
@x
	token following the parameter list@>;
    if (next_control==@`=') {
        small_app('\\'); small_app('S'); /* equivalence sign */
	@<Set |next_control| to the first non-newline token@>@;
    } else {
@y
	token following the parameter list@>;
    if (next_control==@`=') {
#ifdef LaTeX
@^\LaTeX{}@>@.\\equiv@>
        small_app('\\'); app_str("equiv");
#else
        small_app('\\'); small_app('S'); /* equivalence sign */
#endif LaTeX
	@<Set |next_control| to the first non-newline token@>@;
    } else {
@z

 l 2823
@x
  this_module=name_dir; /*so we won't give cross-reference info here*/
}
app_str("\\S"); /* output an equivalence sign */
@.\\S@>
app_str("{}$");
small_app(force); 
@y
  this_module=name_dir; /*so we won't give cross-reference info here*/
}
#ifdef LaTeX
app_str("\\equiv");@^\LaTeX{}@>@.\\equiv@>
#else
app_str("\\S"); /* output an equivalence sign */
@.\\S@>
#endif LaTeX
app_str("{}$");
small_app(force); 
@z

 l 2950
@x
if (no_xref) {
  finish_line();
  out_str("\\vfill\\end");
  finish_line();
}
@y
if (no_xref) {
  finish_line();
#ifdef LaTeX
  out_str("\\end{document}");@^\LaTeX{}@>@.\\end{document}@>
#else
  out_str("\\vfill\\end");
#endif LaTeX
  finish_line();
}
@z

 l 2958
@x
    finish_line(); @<Tell about changed modules@>;
  }
  finish_line(); out_str("\\inx"); finish_line();
@.\\inx@>
  @<Do the first pass of sorting@>;
  @<Sort and output the index@>;
  out_str("\\fin"); finish_line();
@.\\fin@>
  @<Output all the module names@>;
  out_str("\\con"); finish_line();
@.\\con@>
}
@y
    finish_line(); @<Tell about changed modules@>;
  }
#if 0
  finish_line(); out_str("\\begin{theindex}"); finish_line();
#endif
  finish_line(); out_str("\\inx"); finish_line();
@.\\inx@>
  @<Do the first pass of sorting@>;
  @<Sort and output the index@>;
#if 0
  out_str("\\end{theindex}\\fin"); finish_line();
#endif
  out_str("\\fin"); finish_line();
@.\\fin@>
  @<Output all the module names@>;
  out_str("\\con\\end{document}"); finish_line();
@.\\con@>
}
@z

 l 3137
@x
@ @<Output the name...@>=
switch (cur_name->ilk) {
  case normal: if (length(cur_name)==1) out_str("\\|");
    else out_str("\\\\"); break;
@y
@ @<Output the name...@>=
switch (cur_name->ilk) {
#ifdef LaTeX#
  case normal: if (length(cur_name)==1) out_str("\\ida ");
    else out_str("\\id"); break;
@^\LaTeX{}@>@.\\ida@>@.\\id@>
#else
  case normal: if (length(cur_name)==1) out_str("\\|");
    else out_str("\\\\"); break;
@z

 l 3141
@x
@.\\|@>
@.\\\\@>
  case roman: break;
  case wildcard: out_str("\\9"); break;
@.\\9@>
  case typewriter: out_str("\\."); break;
@.\\.@>
@y
@.\\|@>
@.\\\\@>
#endif LaTeX
  case roman: break;
  case wildcard: out_str("\\9"); break;
@.\\9@>
#ifdef LaTeX
  case typewriter: out_str("\\str"); break;
@.\\str@>
  default: out_str("\\res");
@.\\res@>@^\LaTeX{}@>
#else
  case typewriter: out_str("\\."); break;
@.\\.@>
@z

 l 3148
@x
  default: out_str("\\&");
@.\\\&@>
}
out_name(cur_name);
@y
  default: out_str("\\&");
@.\\\&@>
#endif LaTeX
}
out_name(cur_name);
@z

 l 3152
@x
  
@ Section numbers that are to be underlined are enclosed in
`\.{\\[}$\,\ldots\,$\.]'.

@<Output the cross-references...@>=
@y

@ Section numbers that are to be underlined are enclosed in
`\.{\\[}$\,\ldots\,$\.]' or `\.{\\underline}$\,\ldots\,$\.\}' in \LaTeX{}.
@^\LaTeX{}@>

@<Output the cross-references...@>=
@z

 l 3159
@x
  out_str(", "); cur_val=cur_xref->num;
  if (cur_val<def_flag) out_mod(cur_val);
  else {out_str("\\["); out_mod(cur_val%def_flag); out(']');}
@.\\[@>
  cur_xref=cur_xref->xlink;
} while (cur_xref!=xmem);
@y
  out_str(", "); cur_val=cur_xref->num;
  if (cur_val<def_flag) out_mod(cur_val);
#ifdef LaTeX
  else {out_str("\\underline{"); out_mod(cur_val%def_flag); out('}');}
@.\\underline@>@^\LaTeX{}@>
#else
  else {out_str("\\["); out_mod(cur_val%def_flag); out(']');}
@.\\[@>
#endif LaTeX
  cur_xref=cur_xref->xlink;
} while (cur_xref!=xmem);
@z