[latex3-commits] [git/LaTeX3-latex3-latex2e] ltpara: add ltnews and changes entry drop ltpara.ltx (now generated) minor updates to ltpara.dtx (68135e4d)

Frank Mittelbach frank.mittelbach at latex-project.org
Tue Feb 16 22:55:48 CET 2021


Repository : https://github.com/latex3/latex2e
On branch  : ltpara
Link       : https://github.com/latex3/latex2e/commit/68135e4d74f477b7e1910b6dc679105f6d195829

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

commit 68135e4d74f477b7e1910b6dc679105f6d195829
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Feb 16 22:55:48 2021 +0100

    add ltnews and changes entry
    drop ltpara.ltx (now generated)
    minor updates to ltpara.dtx


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

68135e4d74f477b7e1910b6dc679105f6d195829
 base/build.lua        |   1 -
 base/changes.txt      |   6 +++
 base/doc/ltnews33.tex |  56 +++++++++++++++++++-------
 base/ltpara.dtx       |  34 +++++++++++-----
 base/ltpara.ltx       | 106 --------------------------------------------------
 5 files changed, 73 insertions(+), 130 deletions(-)

diff --git a/base/build.lua b/base/build.lua
index 2d61f75f..c155701c 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -52,7 +52,6 @@ sourcefiles    =
     "sample2e.tex",
     "small2e.tex",
     "testpage.tex",
---    "ltpara.ltx",             -- temp
     "source2edoc.cls",        -- temp
      "*-????-??-??.sty"
   }
diff --git a/base/changes.txt b/base/changes.txt
index 67f9c839..debbcb3c 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2021-02-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltpara.dtx: providing paragraph hooks,; full integration into
+	latex.ltx will happen at a later point in time. For documentation
+	see ltpara-doc.pdf.
+
 2021-02-15  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* ltfssdcl.dtx: two additional \expandafter to avoid infinite
diff --git a/base/doc/ltnews33.tex b/base/doc/ltnews33.tex
index 0a5ff188..ab42375d 100644
--- a/base/doc/ltnews33.tex
+++ b/base/doc/ltnews33.tex
@@ -111,6 +111,31 @@
 
 
 
+\section{Extending the hook concept to paragraphs}
+
+Largely triggered by the need for better control of paragraph text
+processing, in particular when producing tagged PDF output (see
+\cite{33:blueprint}), we have extended the paragraph processing of
+\LaTeX{} so that the kernel gains control both at the start and the
+end of each paragraph. This is is done in a manner that is (or should
+be) transparent to packages and user documents.
+
+Beside the internal control points for exclusive use of the \LaTeX{}
+kernel we also implemented four public hooks that can be used by
+packages or user via the hook management declarations to achieve
+special effects or implement manipulations that in the past were only
+possible through redefinitions of \cs{everypar} or \cs{par} with the
+usual issue that such changes would conflict with changes in other
+packages.
+
+The documentation of the hooks together with a few examples is
+provided in \file{ltpara-doc.pdf} and for those who want to study the
+(quite interesting) code is found in \file{ltpara-code.pdf}. At
+some point in the future it will get fully merged into the \LaTeX{}
+kernel and will then appear in \file{source2e.pdf}.
+
+
+
 \section{Other changes to the \LaTeX{} kernel}
 
 \subsection{Adjusting \env{itemize} labels with \cs{labelitemfont}}
@@ -126,7 +151,7 @@ to \textit{\textbullet}.
 
 Now \cs{labelitemfont} is applied to each
 label defaulting to \cs{normalfont} which will prevent this behavior.
-By chosing a different settings other effects can be achieved, for example
+By choosing a different settings other effects can be achieved, for example
 \begin{verbatim}
   \renewcommand\labelitemfont
      {\normalfont\fontfamily{lmss}\selectfont}
@@ -171,7 +196,8 @@ the name. The coding has now been slightly altered to allow for this.
 \githubissue{427}
 
 
