%%
%% This is file `ledbraonain.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ledmac.dtx  (with options: `braonain')
%% 
%%   Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
%%   Copyright 2003 -- 2005 Peter R. Wilson
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3 of this license or (at your option) any
%%   later version.
%%   The latest version of the license is in
%%      http://www.latex-project.org/lppl.txt
%%   and version 1.3 or later is part of all distributions of
%%   LaTeX version 2003/06/01 or later.
%% 
%%   This work has the LPPL maintenance status "author-maintained".
%% 
%%   This work consists of the files listed in the README file.
%% 
%%% This is ledbraonain.tex, a sample critical verse edition.
%%% Originally written for TeX processing with edmac and edstanza
%%% by Wayne Sullivan.
%%% Extensively modified by Peter Wilson for LaTeX and the ledmac package.

\documentclass{article}
\usepackage{ledmac}

\setlength{\textheight}{40pc}
\setlength{\textwidth}{24pc}
\bigskipamount=12pt plus 6pt minus 6pt
\newcommand*{\notetextfont}{\footnotesize}

%%%               Just one footnote series
\footparagraph{C}
\count\Cfootins=800
\makeatletter
%%                but using two different formats
\def\xparafootfmt#1#2#3{%
  \ledsetnormalparstuff
  {\notenumfont\printlines#1|}\enspace
%%%  {\select@lemmafont#1|#2}\rbracket\enskip
       \notetextfont #3\penalty-10 }
\def\yparafootfmt#1#2#3{%
  \ledsetnormalparstuff
%%%  {\notenumfont\printlines#1|}\enspace
%%%  {\select@lemmafont#1|#2}\rbracket\enskip
       \notetextfont #3\penalty-10 }

\let\Cfootfmt=\xparafootfmt
\skip\Cfootins=\bigskipamount
\makeatother

%% This is the default, but just to demonstrate...
\setlength{\stanzaindentbase}{20pt}

%%                  MUST SET THE INDENTS
%% indent multiples; first=hangindent.
%% Must all be non-negative whole numbers
\setstanzaindents{4,1,2,1,2,3,3,1,2,1}

%%                  Set stanza line penalties
%% Must be nonnegative whole numbers.
%% An initial zero indicates no penalties.
\setstanzapenalties{1,5000,10500,5000,10500,5000,5000,5000,0}

%%                   Put some space between stanzas
\let\endstanzaextra=\bigbreak % ==> \bigskip \penalty -200

%% (almost) force line break in foot paragraph
\mathchardef\IMM=9999
\def\lbreak{\hfil\penalty-\IMM}

%%                   Number each stanza in bold
\newcounter{stanzanum}
\setcounter{stanzanum}{0}
\newcommand*{\numberit}{%
  \flagstanza[0.5\stanzaindentbase]{\textbf{\thestanzanum}}}
%% Use the hook to insert the number (and counteract a new line)
%% and reset the line number to zero
\newcommand*{\startstanzahook}{\refstepcounter{stanzanum}%
  \numberit\vskip-\baselineskip%
  \setlinenum{0}}

%% Want to label the footnotes with the stanza and line number
%% We'll use \linenum to replace the sub-line number
%% with the stanza number, redefining \edtext to do this
%% automatically for us.
%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter

\renewcommand{\edtext}[2]{\leavevmode
  \begingroup
    \no@expands
    \xdef\@tag{#1}%
    \set@line
    \global\insert@count=0
    \ignorespaces \linenum{||\the\c@stanzanum}#2\relax
    \flag@start
  \endgroup
  #1%
  \ifx\end@lemmas\empty \else
    \gl@p\end@lemmas\to\x@lemma
    \x@lemma
    \global\let\x@lemma=\relax
  \fi
  \flag@end}

%% We need only a very simple macro for footnote numbers,
%% to produce the stanza number (sub-line) then the line number.
\def\printstanzalines#1|#2|#3|#4|#5|#6|#7|{\begingroup
  #3\fullstop \linenumrep{#2}
  \endgroup}
\let\oldprintlines\printlines

\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{empty}

\begin{document}

\beginnumbering

\pstart  \centering \textbf{22}  \pend

\bigskip
%% do not print line number beside heading
\setcounter{firstlinenum}{1000}
%% and heading footnotes use a different format
\let\Cfootfmt=\yparafootfmt

\pstart
\centerline{[Se\'an \'O Braon\'ain cct] chuim Tom\'ais U\'{\i}
\edtext{Dh\'unlaing}{\Cfootnote{\textbf{22} \textit{Teideal}: Dhuinnluinng T,
Se\'aghan Mac Domhnaill cct B\lbreak}}}
\pend

\pstart
\centerline{[Fonn: M\'airse\'ail U\'{'i} Sh\'uilleabh\'ain (P\'ainseach
             na nUbh]}
\pend

\bigskip

%%           revert to the regular footnote format
\let\Cfootfmt=\xparafootfmt
%%           but use our special number printing routine
\let\printlines\printstanzalines
%%           Use letters for line numbering
\linenumberstyle{alph}
%%            number lines from the second onwards
\setcounter{firstlinenum}{2}
\setcounter{linenumincrement}{1}

%% Each verse starts with \stanza.
%% Lines end with &; the last line with \&.

\stanza
A \edtext{dhuine}{\Cfootnote{dhuinne T}} gan ch\'eill do
\edtext{mhaisligh}{\Cfootnote{mhaslaidh T, mhaslaig B}} an chl\'eir&
is tharcaisnigh naomhscruipt na bhf\'aige,&
na haitheanta \edtext{r\'eab}{\Cfootnote{raob T}} 's an
  t-aifreann thr\'eig&
\edtext{re}{\Cfootnote{le B}} taithneamh do chlaonchreideamh
  Mh\'artain,&
c\'a rachair \edtext{'od}{\Cfootnote{dod B}} dh\'{\i}on ar
  \'Iosa Nasardha&
nuair \edtext{chaithfimid}{\Cfootnote{chaithfam\'{\i}d T}} cruinn
bheith ar \edtext{mhaoileann}{\Cfootnote{maoilinn B}} Josepha?&
N\'{\i} caraid Mac Crae chuim t'anama '
   \edtext{phl\'e}{\Cfootnote{phleidh T}}&
n\'a Calvin \edtext{bhiais}{\Cfootnote{bh\'{\i}os B}} taobh
\edtext{ris}{\Cfootnote{leis B}} an l\'a sin.\&

\stanza
N\'ach damanta an sc\'eal don chreachaire
  \edtext{chlaon}{\Cfootnote{claon B}}&
ghlac baiste na cl\'eire 'na ph\'aiste&
's do \edtext{glanadh}{\Cfootnote{glannuig T}} mar ghr\'ein
  \'on bpeaca r\'o-dhaor&
tr\'{\i} \edtext{ainibhfios}{\Cfootnote{ainnibhfios T, ainnbhfios B}}
\edtext{\'Eva}{\Cfootnote{\'Eabha B}} rinn \'Adam,&
tuitim ar\'{\i}s f\'e chuing na haicme sin&
tug atharrach br\'{\i} don scr\'{\i}bhinn bheannaithe,&
d'aistrigh b\'easa \edtext{agus}{\Cfootnote{is B}} reachta na cl\'eire&
's n\'ach \edtext{tugann}{\Cfootnote{tuigionn T}} aon
  gh\'eilleadh don Ph\'apa?\&

\stanza
Gach \edtext{scolaire}{\Cfootnote{sgollaire T}} baoth, n\'{\i}
\edtext{mholaim}{\Cfootnote{mholluim T}} a cheird&
\edtext{'t\'a ag obair}{\Cfootnote{'t\'ag ccobar T}}
  \edtext{le}{\Cfootnote{re B}} g\'eilleadh d\'a th\'aille&
don \edtext{doirbhchoin chlaon}{\Cfootnote{dorbhchon daor B}}
  d\'a ngorthar Mac Crae,&
deisceabal \edtext{straeigh}{\Cfootnote{straodhaig T}} as an
  gcoll\'aiste.&
T\'a \edtext{\edtext{adaithe}{\Cfootnote{fadaighthe B}}
th\'{\i}os}{\Cfootnote{fhadoghthe ts\'{\i}os T}} in
  \'{\i}ochtar ifrinn,&
gan \edtext{solas}{\Cfootnote{sollus T}} gan soilse i
  dt\'{\i}orthaibh dorcha,&
tuigsint an l\'einn, gach
  \edtext{cuirpeacht}{\Cfootnote{cuirripeacht T}} d\'ein&
is \edtext{Lucifer}{\Cfootnote{Luicifer T, L\'ucifer B}} aosta
  'na \edtext{mh\'aistir}{\Cfootnote{mhaighistir T}}.\&

\endnumbering

\end{document}

\endinput
%%
%% End of file `ledbraonain.tex'.
