4

Is it possible to automatically insert a skip (empty line) between the stanzas in reledmac (and reledpar). The former way using \endstanzaextra doesn’t work anymore …

\documentclass{article}

\usepackage{reledmac}
\setstanzaindents{1,0}
\setcounter{stanzaindentsrepetition}{1}

% doesn't word anymore
\def\endstanzaextra{\pstart\strut\skipnumbering\pend}

\begin{document}
\beginnumbering
\stanza First Verse & Second Verse \&
\stanza Third Verse & Fourth Verse \&
\endnumbering
\end{document}
Tobi
  • 56,353

2 Answers2

5

Version 2.10.0 of reledmac, just sent on CTAN, adds a new hook called \AtEveryStopStanza. See this MWE:

\documentclass{article}

\usepackage{reledmac}
\setstanzaindents{1,0}
\setcounter{stanzaindentsrepetition}{1}

\AtEveryStopStanza{\vspace{2\baselineskip}}


\begin{document}
\beginnumbering
\stanza[\textsf{optional before}] First Verse & Second Verse \&[\textsf{optional after}]
\stanza Third Verse & Fourth Verse \&
\stanza Fifth Verse & Sixth Verse \&
\stanza 7th Verse & 8th Verse \&
\endnumbering
\end{document}
egreg
  • 1,121,712
Maïeul
  • 10,984
2

According to the reledmac manual, optional arguments can be provided to either \& for inserting stuff after a verse or to \stanza for inserting stuff before a verse. Thus, either of these could be used for creating a blank line by adding a mere space.

\documentclass{article}

\usepackage{reledmac}
\setstanzaindents{1,0}
\setcounter{stanzaindentsrepetition}{1}

% doesn't word anymore
%\def\endstanzaextra{\pstart x\strut\skipnumbering\pend}

\begin{document}
\beginnumbering
\stanza First Verse & Second Verse \&[*After verse*]
\stanza[/Before verse/] Third Verse & Fourth Verse \&
\stanza[ ]Third Verse & Fourth Verse \&[ ]
\stanza Third Verse & Fourth Verse \&
\endnumbering
\end{document}

enter image description here

Looking at the style file for ways to automate things, a blank line can automatically be added at the beginning of each stanza with the redefinition

\makeatletter
\renewcommandx{\stanza}[1][1,usedefault]{\@startstanza[#1~]}
\makeatother

Likewise, a blank line can be automatically added at the end of each stanza with this redefinition:

\makeatletter
\renewcommandx{\@stopstanza}[1][1,usedefault]{%
  \unskip%
  \endlock%
  \pend[#1$\!\!$]%
  \endgroup%
  \instanzafalse%
}
\makeatother

Both of these redefinitions merely modify the default optional argument of either \stanza or \&.

In use:

\documentclass{article}

\usepackage{reledmac}
\setstanzaindents{1,0}
\setcounter{stanzaindentsrepetition}{1}

\makeatletter
% THE FOLLOWING INSERTS BLANK LINE BEFORE EACH STANZA
%\renewcommandx{\stanza}[1][1,usedefault]{\@startstanza[#1~]}

% THE FOLLOWING INSERTS BLANK LINE AFTER EACH STANZA
\renewcommandx{\@stopstanza}[1][1,usedefault]{%
  \unskip%
  \endlock%
  \pend[#1$\!\!$]%
  \endgroup%
  \instanzafalse%
}
\makeatother

\begin{document}
\beginnumbering
\stanza[\textsf{optional before}] First Verse & Second Verse \&[\textsf{optional after}]
\stanza Third Verse & Fourth Verse \&
\stanza Fifth Verse & Sixth Verse \&
\stanza 7th Verse & 8th Verse \&
\endnumbering
\end{document}

enter image description here

  • Thanks! I had a look at the code but didn’t came up with the idea to change the optional default value … – Tobi Apr 06 '16 at 12:26
  • You should not override the default value. Use \AtEveryPend instead. In general, reledmac/reledpar is conceveided to avoid overriding. – Maïeul Apr 06 '16 at 14:47
  • @Maïeul The use of \AtEveryPend{} seems to perform its action on every verse, not just every stanza. – Steven B. Segletes Apr 06 '16 at 14:51
  • 1
    You are right. I answer too quickly. There is not AtEveryStanza for now, nore AtEveryEndStanza, until I add it (https://github.com/maieul/ledmac/issues/515, but for now I have not a lot of time). Hoewever, as maintener, I still recommand TO NOT override the default value, and just use your own command \newcommand{\mystanza}{\stanza[mycontent]}. – Maïeul Apr 06 '16 at 15:37
  • 1
    Or, if you really want to override it, use \patchcmd. – Maïeul Apr 06 '16 at 15:38
  • @Maïeul I have upvoted your comment for readers to take note. My initial MWE, uses the optional arguments, which is perhaps the safest approach. I did the internal modifications merely to show the OP what might be done, if he was desperate to do it automatically. – Steven B. Segletes Apr 06 '16 at 17:00
  • @StevenB.Segletes: I marked the new answer as “accepted” since this is the (new) official way and should be at the top for later visitors … – Tobi May 09 '16 at 13:48
  • 1
    @Tobi No problem. It is best to go with the wishes of the package developer. – Steven B. Segletes May 09 '16 at 13:50