Skip to main content

abandon_stack_frame

Function abandon_stack_frame 

Source
pub fn abandon_stack_frame() -> Result<()>
Expand description

Abandons the current group, tex.web §1335 final_cleanup style: the stack frame (and its boxing entry, unless the group is non-boxing) is popped and its \aftergroup list is discarded, never run. Used where open groups are unwound wholesale — \end{document} (\lx@finalize@document, Perl latex_constructs.pool.ltxml:353-386) and a bounded body’s terminal met inside a group (until_terminal_inside_group).

Every body digesting inside an abandoned group then ends the way Perl’s does: Perl pops only the undo frame ($STATE->popFrame, latex_constructs.pool.ltxml:373) and flushes the gullet (:386), so each enclosing digestUntil reads END OF INPUT (Stomach.pm:111) and pushes a dummy trailer (Stomach.pm:130) — every body keeps its boxes. Here the boxing entry goes too (an unbalanced \abstract{… otherwise leaves a bounded primitive closing the document frame, screenplay-pkg.tex:67), so the bodies stop on the depth check instead; digest_next_body counts that exit as running out, not as a close whose last box is the closer. Without it the trailer split took each enclosing body’s LAST REAL BOX: two nested environments open at \end{document} lost the inner one whole (\begin{quote}Q1. \begin{quote}Q2. After.), and a list or math left open by an upstream defect lost the rest of the document. Witnesses: the powerdotDE manual (recall 26% → 98%), arXiv 1902.00853 (27,484 words), 2110.01778.

The frame’s beforeAfterGroup hooks still run, and what they queue on \aftergroup is discarded with the rest (setspace’s \lx@setspace@rearm). This is a LaTeXML recovery modelled on §1335 (groups left open, \aftergroup never run); TeX itself recovers a closer met inside a group by off_save, whose inserted closer runs unsave and so does run \aftergroup. Guard: perfect_kernel_batch64zf::abandoned_group_discards_hook_queued_aftergroup.