Skip to content

Commit

Permalink
integrating \@outputpage code
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Feb 14, 2025
1 parent 7b23b88 commit 9baaf3d
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 148 deletions.
119 changes: 85 additions & 34 deletions base/ltoutput.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,16 @@
%<latexrelease>\IncludeInRelease{2025/06/01}%
%<latexrelease> {\@outputpage}{Use new mark mechanism}%
%<*2ekernel|latexrelease>
\def\@outputpage{%
% \end{macrocode}
%
% \begin{macrocode}
\ExplSyntaxOn
\def \@outputpage {
% \end{macrocode}
% We start with a hook available to packages that want to prepend
% code to \cs{@outputpage}.
% \begin{macrocode}
\UseHook {build/page/before}%
% \end{macrocode}
% The |\endgroup| is put in by |\aftergroup|.
% \begin{macrocode}
Expand Down Expand Up @@ -2884,6 +2893,15 @@
\@parboxrestore
% \end{macrocode}
% \ldots\ to here was in the command |\@writesetup|.
%
% Hook to allow adding resets local to the output routine processing, e.g.,
% in \cs{write} or running headers/footers, for packages that set
% up special conventions in the main galley that should not leak
% into the page production just because a page break happens in the
% middle of such an environment.
% \begin{macrocode}
\UseHook {build/page/reset}
% \end{macrocode}
% \begin{macrocode}
\shipout \vbox{%
% \end{macrocode}
Expand All @@ -2906,13 +2924,18 @@
% From here \ldots\ was in the command |\@shipoutsetup|.
% \begin{macrocode}
\if@specialpage
\global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
\global \@specialpagefalse
\@nameuse {ps@\@specialstyle}
\fi
\if@twoside
\ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
\let\@themargin\oddsidemargin
\else \let\@thehead\@evenhead
\let\@thefoot\@evenfoot \let\@themargin\evensidemargin
\ifodd\count\z@
\let \@thehead \@oddhead
\let \@thefoot \@oddfoot
\let \@themargin \oddsidemargin
\else
\let \@thehead \@evenhead
\let \@thefoot \@evenfoot
\let \@themargin \evensidemargin
\fi
\fi
% \end{macrocode}
Expand Down Expand Up @@ -2947,51 +2970,78 @@
% {Make \cs{label}, \cs{index} and \cs{glossary} truely invisible
% when typesetting (gh/1638)}
% \begin{macrocode}
\let\label\@gobble@with@sphack@om
\let\index\@gobble@with@sphack@som
\let\glossary\@gobble@with@sphack@om
\let \label \@gobble@with@sphack@om
\let \index \@gobble@with@sphack@som
\let \glossary \@gobble@with@sphack@om
% \end{macrocode}
%
% \begin{macrocode}
\baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
\baselineskip \z@skip
\lineskip \z@skip
\lineskiplimit \z@
% \end{macrocode}
% \ldots\ to here was in the command |\@shipoutsetup|.
% \begin{macrocode}
\@begindvi
\vskip \topmargin
\moveright\@themargin \vbox {%
\setbox\@tempboxa \vbox to\headheight{%
\moveright\@themargin \vbox {
\setbox\@tempboxa \vbox to\headheight {
\vfil
\color@hbox
\normalcolor
\hb@xt@\textwidth{\@thehead}%
\color@endbox
% \end{macrocode}
% 22 Feb 87
% \begin{macrocode}
}%
\dp\@tempboxa \z@
\box\@tempboxa
% Tagging socket that receives the header in its second argument to
% surround the header with appropriate tagging structures (first
% argument is unused). If tagging is disabled it returns the
% content of the second argument.
% \begin{macrocode}
\pdfannot_link_off:
\UseTaggingSocket{build/page/header}{}%
{
\color@hbox
\normalcolor
\hb@xt@ \textwidth {\@thehead }%
\color@endbox
}
\pdfannot_link_on:
}
\dp \@tempboxa \z@
\box \@tempboxa
\vskip \headsep
\box\@outputbox
\box \@outputbox
\baselineskip \footskip
\color@hbox
\normalcolor
\hb@xt@\textwidth{\@thefoot}%
\color@endbox
}%
}%
% \end{macrocode}
% Tagging socket that receives the footer in its second argument to
% surround the footer with appropriate tagging structures (first
% argument is unused). If tagging is disabled it returns the
% content of the second argument.
% \begin{macrocode}
\pdfannot_link_off:
\UseTaggingSocket{build/page/footer}{}
{
\color@hbox
\normalcolor
\hb@xt@ \textwidth {\@thefoot }%
\color@endbox
}
\pdfannot_link_on:
}
}
% \end{macrocode}
% |\endgroup| now inserted by |\aftergroup|
%
% Restore |\if@newlist|
% \begin{macrocode}
\global\let\if@newlist\@@if@newlist
\global \let \if@newlist \@@if@newlist
% \end{macrocode}
%
% \begin{macrocode}
\global \@colht \textheight
\stepcounter{page}%
\stepcounter{page}
% \end{macrocode}
% Another hook for packages that want to append material to \cs{@outputpage}.
% \begin{macrocode}
\UseHook {build/page/after}%
}
\ExplSyntaxOff
}
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
Expand Down Expand Up @@ -3053,10 +3103,11 @@
%<latexrelease> \global \@colht \textheight
%<latexrelease> \stepcounter{page}%
% \end{macrocode}
% It is now clear that this does something useful, thanks to Pieter
% van Oostrum. It is needed because a float page is made without
% using TeX's page-builder; thus the output routine is never called
% so the marks are not updated.
% It is now clear that this does something useful (in the old mark
% mechanism), thanks to Pieter van Oostrum pointing this out. It
% is needed because a float page is made without using TeX's
% page-builder; thus the output routine is never called so the
% marks are not updated.
% \begin{macrocode}
%<latexrelease> \let\firstmark\botmark
%<latexrelease>}
Expand Down
114 changes: 0 additions & 114 deletions required/latex-lab/latex-lab-new-or-2.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -119,129 +119,15 @@
%
%
%
% \subsection{The \cs{@makecol} configuration}
%
%
%
% \subsection{\cs{@outputpage} reimplementation}
%
%
% \begin{macro}{\@outputpage}
% This needs to be moved elsewhere (documentation exacept for the
% new hooks and sockets is there).
% \begin{macrocode}
\ExplSyntaxOn
\def\@outputpage{%
% \end{macrocode}
% A hook available to packages that want to prepend code to \cs{@outputpage}.
% \begin{macrocode}
\UseHook {build/page/before}%
%
\begingroup
\let \protect \noexpand
\language \document@default@language
\@resetactivechars
\global \let \@@if@newlist \if@newlist
\global \@newlistfalse
\@parboxrestore
% \end{macrocode}
% Hook to allow adding resets local to the output routine processing, e.g.,
% in \cs{write} or running headers/footers, for packages that set
% up special conventions in the main galley that should not leak
% into the page production just because a page break happens in the
% middle of such an environment.
% \begin{macrocode}
\UseHook {build/page/reset}%
\shipout \vbox {%
\set@typeset@protect
\aftergroup \endgroup
\aftergroup \set@typeset@protect
\if@specialpage
\global \@specialpagefalse
\@nameuse {ps@\@specialstyle}%
\fi
\if@twoside
\ifodd \count \z@
\let \@thehead \@oddhead
\let \@thefoot \@oddfoot
\let \@themargin \oddsidemargin
\else
\let \@thehead \@evenhead
\let \@thefoot \@evenfoot
\let \@themargin \evensidemargin
\fi
\fi
\reset@font \normalsize \normalsfcodes
\let \label \@gobble@with@sphack@om
\let \index \@gobble@with@sphack@som
\let \glossary \@gobble@with@sphack@om
\baselineskip \z@skip
\lineskip \z@skip
\lineskiplimit \z@
\@begindvi
\vskip \topmargin
\moveright \@themargin \vbox {%
\setbox \@tempboxa \vbox to\headheight {%
\vfil
% \end{macrocode}
% Tagging socket that receives the header in its second argument to
% surround the header with appropriate tagging structures (first
% argument is unused). If tagging is disabled it returns the
% content of the second argument.
% \begin{macrocode}
\pdfannot_link_off:
\UseTaggingSocket{build/page/header}{}%
{
\color@hbox
\normalcolor
\hb@xt@ \textwidth {\@thehead }%
\color@endbox
}
\pdfannot_link_on:
%
}%
\dp \@tempboxa \z@
\box \@tempboxa
\vskip \headsep
\box \@outputbox
\baselineskip \footskip
% \end{macrocode}
% Tagging socket that receives the footer in its second argument to
% surround the footer with appropriate tagging structures (first
% argument is unused). If tagging is disabled it returns the
% content of the second argument.
% \begin{macrocode}
\pdfannot_link_off:
\UseTaggingSocket{build/page/footer}{}
{
\color@hbox
\normalcolor
\hb@xt@ \textwidth {\@thefoot }%
\color@endbox
}
\pdfannot_link_on:
%
}%
}%
\global \let \if@newlist \@@if@newlist
\global \@colht \textheight
\stepcounter {page}%
% \end{macrocode}
% Another hook for packages that want to append material to \cs{@outputpage}.
% \begin{macrocode}
\UseHook {build/page/after}%
}
\ExplSyntaxOff
% \end{macrocode}
% \end{macro}
%
% \begin{plugdecl}{default}
% This needs documentation and moving.
% \begin{macrocode}

\ExplSyntaxOn


% \end{macrocode}
% \fmi{where should these plug declarations go? tagpdf?}
% \begin{macrocode}
Expand Down

0 comments on commit 9baaf3d

Please sign in to comment.