[comp.text.tex] TeX and poetry: \obeylines and \smallskip

xiaofei@acsu.buffalo.edu (Xiaofei Wang) (12/13/90)

Hi, TeXperts,

I have a problem: the \obeylines is very nice that it saves the
trouble of typing \par all the time but at the same time it prevents
spacing between stanzas of a poem so that one has to type \smallskip
all the time. The question is how to use the first feature and at the
same time avoid the second disadvantage? [I don't mind to type a few
\smallskip's but when I come across a long poem it is really inconvenient.]

I am far behind in this group. Please send me mail also if you post.

Here is an example.

\magnification=\magstep1
\font\cs=cmr10 \cs

        HYMN TO THE NIGHT [By Longfellow]

\medskip

{\obeylines
I heard the trailing garments of the Night
     Sweep through her marble halls!
I saw her sable skirts all fringed with light
     From the celestial walls!

\smallskip

I felt her presence, by its spell of might,
    Stoop o'er me from above;
The calm, majecstic presence of the Night,
    As of the one I love.
 
\smallskip

I heard the sounds of sorrow and delight,
    The manifold, soft chimes,
That fill the haunted chambers of the Night,
    Like some old poet's rhymes.

\smallskip

From the cool cisterns of the midnight air,
    My spirit drank repose;
The fountain of pepetual peace flows there, --
    From those deep cisterns folws.

\smallskip

O holy Night! from thee I learn to bear
    What man has borne before!
Thou layest thy finger on the lips of Care, 
    Any they complain no more.

\smallskip

Peace! Peace! Oresters-like I breathe this prayer!
     Descend with broad-winged flight,
The welcome, the thrice-prayed for, the most fair,
     The best-beloved Night! 
}

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (12/13/90)

xiaofei@acsu.buffalo.edu (Xiaofei Wang) writes:

>I have a problem: 
[ explanation deleted: it boils down to a sort of \parskip
 inside \obeylines ]

>{\obeylines
>I heard the trailing garments of the Night
>     Sweep through her marble halls!
>I saw her sable skirts all fringed with light
>     From the celestial walls!

>\smallskip

>I felt her presence, by its spell of might,
>    Stoop o'er me from above;
>The calm, majecstic presence of the Night,
>    As of the one I love.
> 
>\smallskip
[etc]

Try something along these lines:

{\catcode`\^^M\active \endlinechar=-1 %
\gdef\poemobeylines{\catcode`\^^M\active
    \def^^M{\endgraf\futurelet\next\maybeskip}
    \def\maybeskip{\ifx\next^^M \bigskip \fi}}
}

and use \poemobeylines instead of \obeylines.

Victor.

dorai@tone.rice.edu (Dorai Sitaram) (12/13/90)

In article <50833@eerie.acsu.Buffalo.EDU> xiaofei@acsu.buffalo.edu (Xiaofei Wang) writes:
>I have a problem: the \obeylines is very nice that it saves the
>trouble of typing \par all the time but at the same time it prevents
>spacing between stanzas of a poem so that one has to type \smallskip
>all the time. The question is how to use the first feature and at the
>same time avoid the second disadvantage? [I don't mind to type a few
>\smallskip's but when I come across a long poem it is really inconvenient.]

All one needs to do is modify plainTeX's definition of \obeylines to
also recognize blank lines.  Redefine \obeylines (or call it something
else) as follows:

\def\makeactive#1{\catcode`#113\relax}

\def\adjustedpar{\par\mbox{}}
\newdimen\adjustedparindent
\adjustedparindent=0em
\newskip\adjustedparskip
\adjustedparskip=0pt plus 1pt

{\makeactive\^^M
  \gdef\obeylines{%
    \parindent=\adjustedparindent%
    \parskip=\adjustedparskip%
    \makeactive\^^M%
    \let^^M=\adjustedpar%
    \leavevmode\hbox{}}}

It causes all carriage-returns -- even the ones after blank lines -- in
the body of an \obeylines to appear as newlines.  Thus, you can omit
all the \smallskip's in your example:

>{\obeylines
>I heard the trailing garments of the Night
>     Sweep through her marble halls!
>I saw her sable skirts all fringed with light
>     From the celestial walls!
>
>\smallskip	
 ^^^^^^^^^^<--- omit
>
>I felt her presence, by its spell of might,
>    Stoop o'er me from above;
>The calm, majecstic presence of the Night,
>    As of the one I love.
>[...]
>} 

--d