-\subsection{Add a Lua callback to ltshipout to provide a uniform location for applying custom attributes}
+\subsection{Add a Lua callback to \pkg{ltshipout} to provide
+  a uniform location for applying custom attributes}
 
 Just before shipping out a page, a new \LuaTeX{} callback
 ``\texttt{pre\_shipout\_filter}'' is now called to allow final
@@ -195,7 +221,7 @@ longer need to load the \pkg{cmap} package or input \texttt{glyphtounicode}.
 \githubissue{465}
 
 
-\subsection{Provide hook in \cs{selectfont}}
+\subsection{Provide a hook in \cs{selectfont}}
 
 After \cs{selectfont} has altered the font we run a hook so that
 packages can make final adjustments. This functionality was originally
@@ -241,9 +267,9 @@ or last.
 
 \subsection{Robust commands in filename arguments}
 The filename handling has been modified so that \verb|\string| is
-applied while normalising robust commands while detetermining the file
+applied while normalizing robust commands while determining the file
 name.  Previously \verb|\input{\sqrt{2}}| would cause \LaTeX\ to loop indefinitely.
-With the new behaviour it accesses \verb|sqrt {2}.tex|.
+With the new behavior it accesses \verb|sqrt {2}.tex|.
 %
 \githubissue{481}
 
@@ -268,7 +294,7 @@ extra layer of groups to ensure that the color setting does not
 \emph{escape} and continue outside the box when it shouldn't. To
 arrange for this the \LaTeX{} kernel defined a number of commands, e.g.,
 \cs{color at begingroup} to be used in such places. They have been
-initally no-ops and only the color packages redefined them to become
+initially no-ops and only the color packages redefined them to become
 real groups. This arrangement complicates the coding as one has to
 account for a group being there (or not there) depending of what is
 loaded in the document. So now the kernel already adds the groups.
@@ -279,7 +305,7 @@ loaded in the document. So now the kernel already adds the groups.
 \subsection{Execute \cs{par} at the end of \cs{marginpar} arguments}
 
 In preparation for tagged PDF it is important to properly tag all
-paragraphs and this requires running code at the beinning and end of
+paragraphs and this requires running code at the beginning and end of
 each. At the end of a paragraph this is done inside the \cs{par}
 command, but the way \cs{marginpar} was coded, \LaTeX{} ended the
 marginal note without ever explicitly calling \cs{par}. This has now
@@ -330,16 +356,22 @@ The package now recognizes \texttt{japanese} as a language option.
 \githubissue{xxx}
 
 
+\medskip
+\begin{thebibliography}{9}
 
+\fontsize{9.3}{11.3}\selectfont
 
