[tex-eplain] Poetry environment

Adam Fenn acwfenn at ntlworld.com
Tue Jan 12 20:06:23 CET 2010


On 7 Sept 2008, at 14:16, Adam Fenn wrote:

>  I've been using \halign to typeset some poetry so that the poem
> is centered on the longest line and can also cross page breaks.
> I would like to use eplain's user-defined environment to bundle this
> into \poem \endpoem environment, but I've had no success so far.
> Any suggestions?


A year and a half later and I eventually solved this myself.

\def\poem{\environment{@poem}%
\begingroup\bigskip
\let\par=\cr \obeylines
\tabskip=0pt   plus 1fil
\halign to\hsize\bgroup%
##\hfil}

\def\endpoem{%
\egroup
\endgroup\bigskip\endenvironment{@poem}%
}


\poem
I wandered lonely as a cloud
That floats on high o'er vales and hills,
When all at once I saw a crowd,
A host, of golden daffodils;
Beside the lake, beneath the trees,
Fluttering and dancing in the breeze.

Continuous as the stars that shine
And twinkle on the milky way,
They stretched in never-ending line
Along the margin of a bay:
Ten thousand saw I at a glance,
Tossing their heads in sprightly dance.
\endpoem

As this is based upon a simple table macro would it be possible to do 
the same for the following
table which typesets a poem in parallel? The idea is to have the 
original on the left and a translation on the right - simple enough for 
a stanza but rather tedious for a long poem.

\tabskip=0pt plus1fil{\halign to\hsize{\tabskip=1em plus1fil
#\hfil&#\hfil\tabskip=0pt plus1fil\cr
I wandered lonely as a cloud&Continuous as the stars that shine\cr
That floats on high o'er vales and hills,&And twinkle on the milky 
way,\cr
When all at once I saw a crowd,&They stretched in never-ending line\cr
A host, of golden daffodils;&Along the margin of a bay:\cr
Beside the lake, beneath the trees,&Ten thousand saw I at a glance,\cr
Fluttering and dancing in the breeze.&Tossing their heads in sprightly 
dance.\cr
}}

TIA
Adam.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2329 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-eplain/attachments/20100112/46ecf11b/attachment.bin>


More information about the tex-eplain mailing list