Subject: Some Spidery WEB fixes

From: Geoffrey D. Alexander <[email-masked]>
Date: Tue, 24 Apr 90 21:50:20 -0400

Norman,

I have fixed some of the Spidery WEB problem is snet you.  First, a fix for the
"code in a module name" problem (this also allows italic text in a module
name).  This fix involves two changes to webkernel.tex:

Initialize \DC:
===== old =====================================================================
\def\CD{\relax\ifmmode\let\DC\egroup\hbox\bgroup\else\let\DC\relax\fi}
===== new =====================================================================
\def\CD{\relax\ifmmode\let\DC\egroup\hbox\bgroup\else\let\DC\relax\fi}
\let\DC\relax
===============================================================================

Move the he code that writes "\catcode`@=11" to the toc file:
===== old =====================================================================
\newwrite\cont
\output{\setbox0=\page % the first page is garbage
  \openout\cont=\contentsfile
  \global\output{\normaloutput\page\lheader\rheader\lfooter\rfooter}}
\setpage
\vbox to \vsize{} % the first \topmark won't be null
% Delete as per bug report from [email-masked]
% Causes headings on first page to be missing
% \eject
\write\cont{\string\catcode`\string\@=11}% a hack to make contents
					 % take stuff in \.{---}
===== new =====================================================================
\newwrite\cont
\output{\setbox0=\page % the first page is garbage
  \openout\cont=\contentsfile
  \write\cont{\string\catcode`\string\@=11} 	% a hack to make contents
						% take stuff in \.{---}
  \global\output{\normaloutput\page\lheader\rheader\lfooter\rfooter}}
\setpage
\vbox to \vsize{} % the first \topmark won't be null
% Delete as per bug report from [email-masked]
% Causes headings on first page to be missing
% \eject
===============================================================================

Next, a fix for the "module name in running head" problem.  This fix makes the
module name in the running head change only a "page eject" module is
encountered.  This fix involves a a single change.  

Move the code that sets \rhead from \N to the \headcheck.
=== old \N ====================================================================
\outer\def\N#1.#2.{\MN#1.\headcheck#2\headcheck
  \edef\rhead{\uppercase{\ignorespaces\themodtitle}} % define running headline
  \message{*\modno} % progress report
  \edef\next{\write\cont{\thetocskip
	\Z{\theopen\relax
		\themodtitle}{\modno}{\the\pageno}}}\next % to contents file
  \ifon\startsection{\bf\ignorespaces\themodtitle.\quad}\ignorespaces}
=== new \N (includes third fix) ===============================================
\outer\def\N#1.#2.{\MN#1.\headcheck#2\headcheck
  \message{*\modno} % progress report
  \edef\next{\write\cont{\thetocskip\Z{\theopen\relax
	\themodtitle}{\modno}{\noexpand\the\pageno}}}\next % to contents file
  \ifon\startsection{\bf\ignorespaces\themodtitle.\quad}\ignorespaces}
===============================================================================

=== old \headcheck ============================================================
\def\headcheck#1#2\headcheck{%
	\makethechar{#1}%
	\def\theskipper{\vfil\penalty-100\vfilneg\vskip12ptminus3pt}%
				% skip before new module
	\def\theopen{}% opening skip in toc entry
	\def\thetocskip{}% vertical skip before toc entry
	\def\themodtitle{{#2}}
	\ifnextchar={%
		\def\theskipper{\vfil\eject}%
		\canceltrue
		\def\theopen{\bf}%
		\def\thetocskip{\vskip3ptplus1in\penalty-100
			\vskip0ptplus-1in}%
	}{\ifnextchar1{%
		\cancelfalse
		\def\theskipper{\vfil\eject}%
		\def\theopen{\hskip2em}%
	}{\ifnextchar2{%
		\cancelfalse
		\def\theopen{\hskip2em}%
	}{\ifnextchar3{%
		\cancelfalse
		\def\theskipper{\vfil\eject}%
		\def\theopen{\hskip4em}%
	}{\ifnextchar4{%
		\cancelfalse
		\def\theopen{\hskip4em}%
	}{% else 
		\ifcancel\else
			\def\theskipper{\vfil\eject}%
		\fi
		\cancelfalse
		\def\themodtitle{#1{#2}}%
	}}}}}%
	\theskipper
}
=== new \headcheck ============================================================
\def\headcheck#1#2\headcheck{%
	\makethechar{#1}%
	\def\theskipper{\vfil\penalty-100\vfilneg\vskip12ptminus3pt}%
				% skip before new module
	\def\theopen{}% opening skip in toc entry
	\def\thetocskip{}% vertical skip before toc entry
	\def\themodtitle{{#2}}
	\ifnextchar={%
      		\def\theskipper{\vfil\eject%
				\edef\rhead{\uppercase{\ignorespaces%
					\themodtitle}}}%
		\canceltrue
		\def\theopen{\bf}%
		\def\thetocskip{\vskip3ptplus1in\penalty-100
			\vskip0ptplus-1in}%
	}{\ifnextchar1{%
		\cancelfalse
      		\def\theskipper{\vfil\eject%
				\edef\rhead{\uppercase{\ignorespaces%
					\themodtitle}}}%
		\def\theopen{\hskip2em}%
	}{\ifnextchar2{%
		\cancelfalse
		\def\theopen{\hskip2em}%
	}{\ifnextchar3{%
		\cancelfalse
      		\def\theskipper{\vfil\eject%
				\edef\rhead{\uppercase{\ignorespaces%
					\themodtitle}}}%
		\def\theopen{\hskip4em}%
	}{\ifnextchar4{%
		\cancelfalse
		\def\theopen{\hskip4em}%
	}{% else 
		\ifcancel\else
	      		\def\theskipper{\vfil\eject%
					\edef\rhead{\uppercase{\ignorespaces%
						\themodtitle}}}%
		\fi
		\cancelfalse
		\def\themodtitle{#1{#2}}%
	}}}}}%
	\theskipper
}
===============================================================================

Last, a fix for the "table of contents page number off by one" problem.  This
invloves a single change to webkernel.tex:

Add \noexpand before \the\pageno in \N.
=== old \N ====================================================================
\outer\def\N#1.#2.{\MN#1.\headcheck#2\headcheck
  \edef\rhead{\uppercase{\ignorespaces\themodtitle}} % define running headline
  \message{*\modno} % progress report
  \edef\next{\write\cont{\thetocskip
	\Z{\theopen\relax
		\themodtitle}{\modno}{\the\pageno}}}\next % to contents file
  \ifon\startsection{\bf\ignorespaces\themodtitle.\quad}\ignorespaces}
=== new \N (includes second fix) ==============================================
\outer\def\N#1.#2.{\MN#1.\headcheck#2\headcheck
  \message{*\modno} % progress report
  \edef\next{\write\cont{\thetocskip\Z{\theopen\relax
	\themodtitle}{\modno}{\noexpand\the\pageno}}}\next % to contents file
  \ifon\startsection{\bf\ignorespaces\themodtitle.\quad}\ignorespaces}
===============================================================================

Note that there are two distinct changes to \N (one for the second fix and one
for the third fix).  Feel free to make the changes to the distributed
webkernel.tex.  If you have any questions or you have problems with any of the
fixes, please let me know.

Geoff Alexander