summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/ltpara.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltpara.dtx')
-rw-r--r--Master/texmf-dist/source/latex/base/ltpara.dtx71
1 files changed, 66 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltpara.dtx b/Master/texmf-dist/source/latex/base/ltpara.dtx
index 9296f2b2cd9..9c1a95ee61b 100644
--- a/Master/texmf-dist/source/latex/base/ltpara.dtx
+++ b/Master/texmf-dist/source/latex/base/ltpara.dtx
@@ -1,7 +1,8 @@
% \iffalse meta-comment
%
-%% File: ltpara.dtx (C) Copyright 2020-2021
-% Frank Mittelbach, LaTeX Team
+%% File: ltpara.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -14,8 +15,8 @@
%%% From File: ltpara.dtx
%
% \begin{macrocode}
-\def\ltparaversion{v1.0k}
-\def\ltparadate{2022/05/13}
+\def\ltparaversion{v1.0l}
+\def\ltparadate{2023/01/30}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
@@ -729,6 +730,8 @@
% for error recovery and so altering \cs{tex_everypar:D} all the
% time should be a tiny bit faster.
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2023/06/01}
+%<latexrelease> {\g_@@_standard_everypar_tl}{minipage~ fix}
\tl_new:N \g_@@_standard_everypar_tl
% \end{macrocode}
% Here is now its definition:
@@ -769,7 +772,28 @@
% \begin{macrocode}
\group_begin:
\tex_everypar:D {}
- \skip_zero:N \tex_parskip:D
+% \end{macrocode}
+% There has been a long-standing problem with \LaTeX's minipages in
+% that invisible material at the beginning of a minipage (such as a
+% \cs{color} setting) would result in \cs{parskip} being added in
+% front of the first paragraph---something that is not done by
+% \TeX{} if a vertical list is completely empty. As this is
+% happening on a very low-level in the engine it wasn't really
+% possible to find out if this \cs{parskip} was added or if a space
+% we see in front of the current point is legitimate. However, with
+% the new paragraph handling we are in a better position: while we
+% still don't know if there is such a space or not, we do know
+% if we have just created an empty paragraph. Thus, if we now set
+% \cs{parskip} to \texttt{-}\cs{parskip} the two will cancel each other
+% if present and if the first was ignored because the vertical list
+% was empty, then the second will be ignored too because it is
+% still empty. Of course, we don't want to cancel always but only
+% at the start of a minipage and that is signaled with the
+% \texttt{@minipage} switch.
+% \changes{v1.0l}{2023/01/30}{Backout \cs{parskip} at top of minipage (gh/989)}
+% \begin{macrocode}
+ \skip_set:Nn \tex_parskip:D
+ { \if@minipage -\tex_parskip:D \else: \c_zero_skip \fi: }
\tex_noindent:D
\group_end:
% \end{macrocode}
@@ -800,6 +824,43 @@
\@@_handle_indent:
% \the \everypar % <--- done differently below
}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/06/01}
+%<latexrelease> {\g_@@_standard_everypar_tl}{minipage~ fix}
+%<latexrelease>
+%<latexrelease>\tl_gset:Nn \g_@@_standard_everypar_tl {
+%<latexrelease> \box_gset_to_last:N \g_para_indent_box
+%<latexrelease> \group_begin:
+%<latexrelease> \tex_par:D
+%<latexrelease> \group_end:
+%<latexrelease> \tex_everypar:D { \msg_error:nnnn { hooks }{ para-mode }{before}{vertical} }
+%<latexrelease> \@kernel@before@para@before
+%<latexrelease> \hook_use:n {para/before}
+%<latexrelease> \group_begin:
+%<latexrelease> \tex_everypar:D {}
+%<latexrelease> \skip_zero:N \tex_parskip:D
+%<latexrelease> \tex_noindent:D
+%<latexrelease> \group_end:
+%<latexrelease> \tex_everypar:D{\g_@@_standard_everypar_tl}
+%<latexrelease> \@kernel@before@para@begin
+%<latexrelease> \hook_use:n {para/begin}
+%<latexrelease> \if_mode_horizontal: \else:
+%<latexrelease> \msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \fi:
+%<latexrelease> \@@_handle_indent:
+%<latexrelease>}
+% \end{macrocode}
+% We also have to add the \cs{everypar} toks register at the
+% end. In case of rollback this is already allocated and we have to
+% find out the correct number (hope this is correctly done)
+% \begin{macrocode}
+%<latexrelease>\cs_set:Npn \@@_tmp:w #1#2#3#4#5 { }
+%<latexrelease>\tl_gput_right:Nx \g_@@_standard_everypar_tl {
+%<latexrelease> \exp_not:N \the
+%<latexrelease> \exp_not:N \toks
+%<latexrelease> \exp_after:wN \@@_tmp:w \token_to_meaning:N \everypar
+%<latexrelease> \c_space_tl
+%<latexrelease>}
+%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
% \end{macro}
%