[tex-k] trouble with webmac21.tex

Joachim Kuebart joachim.kuebart at gmx.net
Fri Feb 19 23:11:11 CET 2021


On Fri, 19 Feb 2021 at 17:20, Wolfgang Helbig <helbig at mailbox.org> wrote:
>
> Hi Karl,
> > Hi Wolfgang,
> >
> >           weave tex.web tex.ch tex.tex
> >           tex tex.tex
> >      will stop with:
> >           Runaway argument?
> >
> > Doesn't happen for me with TL's tex.ch (and tex.web :)
> > and the new webmac.tex.
> >
> >     ! TeX capacity exceeded, sorry [main memory size=30001].
> >
> > Seems like a small number for TeX memory. My "tex tex" run, with
> > \tracingstats=1, reports:
> >    32556 words of memory out of 5000000
> >
> > So I surmise you need to increase your memory size. --best, karl.

As far as I can see, the increased memory usage by webmac4.2 is caused
by the inclusion of the running header \rhead in \mark as indicated by
this comment:

  %each \mark is {section reference or null}{group title}

At least I get the same problem when I modify the definition for \MN
in webmac4.1 to contain \mark{{\modno}{\rhead}} (which requires also
changing \topmark to \expandafter\takeone\topmark in \lheader and
\rheader, where \def\takeone#1#2{#1}).

It seems that \topmark is only used with \takeone, so I don't
understand why that change was made. I also don't understand what
\topsecno is for, so I deleted it. Here's how I fixed webmac4.2:

diff --git a/lib/webmac.tex b/lib/webmac.tex
--- a/lib/webmac.tex
+++ b/lib/webmac.tex
@@ -81,18 +81,17 @@
 \outer\def\N#1.#2.{\MN#1.\vfil\eject % beginning of starred section
   \def\rhead{\uppercase{\ignorespaces#2}} % define running headline
   \message{*\modno} % progress report
   \edef\next{\write\cont{\Z{#2}{\modno}{\the\pageno}}}\next % to contents file
   \ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces}
 \def\MN#1.{\par % common code for \M, \N
   {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}% remove \* from section name
   \ifx\modno\modstar \onmaybe \else\ontrue \fi
-  \mark{{{\tensy x}\modno}{\rhead}}}
-  % each \mark is {section reference or null}{group title}
+  \mark{{\tensy x}\modno}}
 \def\O#1{\hbox{\rm\char'23\kern-.2em\it#1\/\kern.05em}} % octal constant
 \def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode
   \sfcode`;=3000
   \pretolerance 10000
   \hyphenpenalty 10000 \exhyphenpenalty 10000
   \global\ind=2 \1\ \unskip}
 \def\Q{\rightskip=0pt % get out of Pascal mode
   \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 }
@@ -112,35 +111,32 @@
 \def\=#1{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
         \hbox{\strut\kern2pt\.{#1}\kern2pt}}
       \hrule}\vrule}\kern2pt} % verbatim string
 \let\~=\ignorespaces
 \let\*=*

 \def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue
 \newif\ifon \newif\iftitle \newif\ifpagesaved
-\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead
-  \hfill\title\qquad\mainfont\topsecno} % top line on left-hand pages
-\def\rheader{\mainfont\topsecno\eightrm\qquad\title\hfill
-  \rhead\qquad\mainfont\the\pageno} % top line on right-hand pages
-\def\topsecno{\expandafter\takeone\topmark}
-\def\takeone#1#2{#1}
-\def\taketwo#1#2{#2}
+\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead\hfill\title\qquad
+  \mainfont\topmark} % top line on left-hand pages
+\def\rheader{\mainfont\topmark\eightrm\qquad\title\hfill\rhead
+  \qquad\mainfont\the\pageno} % top line on right-hand pages
 \def\nullsec{\eightrm\kern-2em} % the \kern-2em cancels \qquad in headers
 \def\page{\box255 }
 \def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi
   \shipout\vbox{
     \vbox to\fullpageheight{
       \iftitle\global\titlefalse
       \else\hbox to\pagewidth{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi
       \vfill#1}} % parameter #1 is the page itself
   \global\advance\pageno by1}

 \def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections
-\mark{\noexpand\nullsec{\rhead}}
+\mark{\noexpand\nullsec}
 \def\title{} % an optional title can be set by the user
 \def\topofcontents{\centerline{\titlefont\title}
   \vfill} % this material will start the table of contents page
 \def\botofcontents{\vfill} % this material will end the table of contents page
 \def\contentspagenumber{0} % default page number for table of contents
 \newdimen\pagewidth \pagewidth=6.5in % the width of each page
 \newdimen\pageheight \pageheight=8.7in % the height of each page
 \newdimen\fullpageheight \fullpageheight=9in % page height including headlines
@@ -185,17 +181,16 @@
   \def\[##1]{$\underline{##1}$} % underlined index item
   \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
   \hyphenpenalty 10000 \parindent0pt}
 \def\fin{\par\vfill\eject % this is done when we are ending the index
   \ifpagesaved\null\vfill\eject\fi % output a null index column
   \if L\lr\else\null\vfill\eject\fi % finish the current page
   \parfillskip 0pt plus 1fil
   \def\rhead{NAMES OF THE SECTIONS}
-  \let\topsecno=\nullsec
   \message{Section names:}
   \output{\normaloutput\page\lheader\rheader}
   \setpage
   \def\note##1##2.{\hfil\penalty-1\hfilneg\quad{\eightrm##1~##2.}}
   \linepenalty=10 % try to conserve lines
   \def\U{\note{Used in section}} % crossref for use of a section
   \def\Us{\note{Used in sections}} % crossref for uses of a section
   \def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry}

The only remaining difference to webmac4.1 is that the § sign moves
from \lheader and \rheader to \MN and that \mark is initialised with
\nullsec.

Happy TeXing,

Joachim



More information about the tex-k mailing list.