Article View: comp.text.tex
Article #1950Progress report on numlines.sty for LaTeX
From: James Fortune
Date: Tue, 01 Sep 1992 20:07
Date: Tue, 01 Sep 1992 20:07
72 lines
3512 bytes
3512 bytes
Here is the present state of the work on the numlines.sty.
I am still a neophite at the workings of boxes but I am learning.
I used newcommand and renewcommand to satisfy the LaTeX purists.
I am trying to copy box255 into box1 with line numbers and putting the
result back into box255 and calling \@outputpage so that LaTeX can
put the inserts and everything else in the way it normally does.
Is this even close to the right approach? Here is what I have so far:
----------------------------------------------------------------------------
\font\sevenrm=cmr7
\newcommand\zeroToSp{\parskip=1sp plus1pt
\renewcommand\vfil{\vskip1sp plus1fil}
\renewcommand\vfill{\vskip1sp plus1fill}
\abovedisplayshortskip=1sp plus3pt
\postdisplaypenalty=1
\interlinepenalty=1}
\zeroToSp
\newcount\lineCountInit % used to establish lineCount of first line on page
\global\lineCountInit=0
\newcount\lineCountInterval % used to determine how often lineCount is printed
\global\lineCountInterval=5
\newcount\lineCountStart % don't print lineCount until lineCount reaches this
\global\lineCountStart=1
\newcount\lineCountFinish % don't print lineCount after this
\global\lineCountFinish=400
\newcount\lineCount
\newcommand\resetlineCount{%
\global\lineCount=\lineCountInit}
\resetlineCount
\newcount\pen \newif\ifAnyleft
\newcommand\dupcount{% duplicate box255 with box1 while counting lines
\loop \Anyleftfalse
\ifdim\lastskip=0pt \ifdim\lastkern=0pt \ifnum\lastpenalty=0
\global\setbox0=\lastbox \ifvoid0 % end of breakup loop
\else \Anylefttrue % box present
\appendline
\global\advance\lineCount by 1
\global\setbox1=\vbox{\box0 \unvbox1}\fi
\else \Anylefttrue % penalty present
\pen=\lastpenalty
\global\setbox1=\vbox{\penalty\pen\unvbox1}\unpenalty\fi
\else \Anylefttrue % kern present
\dimen0=\lastkern
\global\setbox1=\vbox{\kern\dimen0 \unvbox1}\unkern \fi
\else \Anylefttrue % skip present
\skip0=\lastskip
\global\setbox1=\vbox{\vskip\skip0 \unvbox1}\unskip \fi
\ifAnyleft \repeat}
\newcommand\appendline{% put rest of lineCount logic in later
\setbox2=\hbox{\vrule height\ht0 depth\dp0 width0pt \sevenrm\the\lineCount}
\global\advance\lineCount-1
\ifodd\count0\global\setbox1=\vbox{\unvbox1 \box2} % oddeven logic
\else\global\setbox1=\vbox{\box2 \unvbox1}\fi}
\newbox\brk
\output={%
\setbox\brk=\vbox{\unvcopy255 \dupcount}
\ifdim\ht\brk>0pt \message{Incomplete breakup} \fi
\setbox255=\vbox to\vsize{\unvbox1}
\@outputpage}
----------------------------------------------------------------------------
--
James Fortune - There are many sides to every question
Oakland University - until you know the truth. Then there's
jafortun@vela.acs.oakland.edu - only one. -- C. S. Lewis
Disclaimer: Not O.U. opinions -
Technical Details
Message-ID:
<1992Sep1.200729.4324@vela.acs.oakland.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!vela!jafortunShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!vela!jafortun From: jafortun@vela.acs.oakland.edu (James Fortune) Newsgroups: comp.text.tex Subject: Progress report on numlines.sty for LaTeX Summary: Wizards where are you? Keywords: pentastich, line numbering, LaTeX Message-ID: <1992Sep1.200729.4324@vela.acs.oakland.edu> Date: 1 Sep 92 20:07:29 GMT Organization: Oakland University, Rochester MI. Lines: 72