Begin

The command ‘\begin{xxx}’ referes to the meaning of ‘\xxx’, and the command ‘\end{xxx}’ referes to the meaning of ‘\endxxx’.

<..latex ltmiscen..>+
       \pend:defI\begin{\let\chk:pic=\EndPicture }
       \let\o:begin:=\begin
       \let\choose:begin\@firstoftwo
 \def\begin#1{\csname @begin:#1\endcsname
   \choose:begin
     {\let\choose:begin\@firstoftwo <.revised begin.>}%
     {\o:begin:{#1}}}
 -_-_-

<..latex ltmiscen..>+
 \def\recall:afterend{\ifx \chk:pic\:UnDef
         <.recall after /end.>\fi}
 <.hooks+ for ConfigureEnv.>
 \NewConfigure{@begin}[2]{%
    \expandafter\ifx\csname @begin:#1\endcsname\relax\fi
    \expandafter\concat:config\csname @begin:#1\endcsname{#2}}
 -_-_-

<..revised begin..>
 \ifx \EndPicture\:Undef
    \PushStack\envn:list\n:list  \SaveEverypar
 \fi
 <.before begin(...).>%
 \@ifundefined{#1}%
   {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
   {\def\reserved@a{%
           \def\@currenvir{#1}%
           \edef\@currenvline{\on@line}%
           <.LoopOf before begin(...).>%
           \csname #1\endcsname
           <.after begin(...).>%
   }}%
 \global\@ignorefalse
 \begingroup
   \@endpefalse
   \reserved@a
 -_-_-

The ‘endpe’ stands for ‘end par environment’.

<..before begin(...)..>
 \let\chk:pic=\EndPicture
 \ifx \EndPicture\:UnDef  \list:save
 \let\after:end=\empty   \csname before:begin#1\endcsname   \fi
 -_-_-

<..LoopOf before begin(...)..>
 \ifx \EndPicture\:UnDef
    \ifx \this:listConfigure\empty
        \null:listConfigure  \csname on#1:list\endcsname \fi
 \fi
 -_-_-

The \before:begin ensures that only the outer most \before:begin... will be activated.

<..after begin(...)..>
                  % can’t put anything after \csname #1\endcsname
 \let\before:begin=\:UnDef
 
               %
 -_-_-

The ‘\ifx \EndPicture\:UnDef...\fi’ should be inside \recall:afterend, and not on top of it, because we want the conditions that exited before entering the group. It is expressed indirectly theough ‘\chk:pic’.

A definition \HLet\end\... would not work for cases that pictures are initiated within \begin{...}. For instance, in eqnarray there is an embedded ‘$$’ that can start a picture environment.