pub fn end_environment_over_plain_groups(name: &str, end: Token) -> Result<bool>Expand description
\end{X} met while plain \begingroup groups opened inside X stand above X’s own frame — raa.cls:322-349
\institutename: \begin{flushleft}\begingroup … \end{flushleft}\endgroup. That is TeX’s scoping, not an error:
groups are untyped between \begingroup and \endgroup (tex.web §1063-1069), so \end{X}’s \endgroup
(latex.ltx:15384-15393 \end = \endX + \@checkend + \endgroup; \@checkend reads \@currenvir, still X)
closes the innermost one, and the class’s own \endgroup closes the group \begin{X} opened. Here, as there:
- the innermost plain group is popped, its local values undone (
\end’s\endgroup); - X ends: its open paragraph, its mode and its boxing level end here, so its element ends where
\end{X}stands and its ownbeforeAfterGroupwork (an alignment,\@add@centering) acts on its body; - X’s frame stays open as a plain
\begingroupgroup, keeping X’s other local values (its\@currenvir,\\, a value set before the class’s\begingroup) until the\endgroupthat closes it.
Perl ends the mode against the plain group instead and errors (Stomach.pm:544-550 “Attempt to end mode”); with
the error a raw class’s title-page deposit was dropped — title, authors, abstract and keywords (KNOWN_PERL_ERRORS
#1207, OXIDIZED_DESIGN_DIVERGENCES #965). Only that shape acts: every frame above X a plain \begingroup group
(no mode, no box, no environment marker, and no environment recorded but X’s own — not a raw \newenvironment’s
\begin{Y}; an X this branch ended earlier, its group still open, records X), the environment open X itself
(\@checkend), X’s frame the \begin{X} of this very \end{X}, and X neither a math environment nor one whose
begin code opened a box group — where TeX itself errs (\@badend, or the box’s own group). Otherwise false, and
the caller’s end_mode raises today’s Error. Witnesses 1404.3644, 1304.5354, 1508.02561, 1509.00139, 2004.06992,
2110.11117, 2306.16795, 1604.05586, 2003.13998, 2102.01352, 2511.10805 (raa, raa_twocolumn). Guards
perfect_kernel_batch98d::*.