I used to typeset verse with memoir package using some heavy \vspace trickery. The verse environment was too hard to control in terms of vertical space due to the immense amount of obscure glue. For instance, whenever I inserted a centered line (header, remark etc.) within a verse, the spacing was almost uncontrollable. The whole document started with \begin{verse}, contained verse with headers and ended with \end{verse}

To avoid hundreds of manual environment invocations, a prior answer was implemented in order to provide an environment detector (\Bverse to begin verse if not inside one already, \Everse to end one). I defined \ACT, \SCENE, \descr and \hero commands so as to check whether we are inside a verse environment, end if yes, typeset the ornate header and then resume the verse environment. However, the provided example fails to terminate the environments and goes on nesting them.

! LaTeX Error: Too deeply nested.
l.61 \herov{Альцест}
  1. Why are my environments being nested?
  2. Isn’t there a better solution to break a long verse with interwoven headers?

Please excuse the redundant working example, I did my best to minimize it in order to obtain the “too deeply nested” error. My example:



\sodef\sohe{}{.19em}{.6em plus.05em}{.5em plus.05em minus.05em}



\newcommand{\SCENE}[1]{\Everse %
\begin{center*}\textsc{ #1}\end{center*}%
\Bverse %
\newcommand{\ACT}[1]{\Everse %
\newpage\begin{center*}\textsc{\textbf{\large #1}}\end{center*}%
\Bverse %
\Everse %
\begin{center*}\small #1\end{center*} %
\Bverse %
\begin{center*} \hero{#1} \end{center*}%



\ACT{Действие первое}

\SCENE{Явление первое}

\descr{\hero{Альцест} и \hero{Филинт}.}

Как шутки эти здесь некстати "--- просто срам!

Ну, шутки в сторону. Чего же нужно вам?

Чтоб люди искренни всегда и честны были \\
И только правду бы, от сердца, говорили.

Когда мы чьим-нибудь приветом польщены, \\
Платить мы тою же монетою должны: \\
Приветом за привет, услугой за услугу, \\
За клятву "--- клятвою, как преданному другу.

UPDATE: Please see the picture of the version I had had before “optimizing” the code. Verse typeset with custom headers in between

closed as unclear what you're asking by Henri Menke, user13907, Kurt, Zarko, Mico Aug 6 '16 at 14:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX.SX! I'm not sure if the output is what you need; but if I redefine \Bverse and \Everse to do nothing and \newenvironment{center*}{\par\centering}{\par}, I get the document compiled. – egreg Feb 19 '14 at 9:47
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Feb 19 '14 at 9:49
  • @egreg Thank you for the request of the desired output, please see the enclosed picture. The idea is: the blunt way to typeset it is to enclose each and every set of lines in its own verse environment, but what I want is to begin a verse environment and terminate it with custom designed centered lines, and start a new verse afterwards, since it is very hard to fine-tune penalties, glue and breaking rules between those different types of centered announcements inside verse environment. – Andreï Kostyrka Feb 19 '14 at 10:16