# [XeTeX] Bidipoem for dialogue poetry

Gareth Hughes garzohugo at gmail.com
Tue Oct 12 01:53:30 CEST 2010

Paul Isambert wrote:
> Ok, the following works on your file, but I don't know how robust it is:
>
> %%%
>
> \newcount\LineNumber \newcount\templinenumber
> \newdimen\linenumberskip \linenumberskip=6em
> \chardef\linestep=2
> \def\poemlinenumber{%
>   \templinenumber=\LineNumber
>   \computelinenumber
>   }
> \def\computelinenumber{%
>   \ifnum\templinenumber>\linestep
>     \expandafter\computelinenumber
>   \else
>     \ifnum\templinenumber=\linestep
>       \leavevmode\rlap{\kern\linenumberskip\the\LineNumber}%
>     \fi
>   \fi
>   }
> \newenvironment{numberedpoem}
>   {\everypar{\everypar{\poemlinenumber}}%
>
> %%%
>
> You poem should now be enclosed in the "numberedpoem" environment.
> You can change \linestep (on line 3) to any value; if it is set /n/,
> every /n/th line number is printed.
> You can change \linenumberskip (on line 2), which sets the distance of
> the line number to the margin.
> This is not thoroughly tested! Sorry for the syntax, it's not LaTeX-like
> packages so your file can work than I need a little revenge :) ).
>
> Best,
> Paul

Thank you, Paul, for showing me how to do this. It looks good and is
quite flexible. I have a couple more questions, if I may.

1) What is the best way of changing the positioning of the numbers so
that they are on the right of the poem, or that they are on the inner or
outer edge in documents that define these things? Is this best done by
altering \linenumberskip?

2) As it stands, a blank line, indicating a stanza break, is counted as
a line of the poem. How can this code be altered so as not to count the
blank lines between stanzas?

Thanks,

Gareth.