[latex3-commits] [latex3/latex2e] gh1460: bit more code documentation (7dc1e471)
github at latex-project.org
github at latex-project.org
Tue Sep 10 23:11:31 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : gh1460
Link : https://github.com/latex3/latex2e/commit/7dc1e471f5f66752c8fd99d4d03df2ea7ed51dc8
>---------------------------------------------------------------
commit 7dc1e471f5f66752c8fd99d4d03df2ea7ed51dc8
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Tue Sep 10 23:11:31 2024 +0200
bit more code documentation
>---------------------------------------------------------------
7dc1e471f5f66752c8fd99d4d03df2ea7ed51dc8
base/changes.txt | 1 +
base/ltspace.dtx | 30 +++++++++++-------------------
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 30e6d2d0..46cc6f9a 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -11,6 +11,7 @@ not part of the distribution.
* ltspace.dtx (subsection{Vertical spacing}):
Drop unnecessary \@noitemerr in \addvspace and \addpenalty and
instead generate \@parmodeerr if we are in restricted hmode (gh/1460)
+ Also use \protected definitions for them.
2024-09-03 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
* fontdef.dtx: preload t1cmss.fd and t1cmtt.fd
diff --git a/base/ltspace.dtx b/base/ltspace.dtx
index d55b36db..774357e4 100644
--- a/base/ltspace.dtx
+++ b/base/ltspace.dtx
@@ -833,25 +833,6 @@
% heading commands to inhibit page breaking after a heading.)
%
%
-%\begin{verbatim}
-% \addvspace{SKIP} ==
-% BEGIN
-% if vmode
-% then if @minipage
-% else if \lastskip =0
-% then \vskip SKIP
-% else if \lastskip < SKIP
-% then \vskip -\lastskip
-% \vskip SKIP
-% else if SKIP < 0 and \lastskip >= 0
-% then \vskip -\lastskip
-% \vskip \lastskip + SKIP
-% fi fi fi fi
-% else useful error message (CAR).
-% fi
-% END
-%\end{verbatim}
-%
% \begin{macro}{\@xaddvskip}
% Internal macro for |\vspace| handling the case that space has
% previously been added.
@@ -888,6 +869,13 @@
%<latexrelease>\IncludeInRelease{2024/11/01}%
%<latexrelease> {\addvspace}{drop unnecessary no-item error}%
\protected\def\addvspace#1{%
+% \end{macrocode}
+% If encounter in hmode we check if we are in an hbox and if so
+% generate a \LaTeX{} error, as otherwise this would cause a bunch
+% of low-level errors. In unrestricted hmode we simply switch to vmode by
+% issuing a \cs{par}.
+% would
+% \begin{macrocode}
\ifhmode \ifinner \@parmoderr \else \par \fi \fi
% \end{macrocode}
%
@@ -960,6 +948,10 @@
% \end{macrocode}
% \begin{macrocode}
\protected\def\addpenalty#1{%
+% \end{macrocode}
+% See documentation of \cs{addvspace} for documentation of the next
+% line of code.
+% \begin{macrocode}
\ifhmode \ifinner \@parmoderr \else \par \fi \fi
% \end{macrocode}
% Fix provided by Donald (though the original fix was not good
More information about the latex3-commits
mailing list.