+\bibitem{33:blueprint} Frank Mittelbach and Chris Rowley:
+  \emph{\LaTeX{} Tagged PDF — A blueprint for a large project}.\\
+  \url{https://latex-project.org/publications/indexbyyear/2020/}
 
-\end{document}
+\end{thebibliography}
 
 
-\medskip
-\begin{thebibliography}{9}
 
-\fontsize{9.3}{11.3}\selectfont
+
+\end{document}
+
 
 \bibitem{32:ltnews31} \LaTeX{} Project Team:
   \emph{\LaTeXe{} news 31}.\\
@@ -358,5 +390,3 @@ The package now recognizes \texttt{japanese} as a language option.
   \emph{Babel---Localization and internationalization}.\\
   \url{https://www.ctan.org/pkg/babel}
 
-\end{thebibliography}
-
diff --git a/base/ltpara.dtx b/base/ltpara.dtx
index 9ab5134e..0730520f 100644
--- a/base/ltpara.dtx
+++ b/base/ltpara.dtx
@@ -431,13 +431,14 @@
 % \end{function}
 %
 %
-% \begin{function}{\SuppressIndentationBox,\para_indentation_suppress:}
+% \begin{function}{\SuppressIndentationBox,\para_suppress_indentation:}
 %    Inside the \hook{para/begin} hook one can use this command to
 %    suppress the indentation box at the start of the
 %    paragraph. (Technically it is possible to use this command
 %    outside the hook as well, but this should not be relied upon.)
+%    The box itself remains available for use.
 %
-%    The \pkg{expl3} name for the function is \cs{para_indentation_suppress:}.
+%    The \pkg{expl3} name for the function is \cs{para_suppress_indentation:}.
 % \end{function}
 %
 % \begin{variable}{\IndentationBox,\g_para_indentation_box}
@@ -696,11 +697,11 @@
 %    Finally we reinsert the indentation box (unless suppressed) and
 %    then call \cs{everypar} the way legacy \LaTeX\ code expects it.
 %
-%    However, adding the \cs{everypar} is a bit tricky (see below) so
-%    we do that a little later.
+%    However, adding the public \cs{everypar} is a bit tricky (see below) so
+%    we add that later, and indirectly.
 %    \begin{macrocode}
   \@@_handle_indent:
-%  \the \everypar               % <-- added later and differently
+% \the \everypar           % <--- done differently
 }
 %    \end{macrocode}
 %  \end{macro}
@@ -754,6 +755,13 @@
 %    \cs{g_@@_standard_everypar_tl} which we do now. We use \texttt{x}
 %    expansion here to get the value of \cs{allocationnumber} in, all
 %    the other tokens should not be expanded at this point.
+
+%    One important point here is to terminate the register allocation
+%    number with a real space. This space will get swallowed up when
+%    the number is read. Anything else, such as \cs{scan_stop:} would
+%    remain in the input and that would mean that it would interfere
+%    with \cs{everypar} code that attempts to scan ahead to see how
+%    the paragraph text starts.
 %    \begin{macrocode}
 \tl_gput_right:Nx \g_@@_standard_everypar_tl {
     \exp_not:N \the
@@ -783,10 +791,10 @@
 }
 \cs_new_eq:NN \@@_handle_indent: \@@_add_indentation_box:
 %    \end{macrocode}
-%     The declaration \cs{para_indentation_suppress:} (or
+%     The declaration \cs{para_suppress_indentation:} (or
 %    \cs{SuppressIndentationBox}) changes that to do nothing.
 %    \begin{macrocode}
-\cs_new:Npn \para_indentation_suppress: {
+\cs_new:Npn \para_suppress_indentation: {
   \cs_set_eq:NN \@@_handle_indent: \prg_do_nothing:
 }
 %    \end{macrocode}
@@ -798,7 +806,7 @@
 %    for use in the \hook{para/begin} hook.
 %    \begin{macrocode}
 \cs_set_eq:NN \IndentationBox \g_para_indentation_box
-\cs_set_eq:NN \SuppressIndentationBox \para_indentation_suppress:
+\cs_set_eq:NN \SuppressIndentationBox \para_suppress_indentation:
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -993,7 +1001,7 @@
 %    Well, one really, first argument is the hook name second the mode
 %    it should have stayed in but didn't.
 %    \begin{macrocode}
-\__kernel_msg_new:nnnn { para } { mode }
+\__kernel_msg_new:nnnn {para} {mode}
   {
     Illegal~mode~ change~ in~ hook~ 'para/#1'.\\
     Hook~ code~ did~ not~ remain~ in~ #2~ mode.
@@ -1010,9 +1018,15 @@
 \ExplSyntaxOff
 %    \end{macrocode}
 %
+%  \subsection{Kernel corrections}
+%
+%    These corrections/changes are already part of the 2021/05
+%    release, i.e., but for testing with older releases they have been
+%    included here for now. So this section will vanish soon.
+%
+%
 %    Marginpar boxes are missing a final internal \cs{par}.
 %    \begin{macrocode}
-
 \IfFormatAtLeastTF{2021/05/01}{}
 {
 \long\def \@savemarbox #1#2{%
diff --git a/base/ltpara.ltx b/base/ltpara.ltx
deleted file mode 100644
index 33d48800..00000000
--- a/base/ltpara.ltx
+++ /dev/null
@@ -1,106 +0,0 @@
-%%
-%% This is file `ltpara.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% ltpara.dtx  (with options: `package')
-%% 
-%% This is a generated file.
-%% 
-%% Copyright 2020-2021 Frank Mittelbach
-%% 
-%% This file was generated from file(s) of the LaTeX `ltpara Bundle'.
-%% --------------------------------------------------------------------------
-%% 
-%% It may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3c
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%%    http://www.latex-project.org/lppl.txt
-%% and version 1.3c or later is part of all distributions of LaTeX
-%% version 2005/12/01 or later.
-%% 
-%% This file may only be distributed together with a copy of the LaTeX
-%% `ltpara Bundle'. You may however distribute the `ltpara Bundle'
-%% without such generated files.
-%% 
-%% The newest sources can be found below
-%% 
-%%    https://github.com/FrankMittelbach/fmitex/
-%% 
-%% where one can also log issues in case there are any.
-%% 
-%% 
-%% File: ltpara.dtx (C) Copyright 2020-2021 Frank Mittelbach
-
-\ExplSyntaxOn
-
-\hook_new_pair:nn{para/begin}{para/end}
-\let \@kernel at before@para at begin \@empty
-\let \@kernel at after@para at end    \@empty
-\tex_everypar:D {
-  \box_set_to_last:N \l_para_indent_box
-  \cs_set_eq:NN \__para_handle_indent: \__para_add_indent_box:
-  \@kernel at before@para at begin
-  \hook_use:n {para/begin}
-  \mode_if_horizontal:F { \ERROR }
-  \__para_handle_indent:
-  \the \everypar
-}
-\newtoks \everypar
-\box_new:N \l_para_indent_box
-
-\cs_new:Npn \__para_add_indent_box: {
-  \box_use_drop:N \l_para_indent_box
-}
-\cs_new_eq:NN \__para_handle_indent: \__para_add_indent_box:
-\cs_new:Npn \para_indent_discard: {
-  \cs_set_eq:NN \__para_handle_indent: \prg_do_nothing:
-}
-\cs_set_eq:NN \IndentationBox \l_para_indent_box
-\cs_set_eq:NN \DiscardIndentationBox \para_indent_discard:
-\cs_new_protected:Npn \__para_end: {
-  \if_mode_horizontal:
-    \if_mode_inner: \else:
-         \tex_unskip:D
-         \hook_use:n{para/end}
-         \@kernel at after@para at end
-         \mode_if_horizontal:F { \ERROR }
-         \ifnum\lastnodetype>0 \tex_hskip:D \c_zero_dim \fi
-     \fi: \fi:
-  \tex_par:D
-}
-\cs_set_eq:NN \par     \__para_end:
-\cs_set_eq:NN \@@par   \__para_end:
-\cs_set_eq:NN \endgraf \__para_end:
-\ExplSyntaxOff
-
-% we have to redo that one
-\everypar{\@nodocument} %% To get an error if text appears before the
-
-\long\def \@savemarbox #1#2{%
-  \global\setbox #1%
-    \color at vbox
-      \vtop{%
-        \hsize\marginparwidth
-        \@parboxrestore
-        \@marginparreset
-        #2\par                    % <-- needed
-        \@minipagefalse
-        \outer at nobreak
-        }%
-    \color at endbox
-}
-
-
-%\let\color at begingroup\begingroup
-%\def\color at endgroup{\endgraf\endgroup}
-%\def\color at setgroup{\color at begingroup}       % \def\color at setgroup{\color at begingroup\set at color}
-%\def\color at hbox{\hbox\bgroup\color at begingroup}
-%\def\color at vbox{\vbox\bgroup\color at begingroup}
-%\def\color at endbox{\color at endgroup\egroup}
-
-\endinput
-%%
-%% End of file `ltpara.sty'.





More information about the latex3-commits mailing list.