[comp.text] Need help with hanging title macros

agw@convent.columbia.edu (Art Werschulz) (02/12/88)

-> I recently posted this request to TeXhax, but didn't get a
-> satisfactory solution.  I thought I might have better luck with
-> comp.text.  
->
-> If this is the second time this has appeared in comp.text, pardon
-> me ... it's not clear whether my original positing went through or
-> not.   Thanks.

Hi.

The file "hang.tex" (appended to this article) is supposed to
implement a "hanging title" style.  Basically, the input

   \input hang

   \beginhangtitling

   \sectionbeg

   \sectionbeg{I.}{First \par section}
   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.
   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.
   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.

   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.
   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.
   Twas brillig and the slithy toves, beware the Jabberwock my son.
   And the mome raths uffishly outgrabe.

should produce something like

I.  First     Twas brillig and the slithy toves, beware the Jabberwock
    section   my son.  And the mome raths uffishly outgrabe.  Twas brillig
              and the slithy toves, beware the Jabberwock my son.  And the
	      mome raths uffishly outgrabe.  Twas brillig and the slithy 
	      toves, beware the Jabberwock my son.  And the mome raths
	      uffishly outgrabe.

              Twas brillig and the slithy toves, beware the Jabberwock
              my son.  And the mome raths uffishly outgrabe.  Twas brillig
              and the slithy toves, beware the Jabberwock my son.  And the
	      mome raths uffishly outgrabe.  Twas brillig and the slithy 
	      toves, beware the Jabberwock my son.  And the mome raths
	      uffishly outgrabe.

Well, this works *fairly* well.  The problem is that the first few
letters of the first sentence in the section are outdented:

I.  First   Twas brillig and the slithy toves, beware the Jabberwock my
    section   son.  And the mome raths uffishly outgrabe.  Twas brillig
              and the slithy toves, beware the Jabberwock my son.  And the
	      mome raths uffishly outgrabe.  Twas brillig and the slithy 
	      toves, beware the Jabberwock my son.  And the mome raths
	      uffishly outgrabe.

              Twas brillig and the slithy toves, beware the Jabberwock
              my son.  And the mome raths uffishly outgrabe.  Twas brillig
              and the slithy toves, beware the Jabberwock my son.  And the
	      mome raths uffishly outgrabe.  Twas brillig and the slithy 
	      toves, beware the Jabberwock my son.  And the mome raths
	      uffishly outgrabe.

Any thoughts on this one?  More specifically:

	(*) why doesn't my solution work?

	(*) how to fix (or, what's an alternative solution)?

The file hang.tex is as follows:

------%<--%<--%<---cut here---%<--%<--%<---------------------------------------

%hang.tex

\def\beginhangtitling{
 \begingroup\hsize=5.0truein
 \output={\hangoutput}
 \def\currentsection{}
 \long\def\sectionbeg##1##2{
   \mark{\currentsection \noexpand\else ##1\enskip ##2}
   \bigskip\goodbreak\leavevmode\hskip -2.0truein
   \vtop to 0pt{\leftskip=0pt\hsize=1.50truein 
   \noindent \item{\bf ##1\enskip}{\bf ##2}
   \par} \noindent % \hskip 0.25truein\noindent\hskip-4truept
   \mark{##1\enskip ##2\noexpand\else ##1\enskip ##2}
   \def\currentsection{##1\enskip ##2}}
   \def\strutdepth{\dp\strutbox}
   \def\margin##1{\strut\vadjust{\kern-\strutdepth\specialtext{##1}}}
   \def\specialtext##1{\vtop to \strutdepth{
        \baselineskip\strutdepth
        \vss \llap{\hbox to 1.5truein{\it ##1\hfil}}\null}}
}


\def\endhangtitling{\vfill\eject\endgroup}

\def\hangoutput{
 \shipout\hbox to 6.5truein{
   \hfil
   \vbox{\makeheadline\pagebody\makefootline}}
   \advancepageno
   \gdef\secname{\newsecname}
   \ifnum\outputpenalty>-20000 \else\do\supereject\fi}

%%%%%%%%%%%%%%%%%%%%% end of hang.tex

------%<--%<--%<---cut here---%<--%<--%<---------------------------------------

Thanks.




	Art Werschulz

 	ARPAnet:  agw@columbia.edu
	USEnet:   ... seismo!columbia!agw
	BITnet:   agw@columbia.edu
	CCNET:    agw@garfield
	ATTnet:   Columbia University (212) 280-3610 280-2736
		  Fordham University  (212) 841-5323 841-5396