diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3prg.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3prg.dtx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/macros/latex/contrib/l3kernel/l3prg.dtx b/macros/latex/contrib/l3kernel/l3prg.dtx index 972e417998..eedb4f271a 100644 --- a/macros/latex/contrib/l3kernel/l3prg.dtx +++ b/macros/latex/contrib/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-05-07} +% \date{Released 2021-05-11} % % \maketitle % @@ -1620,7 +1620,7 @@ % \TeX{}'s alignment structures present many problems. As Knuth says % himself in \emph{\TeX : The Program}: \enquote{It's sort of a miracle % whenever \tn{halign} or \tn{valign} work, [\ldots]} One problem relates -% to commands that internally issues a \tn{cr} but also peek ahead for +% to commands that internally issue a \tn{cr} but also peek ahead for % the next character for use in, say, an optional argument. If the % next token happens to be a |&| with category code~4 we get some % sort of weird error message because the underlying @@ -1631,14 +1631,21 @@ % special group so that \TeX{} still thinks it's on safe ground but at % the same time we don't want to introduce any brace group that may % find its way to the output. The following functions help with this -% by using code documented only in Appendix~D of +% by using behaviour documented only in Appendix~D of % \emph{The \TeX{}book}\dots +% In short evaluating |`{| and |`}| as numbers will not change the counter +% \TeX{} uses to keep track of its state in an alignment, whereas gobbling a +% brace using \cs{if_false:} will affect \TeX's state without producing any +% real group. % We place the \cs{if_false:} |{| \cs{fi:} part at that place so % that the successive expansions of \cs{group_align_safe_begin/end:} % are always brace balanced. % \begin{macrocode} +\group_begin: +\tex_catcode:D `\^^@ = 2 \exp_stop_f: \cs_new:Npn \group_align_safe_begin: - { \if_int_compare:w \if_false: { \fi: `} = \c_zero_int \fi: } + { \exp:w \if_false: { \fi: `^^@ \exp_stop_f: } +\group_end: \cs_new:Npn \group_align_safe_end: { \if_int_compare:w `{ = \c_zero_int } \fi: } % \end{macrocode} |