# Linenumbering per page with XePersian and the traditionalpoem environment

I’m editing an Arabic poem with XePersian and the traditionalpoem environment which works fine so far, but I have some questions regarding the line numbers and the paragraph footnotes.

(1) I would like to have line numbers per page and they should change the side of the margin according to even and uneven pages. Is this somehow possible?

(2) If I add a footnote in a specific line of the page, can I refer to this line by a specific counter? If I have different variant readings, I would like to refer to the line of the page, not to a footnote marker.

(3) Is it possible to reduce the spacing between each footnote in the footnote paragraph?

My minimal example:

\documentclass[12pt,a4paper]{book}

%XePersian and Bidipoem
\usepackage[extrafootnotefeatures, Kashida]{xepersian}
\paragraphfootnotes
\settextfont[Mapping=arabicdigits]{Amiri}
\usepackage{bidipoem}
\setdigitfont{Charis SIL}
\setlatintextfont{Charis SIL}

%Linespacing

%Space between the halfverses
\renewcommand\poemcolsepskip{0.5cm}

%Don’t show footnote markers
\renewcommand*{\thefootnote}{}

%Decrease space between footnotes in the paragraph
\usepackage[para]{footmisc}
\makeatletter
\let\splitfootnoterule=\pagefootnoterule
\makeatother

%Linenumbering
\newcount\LineNumber \newcount\templinenumber
\newdimen\linenumberskip \linenumberskip=-1em
\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}}%

\begin{document}

\setRTLparagraphfootnotes

\begin{numberedpoem}

%%%%%%Verse 1%%%%%%%%%%
قِفَا نَبْكِ مِنْ ذِكْرَى حَبِيبٍ ومَنْزِلِ
&
بِسِقْطِ اللِّوَى بَيْنَ الدَّخُولِ فَحَوْمَلِ
\footnote{
(1)
ذِكْرَى ج : ذكري ب
|| الدخول ج : الذخولي ب.
}
\\
%%%%%%Verse 2%%%%%%%%%%
فَتُوْضِحَ فَالمِقْراةِ لَمْ يَعْفُ رَسْمُها
&
لِمَا نَسَجَتْهَا مِنْ جَنُوبٍ وشَمْألِ
\footnote{
(2)
جَنُوبٍ  ج : حنوب ب
}
\\

\end{numberedpoem}
\end{document}

-

(1)+(2): This can be done with the eledmac package; no need to reinvent the wheel here. It has clear documentation, so I see no need to rewrite the relevant paragraphs from it; the original documentation will in any case always be more comprehensive.

(3): You can redefine the \footnote command for that purpose thus:

\let\OLDfootnote\footnote
\renewcommand{\footnote}[1]{\OLDfootnote{\setstretch{0}#1}


\setstretch is provided by the setspace package.

Good luck ☺!

-
A small example for (1) and (2) would improve your answer. – egreg Feb 7 '14 at 10:29