From fda509b1c24bc95a9caa00958f8ddb304446e32d Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 29 Nov 2022 17:59:34 +0100 Subject: [PATCH] use a private register instead of a group --- base/changes.txt | 3 ++- base/ltspace.dtx | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/base/changes.txt b/base/changes.txt index 4e69cb0e8..c91de6c7a 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -17,7 +17,8 @@ All changes above are only part of the development branch for the next release. 2022-11-28 Frank Mittelbach * ltspace.dtx (subsection{Horizontal space (and breaks)}): - We start with \hspace with \leavevmode in case it starts the paragraph. + We use a private register instead of a group with \hspace in case it + starts the paragraph. Otherwise \everypar and friends will be executed inside a group (gh/967) 2022-11-28 Frank Mittelbach diff --git a/base/ltspace.dtx b/base/ltspace.dtx index f9a956b8b..6147bea64 100644 --- a/base/ltspace.dtx +++ b/base/ltspace.dtx @@ -1268,12 +1268,14 @@ %\IncludeInRelease{2020/10/01}% % {\@hspace}{Support calc with \hspace}% % \end{macrocode} -% We start with \cs{leavevmode} in case the \cs{hspace} starts the paragraph. -% Otherwise \cs{everypar} etc.\ will end up inside the group. This is a bug fix so +% We use a private register to calculate the space (if \pkg{calc} is used). Previously +% we used a group but that results in +% \cs{everypar} etc.\ being executed inside the group if the \cs{hspace} starts a paragraph. +% This is a bug fix so % we do not provide rollback to the incorrect intermediate version. % \begin{macrocode} -\def\@hspace#1{\leavevmode - \begingroup\setlength\skip@{#1}\hskip\skip@\endgroup} +\newskip\hsp@ce@skip +\def\@hspace#1{\setlength\hsp@ce@skip{#1}\hskip\hsp@ce@skip} % %\EndIncludeInRelease % \end{macrocode}