Skip to content

Commit

Permalink
Insert correct defaults in end-of-environment code (see #712)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Dec 2, 2021
1 parent 8b29d22 commit 9ab0b7e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 5 deletions.
8 changes: 7 additions & 1 deletion base/changes.txt
Expand Up @@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================

2021-12-02 Joseph Wright <Joseph.Wright@latex-project.org>

* ltcmd.dtx
Insert correct default values for optional arguments into the end
of environments

2021-11-17 Marcel Krüger <Marcel.Krueger@latex-project.org>

* ltluatex.dtx:
Expand Down Expand Up @@ -167,7 +173,7 @@ All changes above are only part of the development branch for the next release.
* ltluatex.dtx:
Define missing local copy of flush_list in ltluatex.lua found
by Michal Vlasák.

2021-08-10 Phelype Oleinik <phelype.oleinik@latex-project.org>

* ltvers.dtx (section{Version Identification}):
Expand Down
12 changes: 8 additions & 4 deletions base/ltcmd.dtx
Expand Up @@ -34,8 +34,8 @@
%%% From File: ltcmd.dtx
%
% \begin{macrocode}
\def\ltcmdversion{v1.0h}
\def\ltcmddate{2021-08-30}
\def\ltcmdversion{v1.0i}
\def\ltcmddate{2021-12-02}
% \end{macrocode}
%
%<*driver>
Expand Down Expand Up @@ -626,6 +626,8 @@
% \end{macro}
%
% \begin{macro}{\@@_start_aux:NNnnnn, \@@_start_aux:ccnnnn}
% \changes{v1.0i}{2021/12/02}
% {Correct defaults for optional arguments in end-of-environment code (gh/712)}
% This sets up a few variables to minimize the boilerplate code
% included in all \pkg{xparse}-defined commands. It then runs the
% grabbers~|#4|. Again, the argument specification |#1| is only for
Expand All @@ -639,15 +641,15 @@
\tl_set:Nn \l_@@_defaults_tl {#5}
\tl_set:Nn \l_@@_process_all_tl {#6}
#4
\bool_if:NT \l_@@_environment_bool
{ \exp_args:No \@@_set_environment_end:n \l_@@_environment_str }
\@@_run_code:
}
\cs_generate_variant:Nn \@@_start_aux:NNnnnn { cc }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_run_code:}
% \changes{v1.0i}{2021/12/02}
% {Correct defaults for optional arguments in end-of-environment code (gh/712)}
% After arguments are grabbed, this function is responsible for
% inserting default values, running processors, and finally doing
% \cs{group_align_safe_end:} as promised, and running the code.
Expand All @@ -656,6 +658,8 @@
{
\tl_if_empty:NF \l_@@_defaults_tl { \@@_defaults: }
\tl_if_empty:NF \l_@@_process_all_tl { \@@_args_process: }
\bool_if:NT \l_@@_environment_bool
{ \exp_args:No \@@_set_environment_end:n \l_@@_environment_str }
\group_align_safe_end:
\conditionally@traceon
\exp_after:wN \l_@@_fn_code_tl \l_@@_args_tl
Expand Down
18 changes: 18 additions & 0 deletions base/testfiles/github-0712.lvt
@@ -0,0 +1,18 @@
\documentclass{article}
\input{test2e}

\NewDocumentEnvironment{test}{O{x}}{#1}{#1}

\begin{document}

\START

\showoutput

\begin{test}
text
\end{test}

\newpage

\END
37 changes: 37 additions & 0 deletions base/testfiles/github-0712.tlg
@@ -0,0 +1,37 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\glue 16.0
.\vbox(617.0+0.0)x345.0, shifted 62.0
..\vbox(12.0+0.0)x345.0, glue set 12.0fil
...\glue 0.0 plus 1.0fil
...\hbox(0.0+0.0)x345.0
....\hbox(0.0+0.0)x345.0
..\glue 25.0
..\glue(\lineskip) 0.0
..\vbox(550.0+0.0)x345.0, glue set 539.94232fil
...\write-{}
...\glue(\topskip) 3.84921
...\hbox(6.15079+0.0)x345.0, glue set 295.2777fil
....\hbox(0.0+0.0)x15.0
....\OT1/cmr/m/n/10 x
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 t
....\OT1/cmr/m/n/10 e
....\OT1/cmr/m/n/10 x
....\OT1/cmr/m/n/10 t
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 x
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue 0.0 plus 1.0fil
...\glue 0.0
...\glue 0.0 plus 0.0001fil
..\glue(\baselineskip) 23.55556
..\hbox(6.44444+0.0)x345.0
...\hbox(6.44444+0.0)x345.0, glue set 170.0fil
....\glue 0.0 plus 1.0fil
....\OT1/cmr/m/n/10 1
....\glue 0.0 plus 1.0fil

0 comments on commit 9ab0b7e

Please sign in to comment.