Skip to content

Commit

Permalink
work on #989 (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach authored and josephwright committed Feb 15, 2023
1 parent acd4f13 commit 1b03790
Show file tree
Hide file tree
Showing 31 changed files with 464 additions and 4 deletions.
53 changes: 50 additions & 3 deletions base/ltpara.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
%% File: ltpara.dtx (C) Copyright 2020-2021
%% File: ltpara.dtx (C) Copyright 2020-2023
% Frank Mittelbach, LaTeX Team
%
% It may be distributed and/or modified under the conditions of the
Expand All @@ -15,7 +15,7 @@
%
% \begin{macrocode}
\def\ltparaversion{v1.0k}
\def\ltparadate{2022/05/13}
\def\ltparadate{2023/01/30}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
Expand Down Expand Up @@ -729,6 +729,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:
Expand Down Expand Up @@ -769,7 +771,27 @@
% \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 of 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 know know
% that we have just created an empty paragraph. Thus, if we now set
% \cs{parskip} to \texttt{-\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.
% \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}
Expand Down Expand Up @@ -800,6 +822,31 @@
\@@_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__para_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__para_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> \__para_handle_indent:
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
% \end{macro}
%
Expand Down
49 changes: 49 additions & 0 deletions base/testfiles-search/tlb-minipage-01.lvt
@@ -0,0 +1,49 @@
\documentclass{article}

\input{test2e}


\usepackage{hyperref,color}

\showoutput

\begin{document}

\START

\fbox{%
\begin{minipage}{10cm}% % no issue
\begin{itemize}
\item abc \par xyz
\end{itemize}
\end{minipage}%
}

\fbox{%
\begin{minipage}{10cm}%
\LinkTargetOff % no issue if anchor/dest is suppressed
\begin{enumerate}
\item abc \par xyz
\end{enumerate}
\end{minipage}%
}

\fbox{%
\begin{minipage}{10cm}%
\begin{enumerate}
\item abc\label{b} \par xyz % hyperref backref is the issue
\end{enumerate}
\end{minipage}%
}

\fbox{%
\begin{minipage}{10cm}%
\color{red} % color is the issue
\begin{enumerate}
\item abc \par xyz
\end{enumerate}
\end{minipage}%
}

\end{document}

0 comments on commit 1b03790

Please sign in to comment.