End

<..latex ltmiscen..>+
 \let\o:end:=\end
 \def\end#1{\choose:begin
   {<.revised end.>}%
   {\o:end:{#1}}}
 -_-_-

<..revised end..>
 %\IgnoreIndent
   \ifvmode <.ignore par before hline in end.>\fi
 \csname end#1\endcsname
 \@checkend{#1}%
   \aftergroup\recall:afterend
 \expandafter\endgroup\if@endpe\@doendpe\fi
   \ifx \chk:pic\:UnDef
      <.after end of /end.>%
      <.check Everypar at end.>%
      \list:recall
   \else
      \let\chk:pic\:UnDef
   \fi
 \if@ignore\global\@ignorefalse\ignorespaces\fi
 -_-_-

A ‘\def\::temp{...}\HLet\end=\:temp’ is no good in cases like

xxxxxxx 
\begin{equation} 
g(E) = 
\fff{....\meaning\end} 
\end{equation} 
yyyyyyyy 

because the ‘\end’ is within picture which brings the false part in ‘\ifx \EndPicture\:UnDef \n:end:\else \o:end:\fi’.

The \csname before:begin#1\endcsname sends \csname after:end#1\endcsname to the end with \csname after:end\endcsname. Hence, allowing to change or interrupt the delivery by redefining \csname after:end\endcsname on the way.

<..after end of /end..>
 \csname after:end\endcsname
 \expandafter\let\csname after:end\endcsname=\:UnDef
 -_-_-

<..check Everypar at end..>
 \PopStack\envn:list\:tempb
 \ifnum \:tempb=\n:list \else
    \def\:temp{#1}\def\:tempa{thebibliography}\ifx \:temp\:tempa
    \else\:warning{\string\SaveEverypar’s: \:tempb\space at
           \string\begin{#1} and \n:list\space \string\end{#1}}%
 \fi \fi
 -_-_-

The \thebibliography contains a ‘chapter*’ which is a problem here in case of cutoff because we get ‘\SaveEverypar....\HPage...\RecallEverypar....\EndHPage’, where the hypertext also saves and recalls the status. Hence, a partial overlap that would have forced a warning.

The \RecallEverypar must appear first because it sets the counter \n:list, the appropriate \ht:everypar contents, and \ShowIndent or \IgnoreIndent.

The \@doendpe deals with piles of \ends. The ‘\Protect\HtmlPar’ goes to the first paragraph outside the pile.

<..recall after /end..>
 \ifhmode \hfill\break\fi
 \RecallEverypar
 -_-_-

<..latex ltmiscen..>+
 \def\:tempc{\@endpetrue
    \def\par{\@restorepar\ht:everypar{\HtmlPar}\par\@endpefalse}%
    \ht:everypar{{\setbox\z@\lastbox}\IgnoreIndent\HtmlPar
                 \ht:everypar{\HtmlPar}\@endpefalse}}
 \HLet\@doendpe\:tempc
 -_-_-

The \hfill\break is to help prevent losses of space separators.

We might get here leading empty paragrphs after an ‘\end’. Is there a way to remove them without a post processor.

We can’t add grouping of the form ‘\append:defI\begin{\bgroup}.......\pend:defI\end{\egroup}’ for catching enclosed fonts because \begin{...} commands might include parametric subcommands like in ‘\begin{list}{default-label}{definitions}...\end{list}’.

LaTEX changes the meaning of ‘\ht:everypar’ upon reaching ‘\end’. Hence, the ‘\ht:everypar{}\begin{...}...\end{...}’ does not let the effect of ‘\ht:everypar’ through.