Skip to content

Commit

Permalink
Adapt new or (#948)
Browse files Browse the repository at this point in the history
* move output patches from pdfresource, number new-or files

* adapt wrapper styles to new-or numbering

* update documentation for DocumentMetadata

* update pdfmanagement support files

* update tests (output patches new-or-1 no longer loaded by default)

* update test: file name change new-or-2 and shipout/lastpage use (xmp)

* update versions, file dates and add changes entry

* correct typos and file names from review

Co-authored-by: Ulrike Fischer <fischer@troubleshooting-tex.de>
  • Loading branch information
u-fischer and Ulrike Fischer committed Dec 21, 2022
1 parent 0c218fe commit 3a5cd1d
Show file tree
Hide file tree
Showing 46 changed files with 1,481 additions and 689 deletions.
8 changes: 8 additions & 0 deletions required/latex-lab/changes.txt
@@ -1,3 +1,11 @@
2022-04-11 Ulrike Fischer <Ulrike.Fischer@latex-project.org>

* documentmeta-support.dtx:
updated documentation
* moved output patches from pdfresources to latex-lab-new-or-1
* reorganized new-or: number subfiles as new-or-1, new-or-2 and load all with new-or.


2022-07-22 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* latex-lab-footnotes.dtx (subsection{Document-level commands}):
Expand Down
59 changes: 48 additions & 11 deletions required/latex-lab/documentmetadata-support.dtx
Expand Up @@ -18,8 +18,8 @@
% for those people who are interested or want to report an issue.
%
% \begin{macrocode}
\def\documentmetadatasupportversion{1.0b}
\def\documentmetadatasupportdate{2022-14-04}
\def\documentmetadatasupportversion{1.0c}
\def\documentmetadatasupportdate{2022-11-04}
% \end{macrocode}
%
%
Expand Down Expand Up @@ -64,13 +64,19 @@
% While the underlying functionality is still under
% development (e.g., further keys will be added over time and keys
% marked temporary may vanish again) the code for
% \cs{DocumentMetadata} is place in a separate bundle, so that it
% \cs{DocumentMetadata} is placed in a separate bundle, so that it
% is easier to update it without the need to build a full \LaTeX{}
% release. Over time the functionality will move fully into the
% kernel.
%
% \cs{DocumentMetadata} also loads and activates
% the new PDF management code from \pkg{pdfmanagement-testphase}.
% As this forces the loading of the \pkg{l3backend} files, a backend
% that can't be detected automatically like |dvipdfmx|,
% must be set in the first \cs{DocumentMetadata}.
%
% From a process perspective \cs{DocumentMetadata} loads the
% \pkg{pdfmanagement} code the first time it is called and then
% \pkg{pdfmanagement-testphase} code the first time it is called and then
% redefines itself to only manage key/value pairs in case it is
% called more than once. In particular, this means that a document
% without a \cs{DocumentMetadata} declaration has no code available
Expand All @@ -84,10 +90,12 @@
%
%
% Currently the following keys are implemented for \cs{DocumentMetadata}:
% \DescribeMkey{backend}
% \DescribeMkey{colorprofiles}
% \DescribeMkey{debug}
% \DescribeMkey{lang}
% \DescribeMkey{pdfstandard}
% \DescribeMkey{xmp}
% \DescribeMkey{pdfversion}
% \DescribeMkey{testphase}
% \DescribeMkey{uncompress}
Expand All @@ -110,15 +118,34 @@
% \item[\texttt{pdfstandard}] Choice key to set the pdf standard.
% Currently |A-1b|, |A-2a|, |A-2b|, |A-2u|, |A-3a|, |A-3b|, |A-3u| and |A-4| are accepted as
% values. The casing is irrelevant, |a-1b| works too.
% The underlying code to ensure the requirements (as far as they
% can be ensured) is still incomplete, but a color profile is included and the
% \texttt{/OutputIntent} is set. The |u| variants for example do not force unicode,
% but they will pass the information to hyperref and hyperxmp. The |a| variants
% do \emph{not} enforce (or even test) a tagged pdf yet. The |A-4| support is
% currently incomplete.
% Note that using these
% key doesn't mean that the document actually follows the standard. \LaTeX{}
% can neither ensure nor check all requirements of a standard, and not everything
% it can do theoretically has already been implemented.
% When setting an A-standard a color profile is included and the
% \texttt{/OutputIntent} is set and javascript action in hyperref are suppressed.
% The |u| variants do not enforce unicode,
% but they will pass the information to hyperref. The |a| variants
% do \emph{not} enforce (or even test) a tagged pdf yet.
%
% Starting with version 0.95s of \pkg{pdfmanagement-testphase}
% it is also possible to use the values
% |X-4|, |X-4p|, |X-5g|, |X-5n|, |X-5pg|, |X-6|, |X-6n|, |X-6p|, |UA-1| for
% a PDF/X and PDF/UA standard. These keys currently set \emph{only} the relevant
% XMP-metadata.
%
% |pdfstandard| can be used more than once to set overlapping standards, e.g:\\
% |pdfstandard=A-2b,pdfstandard=X-4,pdfstandard=UA-1|
%
% If XMP-metadata are added (see the following key \texttt{xmp}
% the needed conformance marker for the standards are set.
%
% More information can be found in the documentation
% of \pkg{l3pdfmeta}.
% of \pkg{l3pdfmeta}.
%
% \item[\texttt{xmp}] A boolean, if set to false no XMP metadata are added to the PDF.
% The initial value is true. Details are described in the documentation of \pkg{l3pdfmeta}.
%
% \item[\texttt{colorprofiles}] This allows to load icc-colorprofiles. Details
% are described in the documentation of \pkg{l3pdfmeta}.
%
Expand All @@ -137,6 +164,16 @@
% additionally activate tagging of paragraphs with
% |\tagpdfsetup{paratagging}|. In the upcoming months it will
% also enable automatic tagging of other basic document elements.
% \item[\texttt{new-or-1}] This patches a few commands related
% to the output routine. The patches are needed for the tagging
% of paragraphs, for the tagging of header and footer and
% to allow the PDF management to insert code which avoids that
% links happening at page breaks spills into the header and footer.
% This code is automatically loaded if the \texttt{testphase} values
% \texttt{phase-I}, \texttt{phase-II} or \texttt{new-or} are used.%
% \item[\texttt{new-or}] This loads more changes to the output routine required for the
% tagging. It is not compatible with every class! The code is also loaded by the
% \texttt{phase-II} value.
% \end{description}
% The |testphase| key can only be used in the first \cs{DocumentMetadata}.
%
Expand Down
159 changes: 159 additions & 0 deletions required/latex-lab/latex-lab-new-or-1.dtx
@@ -0,0 +1,159 @@
% \iffalse meta-comment
%
%% File: latex-lab-new-or-1.dtx (C) Copyright 2020-2022 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{latex-lab-new-or-1.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 file contains a few patches of internal \LaTeX{} commands
% 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}
%<*code>
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesPackage{latex-lab-testphase-new-or-1}
[2022-11-94 v0.1a Temporary output patches for tagging and better link support]
\RequirePackage{etoolbox}
% \end{macrocode}
%
%
% \subsection{Patching the OR}
% This adds hooks around header and footer, in \cs{@makecol} and in multicol.
% At first initialize some of the hooks. We use providecommand to avoid problems if
% the kernel changes here and provides them directly.
% \begin{macrocode}
\providecommand\@kernel@before@head{}
\providecommand\@kernel@before@foot{}
\providecommand\@kernel@after@head{}
\providecommand\@kernel@after@foot{}
\providecommand\@mult@ptagging@hook{}% multicol
% \end{macrocode}
%
% \begin{macrocode}

\patchcmd\@outputpage
{\vfil\color@hbox\normalcolor\hb@xt@\textwidth{\@thehead}\color@endbox}
{\vfil\@kernel@before@head\color@hbox\normalcolor\hb@xt@\textwidth{\@thehead}\color@endbox\@kernel@after@head}
{\typeout{Patching header in \string\@outputpage}}{\PATCHerror }


\patchcmd\@outputpage
{\color@hbox\normalcolor\hb@xt@\textwidth{\@thefoot}\color@endbox}
{\@kernel@before@foot\color@hbox\normalcolor\hb@xt@\textwidth{\@thefoot}\color@endbox\@kernel@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}
%
% We patch \cs{@makecol}, if new-or-2 is loaded too it will overwrite that again.
% \begin{macrocode}
\providecommand\@kernel@before@footins{}
\providecommand\@kernel@before@cclv{}

\patchcmd\@makecol
{\vskip\skip\footins}
{\vskip\skip\footins\@kernel@before@footins}
{\typeout{Patching \string\@makecol\space for tagging}}{\PATCHerror }

%for some reason patching with etoolbox only works in this order ...

\pretocmd\@makecol{\@kernel@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@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/multicol/after}
{% multicol needs later loading
% \end{macrocode}
%
% \begin{macrocode}
\patchcmd\page@sofar
{\setbox\z@\hbox{p}\global\dimen\tw@\dp\z@}%
{%
\setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
\@mult@ptagging@hook
}%
{\typeout{Patching \string\page@sofar\space for tagging}}{\PATCHerror}%
}
% \end{macrocode}
%
% \subsection{Interrupt hooks}
% This requires the l3pdfannot module!
% We add the code here and not in hyperref, as it should also work with links
% created directly with the l3pdfannot commands. The file is only
% loaded by the pdfmanagement, so no need to test if the commands exist.
% \begin{macrocode}
\ExplSyntaxOn
\def\@kernel@before@head{\pdfannot_link_off:}
\def\@kernel@before@foot{\pdfannot_link_off:}
\def\@kernel@after@head {\pdfannot_link_on:}
\def\@kernel@after@foot {\pdfannot_link_on:}
\ExplSyntaxOff
% \end{macrocode}
%
% \begin{macrocode}
%</code>
% \end{macrocode}
%
% \Finale
%
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
%% File: latex-lab-new-or.dtx
%% File: latex-lab-new-or-2.dtx
% Copyright (C) 2022 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
Expand All @@ -22,14 +22,14 @@
\EnableCrossrefs
\CodelineIndex
\begin{document}
\DocInput{latex-lab-new-or.dtx}
\DocInput{latex-lab-new-or-2.dtx}
\end{document}
%</driver>
%
% \fi
%
%
% \title{The \texttt{latex-lab-new-or} code\thanks{}}
% \title{The \texttt{latex-lab-testphase-new-or-2} code\thanks{}}
% \author{Frank Mittelbach, \LaTeX{} Project}
%
% \maketitle
Expand Down Expand Up @@ -128,8 +128,8 @@
%
% \subsection{File declaration}
% \begin{macrocode}
\ProvidesFile{latex-lab-new-or.ltx}
[2022-03-09 v0.1b changes to the output routine]
\ProvidesPackage{latex-lab-testphase-new-or-2}
[2022-11-04 v0.1c changes to the output routine]
% \end{macrocode}
% \subsection{\cs{@makecol} reimplementation}
%
Expand Down
45 changes: 40 additions & 5 deletions required/latex-lab/latex-lab-testphase.dtx
Expand Up @@ -51,14 +51,49 @@
%
%
% \section{The Implementation}
% new-or-1 contains the code for header and footer (tagging and
% suppressing links) and is always loaded
% \begin{macrocode}
%<*new-or-1>
\ProvidesFile{new-or-1-latex-lab-testphase.ltx}
[2022-11-04 v0.1a latex-lab wrapper new-or-1]
%</new-or-1>
% \end{macrocode}
% new-or combines all new-or parts (currently 1+2)
% \begin{macrocode}
%<*new-or>
\ProvidesFile{new-or-latex-lab-testphase.ltx}
[2022-11-04 v0.1a latex-lab wrapper new-or]
%</new-or>
% \end{macrocode}
% \begin{macrocode}
%<*phase-I>
\ProvidesFile{phase-I-latex-lab-testphase.ltx}
[2022-11-04 v0.1a latex-lab wrapper phase-I]
%</phase-I>
% \end{macrocode}
% \begin{macrocode}
%<*phase-II>
\ProvidesFile{phase-II-latex-lab-testphase.ltx}
[2022-11-04 v0.1a latex-lab wrapper phase-II]
%</phase-II>
% \end{macrocode}
% this is only provided for compatibility
% \begin{macrocode}
%<*tagpdf>
\ProvidesFile{tagpdf-latex-lab-testphase.ltx}
[2022-11-04 v0.1a latex-lab wrapper tagpdf (deprecated)]
%</tagpdf>
% \end{macrocode}
% \begin{macrocode}
%<*tagpdf|phase-I|phase-II|new-or|new-or-1>
\RequirePackage{latex-lab-testphase-new-or-1}
%</tagpdf|phase-I|phase-II|new-or|new-or-1>
% \end{macrocode}
% New output routine code is loaded in phase-II and new-or:
% \begin{macrocode}
%<*tagpdf|phase-II|new-or>
\IfFileExists{latex-lab-testphase-new-or.sty}
{
\RequirePackage{latex-lab-testphase-new-or}
}
{}
\RequirePackage{latex-lab-testphase-new-or-2}
%</tagpdf|phase-II|new-or>
% \end{macrocode}
% \begin{macrocode}
Expand Down
5 changes: 3 additions & 2 deletions required/latex-lab/latex-lab.ins
Expand Up @@ -71,10 +71,11 @@ where one can also log issues in case there are any.

\generate{\file{tagpdf-latex-lab-testphase.ltx}{\from{latex-lab-testphase.dtx}{tagpdf}}}
\generate{\file{new-or-latex-lab-testphase.ltx}{\from{latex-lab-testphase.dtx}{new-or}}}

\generate{\file{new-or-1-latex-lab-testphase.ltx}{\from{latex-lab-testphase.dtx}{new-or-1}}}
% support files (the new-or code is a private package to make life easier)

\generate{\file{latex-lab-testphase-new-or.sty}{\from{latex-lab-new-or.dtx}{code}}}
\generate{\file{latex-lab-testphase-new-or-2.sty}{\from{latex-lab-new-or-2.dtx}{code}}}
\generate{\file{latex-lab-testphase-new-or-1.sty}{\from{latex-lab-new-or-1.dtx}{code}}}
\generate{\file{latex-lab-footmisc.ltx}{\from{latex-lab-footnotes.dtx}{footmisc}}}
\generate{\file{latex-lab-footnotes.ltx}{\from{latex-lab-footnotes.dtx}{kernel}}}

Expand Down
3 changes: 3 additions & 0 deletions required/latex-lab/testfiles-OR/footmisc-001.tlg
Expand Up @@ -60,4 +60,7 @@ Completed box being shipped out [1]
....\glue 0.0 plus 1.0fil
..\pdfrunninglinkon
.\kern 0.0
.\kern -633.0
.\hbox(0.0+0.0)x0.0
.\kern 633.0
(footmisc-001.aux)

0 comments on commit 3a5cd1d

Please sign in to comment.