[latex3-commits] [git/LaTeX3-latex3-pdfresources] outputpatches: first draft for patches (e4f637c)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Aug 19 19:03:23 CEST 2021


Repository : https://github.com/latex3/pdfresources
On branch  : outputpatches
Link       : https://github.com/latex3/pdfresources/commit/e4f637ce513b66327cc6dcd764b713ad6ae3ebc2

>---------------------------------------------------------------

commit e4f637ce513b66327cc6dcd764b713ad6ae3ebc2
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Aug 19 19:03:23 2021 +0200

    first draft for patches


>---------------------------------------------------------------

e4f637ce513b66327cc6dcd764b713ad6ae3ebc2
 output-patches.dtx | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)

diff --git a/output-patches.dtx b/output-patches.dtx
new file mode 100644
index 0000000..2ca812f
--- /dev/null
+++ b/output-patches.dtx
@@ -0,0 +1,140 @@
+% \iffalse meta-comment
+%
+%% File: output-patches.dtx (C) Copyright 2020-2021 Frank Mittelbach
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    https://www.latex-project.org/lppl.txt
+%
+%<*driver>
+\documentclass{l3doc}
+
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+  \DocInput{output-patches.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \providecommand\hook[1]{\texttt{#1}}
+%
+%
+%
+% \title{Temporary output patches for tagging and better link support}
+% \author{Frank Mittelbach \and Ulrike Fischer}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+%    This package contains a few patches of internal \LaTeX{} needed
+%    to support paragraph tagging across
+%    page boundaries (in \pdfTeX) and improve the behaviour of links across page breaks.
+%
+%    Until this get properly integrated with the kernel code this has
+%    to be taken as a prototype and code, interfaces as well as
+%    behavior may change without notice and certainly without any
+%    backwards compatibility!
+%
+%
+% \StopEventually{\setlength\IndexMin{200pt}  \PrintIndex  }
+%
+%
+% \section{The Implementation}
+%    \begin{macrocode}
+%<*package>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\RequirePackage{etoolbox}
+%    \end{macrocode}
+%
+%
+%  \subsection{Patching the OR}
+%  This add hooks around header and footer.
+%  At first initialize the hooks
+%    \begin{macrocode}
+\newcommand\@kernel at before@head{}
+\newcommand\@kernel at before@foot{}
+\newcommand\@kernel at after@head{}
+\newcommand\@kernel at after@foot{}
+\newcommand\@kernel at before@footins{}
+\newcommand\@kernel at before@cclv{}
+\newcommand\@mult at ptagging@hook{}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+
+\patchcmd\@outputpage
+ {\vfil\color at hbox\normalcolor\hb at xt@\textwidth{\@thehead}\color at endbox}
+ {\vfil\@kernel at before@head\color at hbox\normalcolor\hb at xt@\textwidth{\@thehead}\color at endbox\@kernel at after@head}
+ {\typeout{Patching header in \string\@outputpage}}{\PATCHerror }
+
+
+\patchcmd\@outputpage
+ {\color at hbox\normalcolor\hb at xt@\textwidth{\@thefoot}\color at endbox}
+ {\@kernel at before@foot\color at hbox\normalcolor\hb at xt@\textwidth{\@thefoot}\color at endbox\@kernel at after@foot}
+ {\typeout{Patching footer in \string\@outputpage}{\PATCHerror }
+%    \end{macrocode}
+%
+%  \begin{macro}{\@makecol}
+%    We have to patch \cs{@makecol} in two places:
+%    \begin{itemize}
+%    \item
+%      update 255 up front to add missing tmb/tme if necessary
+%    \item
+%      update the \cs{footins} stream if that one got split
+%    \end{itemize}
+%    \begin{macrocode}
+
+\patchcmd\@makecol
+    {\vskip\skip\footins}
+    {\vskip\skip\footins\@kernel at before@footins}
+  {\typeout{Patching \string\@makecol\space for tagging}}{\PATCHerror }
+
+% for some reason patching with etoolbox only works in this order ...
+
+\pretocmd\@makecol{\@kernel at before@cclv}
+  {\typeout{Patching \string\@makecol\space for tagging}}{\PATCHerror }
+%    \end{macrocode}
+%  \end{macro}
+%
+% \subsection{\pkg{multicol} adjustments}
+%
+%    The patches for pkg{multicol} are fairly minimal:
+%    \begin{itemize}
+%    \item At the start of the environment anything already on the
+%    page is picked up and stored in \cs{partial at page}, we may need to add
+%    a TMB to that (it should have a proper TME). This has to happen
+%    in the \enquote{main} stream context.
+%    \item
+%    \item
+%    \end{itemize}
+%
+%    \begin{macrocode}
+\AddToHook{package/after/multicol}{% multicol needs later loading
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+  \patchcmd\page at sofar
+      {\setbox\z@\hbox{p}\global\dimen\tw@\dp\z@}%
+      {%
+        \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
+        \@mult at ptagging@hook
+      }%
+      {\typeout{Patching \string\page at sofar\space for tagging}}{\PATCHerror}%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\endinput
+%</package>
+%    \end{macrocode}
+%
+% \Finale
+%





More information about the latex3-commits mailing list.