diff options
author | Karl Berry <karl@freefriends.org> | 2017-05-14 22:40:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-05-14 22:40:58 +0000 |
commit | e0c5d6d38a1f285f20a66692e46d2e607d6ff1dd (patch) | |
tree | 977232bc088d27b46d9a6330c8f4f47aa98dbb78 /Master/texmf-dist/source/latex/l3kernel | |
parent | 4407d96af752e6e79a48c25c5189bd1a63fbd125 (diff) |
l3 (14may17)
git-svn-id: svn://tug.org/texlive/trunk@44351 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel')
46 files changed, 1240 insertions, 982 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index c9de1d0f8b7..eaee0f7a59d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2017/04/01}% +\def\ExplFileDate{2017/05/13}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -1292,11 +1292,9 @@ \sys_if_output_pdf:TF { pdfmode } { - \bool_if:nTF - { - \sys_if_engine_pdftex_p: || - \sys_if_engine_luatex_p: - } + \bool_lazy_or:nnTF + { \sys_if_engine_pdftex_p: } + { \sys_if_engine_luatex_p: } { dvips } { dvipdfmx } } @@ -1417,7 +1415,7 @@ % \begin{macro} % { % \box_rotate:Nn, -% \box_resize:Nnn, +% \box_resize_to_wd_and_ht_plus_dp:Nnn, % \box_resize_to_ht_plus_dp:Nn, % \box_resize_to_wd:Nn, % \box_scale:Nnn @@ -1444,7 +1442,7 @@ } \cs_set_protected:Npn \box_rotate:Nn #1#2 { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } - \cs_set_protected:Npn \box_resize:Nnn #1#2#3 + \cs_set_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3 { \hbox_set:Nn #1 { @@ -1470,15 +1468,13 @@ { \box_use:N #1 } } } - \cs_set_protected:Npn \box_scale:Nnn #1#2#3 + \cs_set_protected:Npn \__box_scale_aux:N #1 { - \hbox_set:Nn #1 - { - \exp_last_unbraced:Nx \scalebox - { { \fp_eval:n {#2} } [ \fp_eval:n {#3} ] } - { \box_use:N #1 } - } + \exp_last_unbraced:Nx \scalebox + { { \fp_use:N \l__box_scale_x_fp } [ \fp_use:N \l__box_scale_y_fp ] } + { \box_use:N #1 } } + \cs_set_protected:Npn \color_ensure_current: { \set@color } } % \end{macrocode} % \end{macro} @@ -1678,11 +1674,6 @@ % \end{macrocode} % \end{macro} % -% Deactivate writing module information to the log. -% \begin{macrocode} -\protected\def\GetIdInfoLog{} -% \end{macrocode} -% % For driver loading in generic mode, there are no options: pick the most % appropriate case! To allow this loading to take place a temporary % definition of \cs{ProvidesExplFile} is provided diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 078f3016465..1e94b66f730 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 3310d9336f2..7b895ee75d0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 5001f7340af..db8e9826e3b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|package> -% \begin{macro}[deprecated = 2017-03-19]{\GetIdInfo} +% \begin{macro}{\GetIdInfo} % \begin{macro}[aux]{\GetIdInfoAuxI, \GetIdInfoAuxII, \GetIdInfoAuxIII} % The idea here is to extract out the information needed from a standard % \textsc{svn} \texttt{Id} line, but without a line that will get @@ -139,7 +139,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -187,11 +187,30 @@ % the package identifier line. % \end{function} % +% \begin{function}[updated = 2012-06-04]{\GetIdInfo} +% \begin{syntax} +% |\RequirePackage{l3bootstrap}| +% \cs{GetIdInfo} |$Id:| \meta{SVN info field} |$| \Arg{description} +% \end{syntax} +% Extracts all information from a SVN field. Spaces are not +% ignored in these fields. The information pieces are stored in +% separate control sequences with \cs{ExplFileName} for the part of the +% file name leading up to the period, \cs{ExplFileDate} for date, +% \cs{ExplFileVersion} for version and \cs{ExplFileDescription} for the +% description. +% \end{function} +% % To summarize: Every single package using this syntax should identify % itself using one of the above methods. Special care is taken so that % every package or class file loaded with \tn{RequirePackage} or similar % are loaded with usual \LaTeXe{} category codes and the \LaTeX3 category code -% scheme is reloaded when needed afterwards. +% scheme is reloaded when needed afterwards. See implementation for +% details. If you use the \cs{GetIdInfo} command you can use the +% information when loading a package with +% \begin{verbatim} +% \ProvidesExplPackage{\ExplFileName} +% {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% \end{verbatim} % % \subsection{Internal functions and variables} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index edbf6b7b652..b7ac16ab656 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -335,9 +335,14 @@ % group levels. % \end{function} % +% \section{Boxes and color} +% +% All \LaTeX{}3 boxes are \enquote{color safe}: a color set inside the box +% will not apply after the end of the box has occurred. +% % \section{Horizontal mode boxes} % -% \begin{function}{\hbox:n} +% \begin{function}[updated = 2017-04-05]{\hbox:n} % \begin{syntax} % \cs{hbox:n} \Arg{contents} % \end{syntax} @@ -345,7 +350,7 @@ % width and then includes this box in the current list for typesetting. % \end{function} % -% \begin{function}{\hbox_to_wd:nn} +% \begin{function}[updated = 2017-04-05]{\hbox_to_wd:nn} % \begin{syntax} % \cs{hbox_to_wd:nn} \Arg{dimexpr} \Arg{contents} % \end{syntax} @@ -354,7 +359,7 @@ % typesetting. % \end{function} % -% \begin{function}{\hbox_to_zero:n} +% \begin{function}[updated = 2017-04-05]{\hbox_to_zero:n} % \begin{syntax} % \cs{hbox_to_zero:n} \Arg{contents} % \end{syntax} @@ -362,7 +367,8 @@ % and then includes this box in the current list for typesetting. % \end{function} % -% \begin{function}{\hbox_set:Nn, \hbox_set:cn, \hbox_gset:Nn, \hbox_gset:cn} +% \begin{function}[updated = 2017-04-05] +% {\hbox_set:Nn, \hbox_set:cn, \hbox_gset:Nn, \hbox_gset:cn} % \begin{syntax} % \cs{hbox_set:Nn} \meta{box} \Arg{contents} % \end{syntax} @@ -370,7 +376,7 @@ % result inside the \meta{box}. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2017-04-05] % { % \hbox_set_to_wd:Nnn, \hbox_set_to_wd:cnn, % \hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn @@ -382,7 +388,7 @@ % and then stores the result inside the \meta{box}. % \end{function} % -% \begin{function}{\hbox_overlap_right:n} +% \begin{function}[updated = 2017-04-05]{\hbox_overlap_right:n} % \begin{syntax} % \cs{hbox_overlap_right:n} \Arg{contents} % \end{syntax} @@ -391,7 +397,7 @@ % point. % \end{function} % -% \begin{function}{\hbox_overlap_left:n} +% \begin{function}[updated = 2017-04-05]{\hbox_overlap_left:n} % \begin{syntax} % \cs{hbox_overlap_left:n} \Arg{contents} % \end{syntax} @@ -400,7 +406,7 @@ % point. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2017-04-05] % { % \hbox_set:Nw, \hbox_set:cw, % \hbox_set_end:, @@ -451,18 +457,15 @@ % is that of the first item added. These tend to have a large depth and % small height, although the latter will typically be non-zero. % -% \begin{function}[updated = 2011-12-18]{\vbox:n} +% \begin{function}[updated = 2017-04-05]{\vbox:n} % \begin{syntax} % \cs{vbox:n} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} into a vertical box of natural height % and includes this box in the current list for typesetting. -% \begin{texnote} -% This is the \TeX{} primitive \tn{vbox}. -% \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-12-18]{\vbox_top:n} +% \begin{function}[updated = 2017-04-05]{\vbox_top:n} % \begin{syntax} % \cs{vbox_top:n} \Arg{contents} % \end{syntax} @@ -470,12 +473,9 @@ % and includes this box in the current list for typesetting. The % baseline of the box will be equal to that of the \emph{first} % item added to the box. -% \begin{texnote} -% This is the \TeX{} primitive \tn{vtop}. -% \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-12-18]{\vbox_to_ht:nn} +% \begin{function}[updated = 2017-04-05]{\vbox_to_ht:nn} % \begin{syntax} % \cs{vbox_to_ht:nn} \Arg{dimexpr} \Arg{contents} % \end{syntax} @@ -484,7 +484,7 @@ % typesetting. % \end{function} % -% \begin{function}[updated = 2011-12-18]{\vbox_to_zero:n} +% \begin{function}[updated = 2017-04-05]{\vbox_to_zero:n} % \begin{syntax} % \cs{vbox_to_zero:n} \Arg{contents} % \end{syntax} @@ -492,7 +492,7 @@ % and then includes this box in the current list for typesetting. % \end{function} % -% \begin{function}[updated = 2011-12-18] +% \begin{function}[updated = 2017-04-05] % {\vbox_set:Nn, \vbox_set:cn, \vbox_gset:Nn, \vbox_gset:cn} % \begin{syntax} % \cs{vbox_set:Nn} \meta{box} \Arg{contents} @@ -501,7 +501,7 @@ % result inside the \meta{box}. % \end{function} % -% \begin{function}[updated = 2011-12-18] +% \begin{function}[updated = 2017-04-05] % {\vbox_set_top:Nn, \vbox_set_top:cn, \vbox_gset_top:Nn, \vbox_gset_top:cn} % \begin{syntax} % \cs{vbox_set_top:Nn} \meta{box} \Arg{contents} @@ -511,7 +511,7 @@ % to that of the \emph{first} item added to the box. % \end{function} % -% \begin{function}[updated = 2011-12-18] +% \begin{function}[updated = 2017-04-05] % { % \vbox_set_to_ht:Nnn, \vbox_set_to_ht:cnn, % \vbox_gset_to_ht:Nnn, \vbox_gset_to_ht:cnn @@ -523,7 +523,7 @@ % \meta{dimexpr} and then stores the result inside the \meta{box}. % \end{function} % -% \begin{function}[updated = 2011-12-18] +% \begin{function}[updated = 2017-04-058] % { % \vbox_set:Nw, \vbox_set:cw, % \vbox_set_end:, @@ -575,6 +575,162 @@ % \end{texnote} % \end{function} % +% \subsection{Affine transformations} +% +% Affine transformations are changes which (informally) preserve straight +% lines. Simple translations are affine transformations, but are better handled +% in \TeX{} by doing the translation first, then inserting an unmodified box. +% On the other hand, rotation and resizing of boxed material can best be +% handled by modifying boxes. These transformations are described here. +% +% \begin{function}[added = 2017-04-04] +% {\box_autosize_to_wd_and_ht:Nnn, \box_autosize_to_wd_and_ht:Nnn} +% \begin{syntax} +% \cs{box_autosize_to_wd_and_ht:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to fit within the given \meta{x-size} (horizontally) +% and \meta{y-size} (vertically); both of the sizes are dimension +% expressions. The \meta{y-size} is the height only: it does not include any +% depth. The updated \meta{box} will be an |hbox|, irrespective of the nature +% of the \meta{box} before the resizing is applied. The final size of the +% \meta{box} will be the smaller of \Arg{x-size} and \Arg{y-size}, +% \emph{i.e.}~the result will fit within the dimensions specified. Negative +% sizes will cause the material in the \meta{box} to be reversed in direction, +% but the reference point of the \meta{box} will be unchanged. Thus a negative +% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% height of the original and \emph{vice versa}. The resizing applies within +% the current \TeX{} group level. +% \end{function} +% +% \begin{function}[added = 2017-04-04] +% {\box_autosize_to_wd_and_ht_plus_dp:Nnn, \box_autosize_to_wd_and_ht_plus_dp:Nnn} +% \begin{syntax} +% \cs{box_autosize_to_wd_and_ht_plus_dp:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to fit within the given \meta{x-size} (horizontally) +% and \meta{y-size} (vertically); both of the sizes are dimension +% expressions. The \meta{y-size} is the total vertical size (height plus +% depth). The updated \meta{box} will be an |hbox|, irrespective of the nature +% of the \meta{box} before the resizing is applied. The final size of the +% \meta{box} will be the smaller of \Arg{x-size} and \Arg{y-size}, +% \emph{i.e.}~the result will fit within the dimensions specified. Negative +% sizes will cause the material in the \meta{box} to be reversed in direction, +% but the reference point of the \meta{box} will be unchanged. Thus a negative +% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% height of the original and \emph{vice versa}. The resizing applies within +% the current \TeX{} group level. +% \end{function} +% +% \begin{function} +% {\box_resize_to_ht:Nn, \box_resize_to_ht:cn} +% \begin{syntax} +% \cs{box_resize_to_ht:Nn} \meta{box} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to \meta{y-size} (vertically), scaling the horizontal +% size by the same amount; \meta{y-size} is a dimension expression. The +% \meta{y-size} is the height only: it does not include any depth. The updated +% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{y-size} will cause the +% material in the \meta{box} to be reversed in direction, but the reference +% point of the \meta{box} will be unchanged. Thus a negative \meta{y-size} +% will result in the \meta{box} having a depth dependent on the height of the +% original and \emph{vice versa}. The resizing applies within the current +% \TeX{} group level. +% \end{function} +% +% \begin{function} +% {\box_resize_to_ht_plus_dp:Nn, \box_resize_to_ht_plus_dp:cn} +% \begin{syntax} +% \cs{box_resize_to_ht_plus_dp:Nn} \meta{box} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to \meta{y-size} (vertically), scaling the horizontal +% size by the same amount; \meta{y-size} is a dimension expression. The +% \meta{y-size} is the total vertical size (height plus depth). The updated +% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{y-size} will cause +% the material in the \meta{box} to be reversed in direction, but the +% reference point of the \meta{box} will be unchanged. Thus a negative +% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% height of the original and \emph{vice versa}. The resizing applies within +% the current \TeX{} group level. +% \end{function} +% +% \begin{function}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} +% \begin{syntax} +% \cs{box_resize_to_wd:Nn} \meta{box} \Arg{x-size} +% \end{syntax} +% Resizes the \meta{box} to \meta{x-size} (horizontally), scaling the vertical +% size by the same amount; \meta{x-size} is a dimension expression. The updated +% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{x-size} will cause the +% material in the \meta{box} to be reversed in direction, but the reference +% point of the \meta{box} will be unchanged. Thus a negative \meta{x-size} +% will result in the \meta{box} having a depth dependent on the height of the +% original and \emph{vice versa}. The resizing applies within the current +% \TeX{} group level. +% \end{function} +% +% \begin{function}[added = 2014-07-03] +% {\box_resize_to_wd_and_ht:Nnn, \box_resize_to_wd_and_ht:cnn} +% \begin{syntax} +% \cs{box_resize_to_wd_and_ht:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to \meta{x-size} (horizontally) and \meta{y-size} +% (vertically): both of the sizes are dimension expressions. The +% \meta{y-size} is the height only and does not include any depth. The updated +% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. Negative sizes will cause the material in +% the \meta{box} to be reversed in direction, but the reference point of the +% \meta{box} will be unchanged. Thus a negative \meta{y-size} will result in +% the \meta{box} having a depth dependent on the height of the original and +% \emph{vice versa}. The resizing applies within the current \TeX{} group +% level. +% \end{function} +% +% \begin{function}[added = 2017-04-06] +% {\box_resize_to_wd_and_ht_plus_dp:Nnn, \box_resize_to_wd_and_ht_plus_dp:cnn} +% \begin{syntax} +% \cs{box_resize_to_wd_and_ht_plus_dp:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} +% \end{syntax} +% Resizes the \meta{box} to \meta{x-size} (horizontally) and \meta{y-size} +% (vertically): both of the sizes are dimension expressions. The +% \meta{y-size} is the total vertical size (height plus depth). The updated +% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. Negative sizes will cause the material in +% the \meta{box} to be reversed in direction, but the reference point of the +% \meta{box} will be unchanged. Thus a negative \meta{y-size} will result in +% the \meta{box} having a depth dependent on the height of the original and +% \emph{vice versa}. The resizing applies within the current \TeX{} group +% level. +% \end{function} +% +% \begin{function}{\box_rotate:Nn, \box_rotate:cn} +% \begin{syntax} +% \cs{box_rotate:Nn} \meta{box} \Arg{angle} +% \end{syntax} +% Rotates the \meta{box} by \meta{angle} (in degrees) anti-clockwise about +% its reference point. The reference point of the updated box will be moved +% horizontally such that it is at the left side of the smallest rectangle +% enclosing the rotated material. The updated \meta{box} will be an |hbox|, +% irrespective of the nature of the \meta{box} before the rotation is applied. +% The rotation applies within the current \TeX{} group level. +% \end{function} +% +% \begin{function}{\box_scale:Nnn, \box_scale:cnn} +% \begin{syntax} +% \cs{box_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale} +% \end{syntax} +% Scales the \meta{box} by factors \meta{x-scale} and \meta{y-scale} in +% the horizontal and vertical directions, respectively (both scales are +% integer expressions). The updated \meta{box} will be an |hbox|, irrespective +% of the nature of the \meta{box} before the scaling is applied. Negative +% scalings will cause the material in the \meta{box} to be reversed in +% direction, but the reference point of the \meta{box} will be unchanged. +% Thus a negative \meta{y-scale} will result in the \meta{box} having a depth +% dependent on the height of the original and \emph{vice versa}. The resizing +% applies within the current \TeX{} group level. +% \end{function} +% % \section{Primitive box conditionals} % % \begin{function}[EXP]{\if_hbox:N} @@ -976,7 +1132,8 @@ % \testfile{m3box002.lvt} % Put a horizontal box directly into the input stream. % \begin{macrocode} -\cs_new_protected:Npn \hbox:n #1 { \tex_hbox:D \scan_stop: {#1} } +\cs_new_protected:Npn \hbox:n #1 + { \tex_hbox:D \scan_stop: { \group_begin: #1 \group_end: } } % \end{macrocode} % \end{macro} % @@ -985,7 +1142,7 @@ % \testfile* % \begin{macrocode} \cs_new_protected:Npn \hbox_set:Nn #1#2 - { \tex_setbox:D #1 \tex_hbox:D {#2} } + { \tex_setbox:D #1 \tex_hbox:D { \group_begin: #2 \group_end: } } \cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn } \cs_generate_variant:Nn \hbox_set:Nn { c } \cs_generate_variant:Nn \hbox_gset:Nn { c } @@ -999,7 +1156,10 @@ % Storing material in a horizontal box with a specified width. % \begin{macrocode} \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 - { \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: {#3} } + { + \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: + { \group_begin: #3 \group_end: } + } \cs_new_protected:Npn \hbox_gset_to_wd:Nnn { \tex_global:D \hbox_set_to_wd:Nnn } \cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c } @@ -1016,13 +1176,21 @@ % environment definitions. % \begin{macrocode} \cs_new_protected:Npn \hbox_set:Nw #1 - { \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token } + { + \tex_setbox:D #1 \tex_hbox:D + \c_group_begin_token + \group_begin: + } \cs_new_protected:Npn \hbox_gset:Nw { \tex_global:D \hbox_set:Nw } \cs_generate_variant:Nn \hbox_set:Nw { c } \cs_generate_variant:Nn \hbox_gset:Nw { c } -\cs_new_eq:NN \hbox_set_end: \c_group_end_token -\cs_new_eq:NN \hbox_gset_end: \c_group_end_token +\cs_new_protected:Npn \hbox_set_end: + { + \group_end: + \c_group_end_token + } +\cs_new_eq:NN \hbox_gset_end: \hbox_set_end: % \end{macrocode} % \end{macro} % \end{macro} @@ -1034,8 +1202,12 @@ % Put a horizontal box directly into the input stream. % \begin{macrocode} \cs_new_protected:Npn \hbox_to_wd:nn #1#2 - { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: {#2} } -\cs_new_protected:Npn \hbox_to_zero:n #1 { \tex_hbox:D to \c_zero_dim {#1} } + { + \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: + { \group_begin: #2 \group_end: } + } +\cs_new_protected:Npn \hbox_to_zero:n #1 + { \tex_hbox:D to \c_zero_dim { \group_begin: #1 \group_end: } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1076,8 +1248,10 @@ % \TestFiles{m3box003.lvt} % Put a vertical box directly into the input stream. % \begin{macrocode} -\cs_new_protected:Npn \vbox:n #1 { \tex_vbox:D { #1 \par } } -\cs_new_protected:Npn \vbox_top:n #1 { \tex_vtop:D { #1 \par } } +\cs_new_protected:Npn \vbox:n #1 + { \tex_vbox:D { \group_begin: #1 \par \group_end: } } +\cs_new_protected:Npn \vbox_top:n #1 + { \tex_vtop:D { \group_begin: #1 \par \group_end: } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1088,9 +1262,15 @@ % Put a vertical box directly into the input stream. % \begin{macrocode} \cs_new_protected:Npn \vbox_to_ht:nn #1#2 - { \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end: { #2 \par } } + { + \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end: + { \group_begin: #2 \par \group_end: } + } \cs_new_protected:Npn \vbox_to_zero:n #1 - { \tex_vbox:D to \c_zero_dim { #1 \par } } + { + \tex_vbox:D to \c_zero_dim + { \group_begin: #1 \par \group_end: } + } % \end{macrocode} % \end{macro} % \end{macro} @@ -1101,7 +1281,10 @@ % Storing material in a vertical box with a natural height. % \begin{macrocode} \cs_new_protected:Npn \vbox_set:Nn #1#2 - { \tex_setbox:D #1 \tex_vbox:D { #2 \par } } + { + \tex_setbox:D #1 \tex_vbox:D + { \group_begin: #2 \par \group_end: } + } \cs_new_protected:Npn \vbox_gset:Nn { \tex_global:D \vbox_set:Nn } \cs_generate_variant:Nn \vbox_set:Nn { c } \cs_generate_variant:Nn \vbox_gset:Nn { c } @@ -1116,7 +1299,10 @@ % point at the baseline of the first object in the box. % \begin{macrocode} \cs_new_protected:Npn \vbox_set_top:Nn #1#2 - { \tex_setbox:D #1 \tex_vtop:D { #2 \par } } + { + \tex_setbox:D #1 \tex_vtop:D + { \group_begin: #2 \par \group_end: } + } \cs_new_protected:Npn \vbox_gset_top:Nn { \tex_global:D \vbox_set_top:Nn } \cs_generate_variant:Nn \vbox_set_top:Nn { c } @@ -1133,7 +1319,7 @@ \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 { \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: - { #3 \par } + { \group_begin: #3 \par \group_end: } } \cs_new_protected:Npn \vbox_gset_to_ht:Nnn { \tex_global:D \vbox_set_to_ht:Nnn } @@ -1151,14 +1337,19 @@ % environment definitions. % \begin{macrocode} \cs_new_protected:Npn \vbox_set:Nw #1 - { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token } + { + \tex_setbox:D #1 \tex_vbox:D + \c_group_begin_token + \group_begin: + } \cs_new_protected:Npn \vbox_gset:Nw { \tex_global:D \vbox_set:Nw } \cs_generate_variant:Nn \vbox_set:Nw { c } \cs_generate_variant:Nn \vbox_gset:Nw { c } \cs_new_protected:Npn \vbox_set_end: { - \par + \par + \group_end: \c_group_end_token } \cs_new_eq:NN \vbox_gset_end: \vbox_set_end: @@ -1189,6 +1380,550 @@ % \end{macrocode} % \end{macro} % +% \subsection{Affine transformations} +% +% \begin{variable}{\l_@@_angle_fp} +% When rotating boxes, the angle itself may be needed by the +% engine-dependent code. This is done using the \pkg{fp} module so +% that the value is tidied up properly. +% \begin{macrocode} +\fp_new:N \l_@@_angle_fp +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp} +% These are used to hold the calculated sine and cosine values while +% carrying out a rotation. +% \begin{macrocode} +\fp_new:N \l_@@_cos_fp +\fp_new:N \l_@@_sin_fp +% \end{macrocode} +% \end{variable} +% +% \begin{variable} +% {\l_@@_top_dim, \l_@@_bottom_dim, \l_@@_left_dim, \l_@@_right_dim} +% These are the positions of the four edges of a box before +% manipulation. +% \begin{macrocode} +\dim_new:N \l_@@_top_dim +\dim_new:N \l_@@_bottom_dim +\dim_new:N \l_@@_left_dim +\dim_new:N \l_@@_right_dim +% \end{macrocode} +% \end{variable} +% +% \begin{variable} +% { +% \l_@@_top_new_dim, \l_@@_bottom_new_dim , +% \l_@@_left_new_dim, \l_@@_right_new_dim +% } +% These are the positions of the four edges of a box after +% manipulation. +% \begin{macrocode} +\dim_new:N \l_@@_top_new_dim +\dim_new:N \l_@@_bottom_new_dim +\dim_new:N \l_@@_left_new_dim +\dim_new:N \l_@@_right_new_dim +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_internal_box} +% Scratch space, but also needed by some parts of the driver. +% \begin{macrocode} +\box_new:N \l_@@_internal_box +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\box_rotate:Nn} +% \begin{macro}[aux]{\@@_rotate:N} +% \begin{macro}[aux]{\@@_rotate_x:nnN, \@@_rotate_y:nnN} +% \begin{macro}[aux] +% { +% \@@_rotate_quadrant_one:, \@@_rotate_quadrant_two:, +% \@@_rotate_quadrant_three:, \@@_rotate_quadrant_four: +% } +% Rotation of a box starts with working out the relevant sine and +% cosine. The actual rotation is in an auxiliary to keep the flow slightly +% clearer +% \begin{macrocode} +\cs_new_protected:Npn \box_rotate:Nn #1#2 + { + \hbox_set:Nn #1 + { + \fp_set:Nn \l_@@_angle_fp {#2} + \fp_set:Nn \l_@@_sin_fp { sind ( \l_@@_angle_fp ) } + \fp_set:Nn \l_@@_cos_fp { cosd ( \l_@@_angle_fp ) } + \@@_rotate:N #1 + } + } +% \end{macrocode} +% The edges of the box are then recorded: the left edge will +% always be at zero. Rotation of the four edges then takes place: this is +% most efficiently done on a quadrant by quadrant basis. +% \begin{macrocode} +\cs_new_protected:Npn \@@_rotate:N #1 + { + \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } + \dim_zero:N \l_@@_left_dim +% \end{macrocode} +% The next step is to work out the $x$ and $y$ coordinates of vertices of +% the rotated box in relation to its original coordinates. The box can be +% visualized with vertices $B$, $C$, $D$ and $E$ is illustrated +% (Figure~\ref{fig:l3candidates:rotation}). The vertex $O$ is the reference point +% on the baseline, and in this implementation is also the centre of rotation. +% \begin{figure} +% \centering +% \setlength{\unitlength}{3pt}^^A +% \begin{picture}(34,36)(12,44) +% \thicklines +% \put(20,52){\dashbox{1}(20,21){}} +% \put(20,80){\line(0,-1){36}} +% \put(12,58){\line(1, 0){34}} +% \put(41,59){A} +% \put(40,74){B} +% \put(21,74){C} +% \put(21,49){D} +% \put(40,49){E} +% \put(21,59){O} +% \end{picture} +% \caption{Co-ordinates of a box prior to rotation.} +% \label{fig:l3candidates:rotation} +% \end{figure} +% The formulae are, for a point $P$ and angle $\alpha$: +% \[ +% \begin{array}{l} +% P'_x = P_x - O_x \\ +% P'_y = P_y - O_y \\ +% P''_x = ( P'_x \cos(\alpha)) - ( P'_y \sin(\alpha) ) \\ +% P''_y = ( P'_x \sin(\alpha)) + ( P'_y \cos(\alpha) ) \\ +% P'''_x = P''_x + O_x + L_x \\ +% P'''_y = P''_y + O_y +% \end{array} +% \] +% The \enquote{extra} horizontal translation $L_x$ at the end is calculated +% so that the leftmost point of the resulting box has $x$-coordinate $0$. +% This is desirable as \TeX{} boxes must have the reference point at +% the left edge of the box. (As $O$ is always $(0,0)$, this part of the +% calculation is omitted here.) +% \begin{macrocode} + \fp_compare:nNnTF \l_@@_sin_fp > \c_zero_fp + { + \fp_compare:nNnTF \l_@@_cos_fp > \c_zero_fp + { \@@_rotate_quadrant_one: } + { \@@_rotate_quadrant_two: } + } + { + \fp_compare:nNnTF \l_@@_cos_fp < \c_zero_fp + { \@@_rotate_quadrant_three: } + { \@@_rotate_quadrant_four: } + } +% \end{macrocode} +% The position of the box edges are now known, but the box at this +% stage be misplaced relative to the current \TeX{} reference point. So the +% content of the box is moved such that the reference point of the +% rotated box will be in the same place as the original. +% \begin{macrocode} + \hbox_set:Nn \l_@@_internal_box { \box_use:N #1 } + \hbox_set:Nn \l_@@_internal_box + { + \tex_kern:D -\l_@@_left_new_dim + \hbox:n + { + \__driver_box_use_rotate:Nn + \l_@@_internal_box + \l_@@_angle_fp + } + } +% \end{macrocode} +% Tidy up the size of the box so that the material is actually inside +% the bounding box. The result can then be used to reset the original +% box. +% \begin{macrocode} + \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } + \box_set_dp:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } + \box_set_wd:Nn \l_@@_internal_box + { \l_@@_right_new_dim - \l_@@_left_new_dim } + \box_use:N \l_@@_internal_box + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% These functions take a general point $(|#1|, |#2|)$ and rotate its +% location about the origin, using the previously-set sine and cosine +% values. Each function gives only one component of the location of the +% updated point. This is because for rotation of a box each step needs +% only one value, and so performance is gained by avoiding working +% out both $x'$ and $y'$ at the same time. Contrast this with +% the equivalent function in the \pkg{l3coffins} module, where both parts +% are needed. +% \begin{macrocode} +\cs_new_protected:Npn \@@_rotate_x:nnN #1#2#3 + { + \dim_set:Nn #3 + { + \fp_to_dim:n + { + \l_@@_cos_fp * \dim_to_fp:n {#1} + - \l_@@_sin_fp * \dim_to_fp:n {#2} + } + } + } +\cs_new_protected:Npn \@@_rotate_y:nnN #1#2#3 + { + \dim_set:Nn #3 + { + \fp_to_dim:n + { + \l_@@_sin_fp * \dim_to_fp:n {#1} + + \l_@@_cos_fp * \dim_to_fp:n {#2} + } + } + } +% \end{macrocode} +% Rotation of the edges is done using a different formula for each +% quadrant. In every case, the top and bottom edges only need the +% resulting $y$-values, whereas the left and right edges need the +% $x$-values. Each case is a question of picking out which corner +% ends up at with the maximum top, bottom, left and right value. Doing +% this by hand means a lot less calculating and avoids lots of +% comparisons. +% \begin{macrocode} +\cs_new_protected:Npn \@@_rotate_quadrant_one: + { + \@@_rotate_y:nnN \l_@@_right_dim \l_@@_top_dim + \l_@@_top_new_dim + \@@_rotate_y:nnN \l_@@_left_dim \l_@@_bottom_dim + \l_@@_bottom_new_dim + \@@_rotate_x:nnN \l_@@_left_dim \l_@@_top_dim + \l_@@_left_new_dim + \@@_rotate_x:nnN \l_@@_right_dim \l_@@_bottom_dim + \l_@@_right_new_dim + } +\cs_new_protected:Npn \@@_rotate_quadrant_two: + { + \@@_rotate_y:nnN \l_@@_right_dim \l_@@_bottom_dim + \l_@@_top_new_dim + \@@_rotate_y:nnN \l_@@_left_dim \l_@@_top_dim + \l_@@_bottom_new_dim + \@@_rotate_x:nnN \l_@@_right_dim \l_@@_top_dim + \l_@@_left_new_dim + \@@_rotate_x:nnN \l_@@_left_dim \l_@@_bottom_dim + \l_@@_right_new_dim + } +\cs_new_protected:Npn \@@_rotate_quadrant_three: + { + \@@_rotate_y:nnN \l_@@_left_dim \l_@@_bottom_dim + \l_@@_top_new_dim + \@@_rotate_y:nnN \l_@@_right_dim \l_@@_top_dim + \l_@@_bottom_new_dim + \@@_rotate_x:nnN \l_@@_right_dim \l_@@_bottom_dim + \l_@@_left_new_dim + \@@_rotate_x:nnN \l_@@_left_dim \l_@@_top_dim + \l_@@_right_new_dim + } +\cs_new_protected:Npn \@@_rotate_quadrant_four: + { + \@@_rotate_y:nnN \l_@@_left_dim \l_@@_top_dim + \l_@@_top_new_dim + \@@_rotate_y:nnN \l_@@_right_dim \l_@@_bottom_dim + \l_@@_bottom_new_dim + \@@_rotate_x:nnN \l_@@_left_dim \l_@@_bottom_dim + \l_@@_left_new_dim + \@@_rotate_x:nnN \l_@@_right_dim \l_@@_top_dim + \l_@@_right_new_dim + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\l_@@_scale_x_fp, \l_@@_scale_y_fp} +% Scaling is potentially-different in the two axes. +% \begin{macrocode} +\fp_new:N \l_@@_scale_x_fp +\fp_new:N \l_@@_scale_y_fp +% \end{macrocode} +% \end{variable} +% +% \begin{macro} +% {\box_resize_to_wd_and_ht_plus_dp:Nnn, \box_resize_to_wd_and_ht_plus_dp:cnn} +% \begin{macro}[aux]{\@@_resize_set_corners:N} +% \begin{macro}[aux]{\@@_resize:N} +% \begin{macro}[aux]{\@@_resize:NNN} +% Resizing a box starts by working out the various dimensions of the +% existing box. +% \begin{macrocode} +\cs_new_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \@@_resize_set_corners:N #1 +% \end{macrocode} +% The $x$-scaling and resulting box size is easy enough to work +% out: the dimension is that given as |#2|, and the scale is simply the +% new width divided by the old one. +% \begin{macrocode} + \fp_set:Nn \l_@@_scale_x_fp + { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } +% \end{macrocode} +% The $y$-scaling needs both the height and the depth of the current box. +% \begin{macrocode} + \fp_set:Nn \l_@@_scale_y_fp + { + \dim_to_fp:n {#3} + / \dim_to_fp:n { \l_@@_top_dim - \l_@@_bottom_dim } + } +% \end{macrocode} +% Hand off to the auxiliary which does the rest of the work. +% \begin{macrocode} + \@@_resize:N #1 + } + } +\cs_generate_variant:Nn \box_resize_to_wd_and_ht_plus_dp:Nnn { c } +\cs_new_protected:Npn \@@_resize_set_corners:N #1 + { + \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } + \dim_zero:N \l_@@_left_dim + } +% \end{macrocode} +% With at least one real scaling to do, the next phase is to find the new +% edge co-ordinates. In the $x$~direction this is relatively easy: just +% scale the right edge. In the $y$~direction, both dimensions have to be +% scaled, and this again needs the absolute scale value. +% Once that is all done, the common resize/rescale code can be employed. +% \begin{macrocode} +\cs_new_protected:Npn \@@_resize:N #1 + { + \@@_resize:NNN \l_@@_right_new_dim + \l_@@_scale_x_fp \l_@@_right_dim + \@@_resize:NNN \l_@@_bottom_new_dim + \l_@@_scale_y_fp \l_@@_bottom_dim + \@@_resize:NNN \l_@@_top_new_dim + \l_@@_scale_y_fp \l_@@_top_dim + \@@_resize_common:N #1 + } +\cs_new_protected:Npn \@@_resize:NNN #1#2#3 + { + \dim_set:Nn #1 + { \fp_to_dim:n { \fp_abs:n { #2 } * \dim_to_fp:n { #3 } } } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\box_resize_to_ht:Nn, \box_resize_to_ht:cn} +% \begin{macro}{\box_resize_to_ht_plus_dp:Nn, \box_resize_to_ht_plus_dp:cn} +% \begin{macro}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} +% \begin{macro}{\box_resize_to_wd_and_ht:Nnn, \box_resize_to_wd_and_ht:cnn} +% Scaling to a (total) height or to a width is a simplified version of the main +% resizing operation, with the scale simply copied between the two parts. The +% internal auxiliary is called using the scaling value twice, as the sign for +% both parts is needed (as this allows the same internal code to be used as +% for the general case). +% \begin{macrocode} +\cs_new_protected:Npn \box_resize_to_ht:Nn #1#2 + { + \hbox_set:Nn #1 + { + \@@_resize_set_corners:N #1 + \fp_set:Nn \l_@@_scale_y_fp + { + \dim_to_fp:n {#2} + / \dim_to_fp:n { \l_@@_top_dim } + } + \fp_set_eq:NN \l_@@_scale_x_fp \l_@@_scale_y_fp + \@@_resize:N #1 + } + } +\cs_generate_variant:Nn \box_resize_to_ht:Nn { c } +\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \@@_resize_set_corners:N #1 + \fp_set:Nn \l_@@_scale_y_fp + { + \dim_to_fp:n {#2} + / \dim_to_fp:n { \l_@@_top_dim - \l_@@_bottom_dim } + } + \fp_set_eq:NN \l_@@_scale_x_fp \l_@@_scale_y_fp + \@@_resize:N #1 + } + } +\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } +\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \@@_resize_set_corners:N #1 + \fp_set:Nn \l_@@_scale_x_fp + { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } + \fp_set_eq:NN \l_@@_scale_y_fp \l_@@_scale_x_fp + \@@_resize:N #1 + } + } +\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } +\cs_new_protected:Npn \box_resize_to_wd_and_ht:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \@@_resize_set_corners:N #1 + \fp_set:Nn \l_@@_scale_x_fp + { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } + \fp_set:Nn \l_@@_scale_y_fp + { + \dim_to_fp:n {#3} + / \dim_to_fp:n { \l_@@_top_dim } + } + \@@_resize:N #1 + } + } +\cs_generate_variant:Nn \box_resize_to_wd_and_ht:Nnn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\box_scale:Nnn, \box_scale:cnn} +% \begin{macro}[aux]{\@@_scale_aux:N} +% When scaling a box, setting the scaling itself is easy enough. The +% new dimensions are also relatively easy to find, allowing only for +% the need to keep them positive in all cases. Once that is done then +% after a check for the trivial scaling a hand-off can be made to the +% common code. The code here is split into two as this allows sharing +% with the auto-resizing functions. +% \begin{macrocode} +\cs_new_protected:Npn \box_scale:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \fp_set:Nn \l_@@_scale_x_fp {#2} + \fp_set:Nn \l_@@_scale_y_fp {#3} + \@@_scale_aux:N #1 + } + } +\cs_generate_variant:Nn \box_scale:Nnn { c } +\cs_new_protected:Npn \@@_scale_aux:N #1 + { + \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } + \dim_zero:N \l_@@_left_dim + \dim_set:Nn \l_@@_top_new_dim + { \fp_abs:n { \l_@@_scale_y_fp } \l_@@_top_dim } + \dim_set:Nn \l_@@_bottom_new_dim + { \fp_abs:n { \l_@@_scale_y_fp } \l_@@_bottom_dim } + \dim_set:Nn \l_@@_right_new_dim + { \fp_abs:n { \l_@@_scale_x_fp } \l_@@_right_dim } + \@@_resize_common:N #1 + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% { +% \box_autosize_to_wd_and_ht:Nnn , +% \box_autosize_to_wd_and_ht:cnn , +% \box_autosize_to_wd_and_ht_plus_dp:cnn , +% \box_autosize_to_wd_and_ht_plus_dp:Nnn +% } +% \begin{macro}[aux]{\@@_autosize:Nnnn} +% Although autosizing a box uses dimensions, it has more in common in +% implementation with scaling. As such, most of the real work here is +% done elsewhere. +% \begin{macrocode} +\cs_new_protected:Npn \box_autosize_to_wd_and_ht:Nnn #1#2#3 + { \@@_autosize:Nnnn #1 {#2} {#3} { \box_ht:N #1 } } +\cs_generate_variant:Nn \box_autosize_to_wd_and_ht:Nnn { c } +\cs_new_protected:Npn \box_autosize_to_wd_and_ht_plus_dp:Nnn #1#2#3 + { \@@_autosize:Nnnn #1 {#2} {#3} { \box_ht:N #1 + \box_dp:N #1 } } +\cs_generate_variant:Nn \box_autosize_to_wd_and_ht_plus_dp:Nnn { c } +\cs_new_protected:Npn \@@_autosize:Nnnn #1#2#3#4 + { + \hbox_set:Nn #1 + { + \fp_set:Nn \l_@@_scale_x_fp { ( #2 ) / \box_wd:N #1 } + \fp_set:Nn \l_@@_scale_y_fp { ( #3 ) / ( #4 ) } + \fp_compare:nNnTF \l_@@_scale_x_fp > \l_@@_scale_y_fp + { \fp_set_eq:NN \l_@@_scale_x_fp \l_@@_scale_y_fp } + { \fp_set_eq:NN \l_@@_scale_y_fp \l_@@_scale_x_fp } + \@@_scale_aux:N #1 + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]{\@@_resize_common:N} +% The main resize function places in input into a box which will start +% of with zero width, and includes the handles for engine rescaling. +% \begin{macrocode} +\cs_new_protected:Npn \@@_resize_common:N #1 + { + \hbox_set:Nn \l_@@_internal_box + { + \__driver_box_use_scale:Nnn + #1 + \l_@@_scale_x_fp + \l_@@_scale_y_fp + } +% \end{macrocode} +% The new height and depth can be applied directly. +% \begin{macrocode} + \fp_compare:nNnTF \l_@@_scale_y_fp > \c_zero_fp + { + \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } + \box_set_dp:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } + } + { + \box_set_dp:Nn \l_@@_internal_box { \l_@@_top_new_dim } + \box_set_ht:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } + } +% \end{macrocode} +% Things are not quite as obvious for the width, as the reference point +% needs to remain unchanged. For positive scaling factors resizing the +% box is all that is needed. However, for case of a negative scaling +% the material must be shifted such that the reference point ends up in +% the right place. +% \begin{macrocode} + \fp_compare:nNnTF \l_@@_scale_x_fp < \c_zero_fp + { + \hbox_to_wd:nn { \l_@@_right_new_dim } + { + \tex_kern:D \l_@@_right_new_dim + \box_use:N \l_@@_internal_box + \tex_hss:D + } + } + { + \box_set_wd:Nn \l_@@_internal_box { \l_@@_right_new_dim } + \hbox:n + { + \tex_kern:D \c_zero_dim + \box_use:N \l_@@_internal_box + \tex_hss:D + } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Deprecated functions} +% +% \begin{macro}{\box_resize:Nnn, \box_resize:cnn} +% \begin{macrocode} +\cs_new_eq:NN \box_resize:Nnn \box_resize_to_wd_and_ht_plus_dp:Nnn +\cs_new_eq:NN \box_resize:cnn \box_resize_to_wd_and_ht_plus_dp:cnn +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index a96bc8c8f4e..627f4eba9e0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -84,125 +84,6 @@ % % \section{Additions to \pkg{l3box}} % -% \subsection{Affine transformations} -% -% Affine transformations are changes which (informally) preserve straight -% lines. Simple translations are affine transformations, but are better handled -% in \TeX{} by doing the translation first, then inserting an unmodified box. -% On the other hand, rotation and resizing of boxed material can best be -% handled by modifying boxes. These transformations are described here. -% -% \begin{function}{\box_resize:Nnn, \box_resize:cnn} -% \begin{syntax} -% \cs{box_resize:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} -% \end{syntax} -% Resize the \meta{box} to \meta{x-size} horizontally and \meta{y-size} -% vertically (both of the sizes are dimension expressions). -% The \meta{y-size} is the vertical size (height plus depth) of -% the box. The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the resizing is applied. Negative sizes will -% cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. -% Thus negative $y$-sizes will result in a box a depth dependent on the -% height of the original box a height dependent on the depth. -% The resizing applies within the current \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\box_resize_to_ht_plus_dp:Nn, \box_resize_to_ht_plus_dp:cn} -% \begin{syntax} -% \cs{box_resize_to_ht_plus_dp:Nn} \meta{box} \Arg{y-size} -% \end{syntax} -% Resize the \meta{box} to \meta{y-size} vertically, scaling the horizontal -% size by the same amount (\meta{y-size} is a dimension expression). -% The \meta{y-size} is the vertical size (height plus depth) of -% the box. -% The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the resizing is applied. A negative size will -% cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. -% Thus negative $y$-sizes will result in a box with depth dependent on the -% height of the original box and height dependent on the depth of the original. -% The resizing applies within the current \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\box_resize_to_ht:Nn, \box_resize_to_ht:cn} -% \begin{syntax} -% \cs{box_resize_to_ht:Nn} \meta{box} \Arg{y-size} -% \end{syntax} -% Resize the \meta{box} to \meta{y-size} vertically, scaling the horizontal -% size by the same amount (\meta{y-size} is a dimension expression). -% The \meta{y-size} is the height only, not including depth, of -% the box. -% The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the resizing is applied. -% A negative size will -% cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. -% Thus negative $y$-sizes will result in a box with depth dependent on the -% height of the original box and height dependent on the depth of the original. -% The resizing applies within the current \TeX{} group level. -% \end{function} -% -% \begin{function}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} -% \begin{syntax} -% \cs{box_resize_to_wd:Nn} \meta{box} \Arg{x-size} -% \end{syntax} -% Resize the \meta{box} to \meta{x-size} horizontally, scaling the vertical -% size by the same amount (\meta{x-size} is a dimension expression). -% The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the resizing is applied. A negative size will -% cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. -% Thus negative $y$-sizes will result in a box a depth dependent on the -% height of the original box a height dependent on the depth. -% The resizing applies within the current \TeX{} group level. -% \end{function} -% -% \begin{function}[added = 2014-07-03] -% {\box_resize_to_wd_and_ht:Nnn, \box_resize_to_wd_and_ht:cnn} -% \begin{syntax} -% \cs{box_resize_to_wd_and_ht:Nnn} \meta{box} \Arg{x-size} \Arg{y-size} -% \end{syntax} -% Resize the \meta{box} to a \emph{height} of -% \meta{x-size} horizontally and \meta{y-size} -% vertically (both of the sizes are dimension expressions). -% The \meta{y-size} is the \emph{height} of the box, ignoring any depth. -% The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the resizing is applied. Negative sizes will -% cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. -% \end{function} -% -% \begin{function}{\box_rotate:Nn, \box_rotate:cn} -% \begin{syntax} -% \cs{box_rotate:Nn} \meta{box} \Arg{angle} -% \end{syntax} -% Rotates the \meta{box} by \meta{angle} (in degrees) anti-clockwise about -% its reference point. The reference point of the updated box will be moved -% horizontally such that it is at the left side of the smallest rectangle -% enclosing the rotated material. -% The updated \meta{box} will be an hbox, irrespective of the nature -% of the \meta{box} before the rotation is applied. The rotation applies -% within the current \TeX{} group level. -% \end{function} -% -% \begin{function}{\box_scale:Nnn, \box_scale:cnn} -% \begin{syntax} -% \cs{box_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale} -% \end{syntax} -% Scales the \meta{box} by factors \meta{x-scale} and \meta{y-scale} in -% the horizontal and vertical directions, respectively (both scales are -% integer expressions). The updated \meta{box} will be an hbox, irrespective -% of the nature of the \meta{box} before the scaling is applied. Negative -% scalings will cause the material in the \meta{box} to be reversed in -% direction, but the reference point of the \meta{box} will be unchanged. -% Thus negative $y$-scales will result in a box a depth dependent on the -% height of the original box a height dependent on the depth. -% The resizing applies within the current \TeX{} group level. -% \end{function} -% % \subsection{Viewing part of a box} % % \begin{function}{\box_clip:N, \box_clip:c} @@ -592,6 +473,39 @@ % warning message of some sort. % \end{function} % +% \section{Additions to \pkg{l3sys}} +% +% \begin{function}[added = 2017-04-12, EXP, pTF]{\sys_if_rand_exist:} +% \begin{syntax} +% \cs{sys_if_rand_exist_p:} +% \cs{sys_if_rand_exist:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the engine has a pseudo-random number generator. Currently +% this is the case in \pdfTeX{} and \LuaTeX{}. +% \end{function} +% +% \begin{function}[added = 2017-04-12, EXP]{\sys_rand_seed:} +% \begin{syntax} +% \cs{sys_rand_seed:} +% \end{syntax} +% Expands to the current value of the engine's random seed, a +% non-negative integer. In engines without random number support this +% expands to $0$. +% \end{function} +% +% \begin{function}[added = 2017-04-12]{\sys_gset_rand_seed:n} +% \begin{syntax} +% \cs{sys_gset_rand_seed:n} \Arg{intexpr} +% \end{syntax} +% Sets the seed for the engine's pseudo-random number generator to the +% \meta{integer expression}. The assignment is global. This random +% seed affects all \cs[no-index]{\ldots{}_rand} functions (such as +% \cs{int_rand:nn} or \cs{clist_rand_item:n}) as well as other +% packages relying on the engine's random number generator. Currently +% only the absolute value of the seed is used. In engines without +% random number support this produces an error. +% \end{function} +% % \section{Additions to \pkg{l3tl}} % % \begin{function}[EXP,pTF]{\tl_if_single_token:n} @@ -947,515 +861,6 @@ %<@@=box> % \end{macrocode} % -% \subsection{Affine transformations} -% -% \begin{variable}{\l_@@_angle_fp} -% When rotating boxes, the angle itself may be needed by the -% engine-dependent code. This is done using the \pkg{fp} module so -% that the value is tidied up properly. -% \begin{macrocode} -\fp_new:N \l_@@_angle_fp -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp} -% These are used to hold the calculated sine and cosine values while -% carrying out a rotation. -% \begin{macrocode} -\fp_new:N \l_@@_cos_fp -\fp_new:N \l_@@_sin_fp -% \end{macrocode} -% \end{variable} -% -% \begin{variable} -% {\l_@@_top_dim, \l_@@_bottom_dim, \l_@@_left_dim, \l_@@_right_dim} -% These are the positions of the four edges of a box before -% manipulation. -% \begin{macrocode} -\dim_new:N \l_@@_top_dim -\dim_new:N \l_@@_bottom_dim -\dim_new:N \l_@@_left_dim -\dim_new:N \l_@@_right_dim -% \end{macrocode} -% \end{variable} -% -% \begin{variable} -% { -% \l_@@_top_new_dim, \l_@@_bottom_new_dim , -% \l_@@_left_new_dim, \l_@@_right_new_dim -% } -% These are the positions of the four edges of a box after -% manipulation. -% \begin{macrocode} -\dim_new:N \l_@@_top_new_dim -\dim_new:N \l_@@_bottom_new_dim -\dim_new:N \l_@@_left_new_dim -\dim_new:N \l_@@_right_new_dim -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_@@_internal_box} -% Scratch space, but also needed by some parts of the driver. -% \begin{macrocode} -\box_new:N \l_@@_internal_box -% \end{macrocode} -% \end{variable} -% -% \begin{macro}{\box_rotate:Nn} -% \begin{macro}[aux]{\@@_rotate:N} -% \begin{macro}[aux]{\@@_rotate_x:nnN, \@@_rotate_y:nnN} -% \begin{macro}[aux] -% { -% \@@_rotate_quadrant_one:, \@@_rotate_quadrant_two:, -% \@@_rotate_quadrant_three:, \@@_rotate_quadrant_four: -% } -% Rotation of a box starts with working out the relevant sine and -% cosine. The actual rotation is in an auxiliary to keep the flow slightly -% clearer -% \begin{macrocode} -\cs_new_protected:Npn \box_rotate:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_@@_angle_fp {#2} - \fp_set:Nn \l_@@_sin_fp { sind ( \l_@@_angle_fp ) } - \fp_set:Nn \l_@@_cos_fp { cosd ( \l_@@_angle_fp ) } - \@@_rotate:N #1 - \group_end: - } - } -% \end{macrocode} -% The edges of the box are then recorded: the left edge will -% always be at zero. Rotation of the four edges then takes place: this is -% most efficiently done on a quadrant by quadrant basis. -% \begin{macrocode} -\cs_new_protected:Npn \@@_rotate:N #1 - { - \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } - \dim_zero:N \l_@@_left_dim -% \end{macrocode} -% The next step is to work out the $x$ and $y$ coordinates of vertices of -% the rotated box in relation to its original coordinates. The box can be -% visualized with vertices $B$, $C$, $D$ and $E$ is illustrated -% (Figure~\ref{fig:l3candidates:rotation}). The vertex $O$ is the reference point -% on the baseline, and in this implementation is also the centre of rotation. -% \begin{figure} -% \centering -% \setlength{\unitlength}{3pt}^^A -% \begin{picture}(34,36)(12,44) -% \thicklines -% \put(20,52){\dashbox{1}(20,21){}} -% \put(20,80){\line(0,-1){36}} -% \put(12,58){\line(1, 0){34}} -% \put(41,59){A} -% \put(40,74){B} -% \put(21,74){C} -% \put(21,49){D} -% \put(40,49){E} -% \put(21,59){O} -% \end{picture} -% \caption{Co-ordinates of a box prior to rotation.} -% \label{fig:l3candidates:rotation} -% \end{figure} -% The formulae are, for a point $P$ and angle $\alpha$: -% \[ -% \begin{array}{l} -% P'_x = P_x - O_x \\ -% P'_y = P_y - O_y \\ -% P''_x = ( P'_x \cos(\alpha)) - ( P'_y \sin(\alpha) ) \\ -% P''_y = ( P'_x \sin(\alpha)) + ( P'_y \cos(\alpha) ) \\ -% P'''_x = P''_x + O_x + L_x \\ -% P'''_y = P''_y + O_y -% \end{array} -% \] -% The \enquote{extra} horizontal translation $L_x$ at the end is calculated -% so that the leftmost point of the resulting box has $x$-coordinate $0$. -% This is desirable as \TeX{} boxes must have the reference point at -% the left edge of the box. (As $O$ is always $(0,0)$, this part of the -% calculation is omitted here.) -% \begin{macrocode} - \fp_compare:nNnTF \l_@@_sin_fp > \c_zero_fp - { - \fp_compare:nNnTF \l_@@_cos_fp > \c_zero_fp - { \@@_rotate_quadrant_one: } - { \@@_rotate_quadrant_two: } - } - { - \fp_compare:nNnTF \l_@@_cos_fp < \c_zero_fp - { \@@_rotate_quadrant_three: } - { \@@_rotate_quadrant_four: } - } -% \end{macrocode} -% The position of the box edges are now known, but the box at this -% stage be misplaced relative to the current \TeX{} reference point. So the -% content of the box is moved such that the reference point of the -% rotated box will be in the same place as the original. -% \begin{macrocode} - \hbox_set:Nn \l_@@_internal_box { \box_use:N #1 } - \hbox_set:Nn \l_@@_internal_box - { - \tex_kern:D -\l_@@_left_new_dim - \hbox:n - { - \__driver_box_use_rotate:Nn - \l_@@_internal_box - \l_@@_angle_fp - } - } -% \end{macrocode} -% Tidy up the size of the box so that the material is actually inside -% the bounding box. The result can then be used to reset the original -% box. -% \begin{macrocode} - \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } - \box_set_dp:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } - \box_set_wd:Nn \l_@@_internal_box - { \l_@@_right_new_dim - \l_@@_left_new_dim } - \box_use:N \l_@@_internal_box - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% These functions take a general point $(|#1|, |#2|)$ and rotate its -% location about the origin, using the previously-set sine and cosine -% values. Each function gives only one component of the location of the -% updated point. This is because for rotation of a box each step needs -% only one value, and so performance is gained by avoiding working -% out both $x'$ and $y'$ at the same time. Contrast this with -% the equivalent function in the \pkg{l3coffins} module, where both parts -% are needed. -% \begin{macrocode} -\cs_new_protected:Npn \@@_rotate_x:nnN #1#2#3 - { - \dim_set:Nn #3 - { - \fp_to_dim:n - { - \l_@@_cos_fp * \dim_to_fp:n {#1} - - \l_@@_sin_fp * \dim_to_fp:n {#2} - } - } - } -\cs_new_protected:Npn \@@_rotate_y:nnN #1#2#3 - { - \dim_set:Nn #3 - { - \fp_to_dim:n - { - \l_@@_sin_fp * \dim_to_fp:n {#1} - + \l_@@_cos_fp * \dim_to_fp:n {#2} - } - } - } -% \end{macrocode} -% Rotation of the edges is done using a different formula for each -% quadrant. In every case, the top and bottom edges only need the -% resulting $y$-values, whereas the left and right edges need the -% $x$-values. Each case is a question of picking out which corner -% ends up at with the maximum top, bottom, left and right value. Doing -% this by hand means a lot less calculating and avoids lots of -% comparisons. -% \begin{macrocode} -\cs_new_protected:Npn \@@_rotate_quadrant_one: - { - \@@_rotate_y:nnN \l_@@_right_dim \l_@@_top_dim - \l_@@_top_new_dim - \@@_rotate_y:nnN \l_@@_left_dim \l_@@_bottom_dim - \l_@@_bottom_new_dim - \@@_rotate_x:nnN \l_@@_left_dim \l_@@_top_dim - \l_@@_left_new_dim - \@@_rotate_x:nnN \l_@@_right_dim \l_@@_bottom_dim - \l_@@_right_new_dim - } -\cs_new_protected:Npn \@@_rotate_quadrant_two: - { - \@@_rotate_y:nnN \l_@@_right_dim \l_@@_bottom_dim - \l_@@_top_new_dim - \@@_rotate_y:nnN \l_@@_left_dim \l_@@_top_dim - \l_@@_bottom_new_dim - \@@_rotate_x:nnN \l_@@_right_dim \l_@@_top_dim - \l_@@_left_new_dim - \@@_rotate_x:nnN \l_@@_left_dim \l_@@_bottom_dim - \l_@@_right_new_dim - } -\cs_new_protected:Npn \@@_rotate_quadrant_three: - { - \@@_rotate_y:nnN \l_@@_left_dim \l_@@_bottom_dim - \l_@@_top_new_dim - \@@_rotate_y:nnN \l_@@_right_dim \l_@@_top_dim - \l_@@_bottom_new_dim - \@@_rotate_x:nnN \l_@@_right_dim \l_@@_bottom_dim - \l_@@_left_new_dim - \@@_rotate_x:nnN \l_@@_left_dim \l_@@_top_dim - \l_@@_right_new_dim - } -\cs_new_protected:Npn \@@_rotate_quadrant_four: - { - \@@_rotate_y:nnN \l_@@_left_dim \l_@@_top_dim - \l_@@_top_new_dim - \@@_rotate_y:nnN \l_@@_right_dim \l_@@_bottom_dim - \l_@@_bottom_new_dim - \@@_rotate_x:nnN \l_@@_left_dim \l_@@_bottom_dim - \l_@@_left_new_dim - \@@_rotate_x:nnN \l_@@_right_dim \l_@@_top_dim - \l_@@_right_new_dim - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{variable}{\l_@@_scale_x_fp, \l_@@_scale_y_fp} -% Scaling is potentially-different in the two axes. -% \begin{macrocode} -\fp_new:N \l_@@_scale_x_fp -\fp_new:N \l_@@_scale_y_fp -% \end{macrocode} -% \end{variable} -% -% \begin{macro}{\box_resize:Nnn, \box_resize:cnn} -% \begin{macro}[aux]{\@@_resize_set_corners:N} -% \begin{macro}[aux]{\@@_resize:N} -% \begin{macro}[aux]{\@@_resize:NNN} -% Resizing a box starts by working out the various dimensions of the -% existing box. -% \begin{macrocode} -\cs_new_protected:Npn \box_resize:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \@@_resize_set_corners:N #1 -% \end{macrocode} -% The $x$-scaling and resulting box size is easy enough to work -% out: the dimension is that given as |#2|, and the scale is simply the -% new width divided by the old one. -% \begin{macrocode} - \fp_set:Nn \l_@@_scale_x_fp - { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } -% \end{macrocode} -% The $y$-scaling needs both the height and the depth of the current box. -% \begin{macrocode} - \fp_set:Nn \l_@@_scale_y_fp - { - \dim_to_fp:n {#3} - / \dim_to_fp:n { \l_@@_top_dim - \l_@@_bottom_dim } - } -% \end{macrocode} -% Hand off to the auxiliary which does the rest of the work. -% \begin{macrocode} - \@@_resize:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_resize:Nnn { c } -\cs_new_protected:Npn \@@_resize_set_corners:N #1 - { - \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } - \dim_zero:N \l_@@_left_dim - } -% \end{macrocode} -% With at least one real scaling to do, the next phase is to find the new -% edge co-ordinates. In the $x$~direction this is relatively easy: just -% scale the right edge. In the $y$~direction, both dimensions have to be -% scaled, and this again needs the absolute scale value. -% Once that is all done, the common resize/rescale code can be employed. -% \begin{macrocode} -\cs_new_protected:Npn \@@_resize:N #1 - { - \@@_resize:NNN \l_@@_right_new_dim - \l_@@_scale_x_fp \l_@@_right_dim - \@@_resize:NNN \l_@@_bottom_new_dim - \l_@@_scale_y_fp \l_@@_bottom_dim - \@@_resize:NNN \l_@@_top_new_dim - \l_@@_scale_y_fp \l_@@_top_dim - \@@_resize_common:N #1 - } -\cs_new_protected:Npn \@@_resize:NNN #1#2#3 - { - \dim_set:Nn #1 - { \fp_to_dim:n { \fp_abs:n { #2 } * \dim_to_fp:n { #3 } } } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\box_resize_to_ht:Nn, \box_resize_to_ht:cn} -% \begin{macro}{\box_resize_to_ht_plus_dp:Nn, \box_resize_to_ht_plus_dp:cn} -% \begin{macro}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} -% \begin{macro}{\box_resize_to_wd_and_ht:Nnn, \box_resize_to_wd_and_ht:cnn} -% Scaling to a (total) height or to a width is a simplified version of the main -% resizing operation, with the scale simply copied between the two parts. The -% internal auxiliary is called using the scaling value twice, as the sign for -% both parts is needed (as this allows the same internal code to be used as -% for the general case). -% \begin{macrocode} -\cs_new_protected:Npn \box_resize_to_ht:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \@@_resize_set_corners:N #1 - \fp_set:Nn \l_@@_scale_y_fp - { - \dim_to_fp:n {#2} - / \dim_to_fp:n { \l_@@_top_dim } - } - \fp_set_eq:NN \l_@@_scale_x_fp \l_@@_scale_y_fp - \@@_resize:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_ht:Nn { c } -\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \@@_resize_set_corners:N #1 - \fp_set:Nn \l_@@_scale_y_fp - { - \dim_to_fp:n {#2} - / \dim_to_fp:n { \l_@@_top_dim - \l_@@_bottom_dim } - } - \fp_set_eq:NN \l_@@_scale_x_fp \l_@@_scale_y_fp - \@@_resize:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } -\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \@@_resize_set_corners:N #1 - \fp_set:Nn \l_@@_scale_x_fp - { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } - \fp_set_eq:NN \l_@@_scale_y_fp \l_@@_scale_x_fp - \@@_resize:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } -\cs_new_protected:Npn \box_resize_to_wd_and_ht:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \@@_resize_set_corners:N #1 - \fp_set:Nn \l_@@_scale_x_fp - { \dim_to_fp:n {#2} / \dim_to_fp:n { \l_@@_right_dim } } - \fp_set:Nn \l_@@_scale_y_fp - { - \dim_to_fp:n {#3} - / \dim_to_fp:n { \l_@@_top_dim } - } - \@@_resize:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_wd_and_ht:Nnn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\box_scale:Nnn, \box_scale:cnn} -% When scaling a box, setting the scaling itself is easy enough. The -% new dimensions are also relatively easy to find, allowing only for -% the need to keep them positive in all cases. Once that is done then -% after a check for the trivial scaling a hand-off can be made to the -% common code. The dimension scaling operations are carried out using -% the \TeX{} mechanism as it avoids needing to use too many \texttt{fp} -% operations. -% \begin{macrocode} -\cs_new_protected:Npn \box_scale:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_@@_scale_x_fp {#2} - \fp_set:Nn \l_@@_scale_y_fp {#3} - \dim_set:Nn \l_@@_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_@@_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_@@_right_dim { \box_wd:N #1 } - \dim_zero:N \l_@@_left_dim - \dim_set:Nn \l_@@_top_new_dim - { \fp_abs:n { \l_@@_scale_y_fp } \l_@@_top_dim } - \dim_set:Nn \l_@@_bottom_new_dim - { \fp_abs:n { \l_@@_scale_y_fp } \l_@@_bottom_dim } - \dim_set:Nn \l_@@_right_new_dim - { \fp_abs:n { \l_@@_scale_x_fp } \l_@@_right_dim } - \@@_resize_common:N #1 - \group_end: - } - } -\cs_generate_variant:Nn \box_scale:Nnn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\@@_resize_common:N} -% The main resize function places in input into a box which will start -% of with zero width, and includes the handles for engine rescaling. -% \begin{macrocode} -\cs_new_protected:Npn \@@_resize_common:N #1 - { - \hbox_set:Nn \l_@@_internal_box - { - \__driver_box_use_scale:Nnn - #1 - \l_@@_scale_x_fp - \l_@@_scale_y_fp - } -% \end{macrocode} -% The new height and depth can be applied directly. -% \begin{macrocode} - \fp_compare:nNnTF \l_@@_scale_y_fp > \c_zero_fp - { - \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } - \box_set_dp:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } - } - { - \box_set_dp:Nn \l_@@_internal_box { \l_@@_top_new_dim } - \box_set_ht:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } - } -% \end{macrocode} -% Things are not quite as obvious for the width, as the reference point -% needs to remain unchanged. For positive scaling factors resizing the -% box is all that is needed. However, for case of a negative scaling -% the material must be shifted such that the reference point ends up in -% the right place. -% \begin{macrocode} - \fp_compare:nNnTF \l_@@_scale_x_fp < \c_zero_fp - { - \hbox_to_wd:nn { \l_@@_right_new_dim } - { - \tex_kern:D \l_@@_right_new_dim - \box_use:N \l_@@_internal_box - \tex_hss:D - } - } - { - \box_set_wd:Nn \l_@@_internal_box { \l_@@_right_new_dim } - \hbox:n - { - \tex_kern:D \c_zero_dim - \box_use:N \l_@@_internal_box - \tex_hss:D - } - } - } -% \end{macrocode} -% \end{macro} -% % \subsection{Viewing part of a box} % % \begin{macro}{\box_clip:N, \box_clip:c} @@ -1960,7 +1365,7 @@ \dim_to_fp:n {#3} / \dim_to_fp:n { \coffin_ht:N #1 + \coffin_dp:N #1 } } - \box_resize:Nnn #1 {#2} {#3} + \box_resize_to_wd_and_ht_plus_dp:Nnn #1 {#2} {#3} \@@_resize_common:Nnn #1 {#2} {#3} } \cs_generate_variant:Nn \coffin_resize:Nnn { c } @@ -2142,8 +1547,8 @@ % Mapping to an input stream can be done on either a token or a string % basis, hence the set up. Within that, there is a check to avoid reading % past the end of a file, hence the two applications of \cs{ior_if_eof:N}. -% This mapping cannot be nested as the stream has only one \enquote{current -% line}. +% This mapping cannot be nested with twice the same stream, as the +% stream has only one \enquote{current line}. % \begin{macrocode} \cs_new_protected:Npn \ior_map_inline:Nn { \@@_map_inline:NNn \ior_get:NN } @@ -2157,7 +1562,7 @@ } \cs_new_protected:Npn \@@_map_inline:NNNn #1#2#3#4 { - \cs_set:Npn #1 ##1 {#4} + \cs_gset_protected:Npn #1 ##1 {#4} \ior_if_eof:NF #3 { \@@_map_inline_loop:NNN #1#2#3 } \__prg_break_point:Nn \ior_map_break: { \int_gdecr:N \g__prg_map_int } @@ -2567,9 +1972,41 @@ } } % \end{macrocode} -% \end{macro} +% \end{macro} +% +% \subsection{Additions to \pkg{l3sys}} +% +% \begin{macro}[EXP, pTF]{\sys_if_rand_exist:} +% Currently, randomness exists under \pdfTeX{} and \LuaTeX{}. +% \begin{macrocode} +\cs_if_exist:NTF \pdftex_uniformdeviate:D + { + \prg_new_conditional:Npnn \sys_if_rand_exist: { p , T , F , TF } + { \prg_return_true: } + } + { + \prg_new_conditional:Npnn \sys_if_rand_exist: { p , T , F , TF } + { \prg_return_false: } + } +% \end{macrocode} +% \end{macro} % -% \subsection{Additions to \pkg{l3tl}} +% \begin{macro}[EXP]{\sys_rand_seed:} +% Unpack the primitive. +% \begin{macrocode} +\cs_new:Npn \sys_rand_seed: { \tex_the:D \pdftex_randomseed:D } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sys_gset_rand_seed:n} +% The primitive always assigns the seed globally. +% \begin{macrocode} +\cs_new_protected:Npn \sys_gset_rand_seed:n #1 + { \pdftex_setrandomseed:D \__int_eval:w #1 \__int_eval_end: } +% \end{macrocode} +% \end{macro} +% +% \subsection{Additions to \pkg{l3tl}} % % \begin{macrocode} %<@@=tl> @@ -3697,10 +3134,9 @@ % octets, so that is taken as read. % \begin{macrocode} \group_begin: - \bool_if:nT - { - \sys_if_engine_pdftex_p: || \sys_if_engine_uptex_p: - } + \bool_lazy_or:nnT + { \sys_if_engine_pdftex_p: } + { \sys_if_engine_uptex_p: } { \cs_set_protected:Npn \@@_loop:nn #1#2 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index dd0ba51b688..4876e488bd3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -1553,7 +1553,8 @@ \clist_if_empty:NF #1 { \int_gincr:N \g__prg_map_int - \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} + \cs_gset_protected:cpn + { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} \exp_last_unbraced:Nco \@@_map_function:Nw { __prg_map_ \int_use:N \g__prg_map_int :w } #1 , \q_recursion_tail , diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 278bbf199b5..1bc70605f7b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -359,10 +359,10 @@ % place, of course. % \begin{macrocode} \prop_new:N \c_@@_corners_prop -\prop_put:Nnn \c_@@_corners_prop { tl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_@@_corners_prop { tr } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_@@_corners_prop { bl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_@@_corners_prop { br } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c_@@_corners_prop { tl } { { 0pt } { 0pt } } +\prop_put:Nnn \c_@@_corners_prop { tr } { { 0pt } { 0pt } } +\prop_put:Nnn \c_@@_corners_prop { bl } { { 0pt } { 0pt } } +\prop_put:Nnn \c_@@_corners_prop { br } { { 0pt } { 0pt } } % \end{macrocode} % \end{variable} % @@ -371,11 +371,11 @@ % based values. % \begin{macrocode} \prop_new:N \c_@@_poles_prop -\tl_set:Nn \l_@@_internal_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } +\tl_set:Nn \l_@@_internal_tl { { 0pt } { 0pt } { 0pt } { 1000pt } } \prop_put:Nno \c_@@_poles_prop { l } { \l_@@_internal_tl } \prop_put:Nno \c_@@_poles_prop { hc } { \l_@@_internal_tl } \prop_put:Nno \c_@@_poles_prop { r } { \l_@@_internal_tl } -\tl_set:Nn \l_@@_internal_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } +\tl_set:Nn \l_@@_internal_tl { { 0pt } { 0pt } { 1000pt } { 0pt } } \prop_put:Nno \c_@@_poles_prop { b } { \l_@@_internal_tl } \prop_put:Nno \c_@@_poles_prop { vc } { \l_@@_internal_tl } \prop_put:Nno \c_@@_poles_prop { t } { \l_@@_internal_tl } @@ -535,10 +535,8 @@ { \hbox_set:Nn #1 { - \color_group_begin: - \color_ensure_current: - #2 - \color_group_end: + \color_ensure_current: + #2 } \@@_reset_structure:N #1 \@@_update_poles:N #1 @@ -569,9 +567,7 @@ \dim_set_eq:NN \linewidth \tex_hsize:D \dim_set_eq:NN \columnwidth \tex_hsize:D %</package> - \color_group_begin: - #3 - \color_group_end: + #3 } \@@_reset_structure:N #1 \@@_update_poles:N #1 @@ -579,13 +575,13 @@ \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } \@@_set_pole:Nnx #1 { T } { - { 0 pt } + { 0pt } { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_@@_internal_box } } - { 1000 pt } - { 0 pt } + { 1000pt } + { 0pt } } \box_clear:N \l_@@_internal_box } @@ -603,10 +599,9 @@ { \@@_if_exist:NT #1 { - \hbox_set:Nw #1 \color_group_begin: \color_ensure_current: + \hbox_set:Nw #1 \color_ensure_current: \cs_set_protected:Npn \hcoffin_set_end: { - \color_group_end: \hbox_set_end: \@@_reset_structure:N #1 \@@_update_poles:N #1 @@ -634,10 +629,8 @@ \dim_set_eq:NN \linewidth \tex_hsize:D \dim_set_eq:NN \columnwidth \tex_hsize:D %</package> - \color_group_begin: \cs_set_protected:Npn \vcoffin_set_end: { - \color_group_end: \vbox_set_end: \@@_reset_structure:N #1 \@@_update_poles:N #1 @@ -645,13 +638,13 @@ \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } \@@_set_pole:Nnx #1 { T } { - { 0 pt } + { 0pt } { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_@@_internal_box } } - { 1000 pt } - { 0 pt } + { 1000pt } + { 0pt } } \box_clear:N \l_@@_internal_box } @@ -738,7 +731,7 @@ { \__msg_kernel_error:nnxx { kernel } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } - \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } + \tl_set:Nn #3 { { 0pt } { 0pt } { 0pt } { 0pt } } } } % \end{macrocode} @@ -793,8 +786,8 @@ { \@@_set_pole:Nnx #1 {#2} { - { 0 pt } { \dim_eval:n {#3} } - { 1000 pt } { 0 pt } + { 0pt } { \dim_eval:n {#3} } + { 1000pt } { 0pt } } } } @@ -804,8 +797,8 @@ { \@@_set_pole:Nnx #1 {#2} { - { \dim_eval:n {#3} } { 0 pt } - { 0 pt } { 1000 pt } + { \dim_eval:n {#3} } { 0pt } + { 0pt } { 1000pt } } } } @@ -827,11 +820,11 @@ \cs_new_protected:Npn \@@_update_corners:N #1 { \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { tl } - { { 0 pt } { \dim_eval:n { \box_ht:N #1 } } } + { { 0pt } { \dim_eval:n { \box_ht:N #1 } } } \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { tr } { { \dim_eval:n { \box_wd:N #1 } } { \dim_eval:n { \box_ht:N #1 } } } \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { bl } - { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } } + { { 0pt } { \dim_eval:n { -\box_dp:N #1 } } } \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { br } { { \dim_eval:n { \box_wd:N #1 } } { \dim_eval:n { -\box_dp:N #1 } } } } @@ -850,33 +843,33 @@ \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { hc } { { \dim_eval:n { 0.5 \box_wd:N #1 } } - { 0 pt } { 0 pt } { 1000 pt } + { 0pt } { 0pt } { 1000pt } } \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { r } { { \dim_eval:n { \box_wd:N #1 } } - { 0 pt } { 0 pt } { 1000 pt } + { 0pt } { 0pt } { 1000pt } } \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { vc } { - { 0 pt } + { 0pt } { \dim_eval:n { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } } - { 1000 pt } - { 0 pt } + { 1000pt } + { 0pt } } \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { t } { - { 0 pt } + { 0pt } { \dim_eval:n { \box_ht:N #1 } } - { 1000 pt } - { 0 pt } + { 1000pt } + { 0pt } } \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { b } { - { 0 pt } - { \dim_eval:n { - \box_dp:N #1 } } - { 1000 pt } - { 0 pt } + { 0pt } + { \dim_eval:n { -\box_dp:N #1 } } + { 1000pt } + { 0pt } } } % \end{macrocode} @@ -1116,9 +1109,9 @@ % those from the two parent coffins are needed. % \begin{macrocode} \@@_reset_structure:N \l_@@_aligned_coffin - \prop_clear:c - { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _ prop } - \@@_update_poles:N \l_@@_aligned_coffin + \prop_clear:c + { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _ prop } + \@@_update_poles:N \l_@@_aligned_coffin % \end{macrocode} % The structures of the parent coffins are now transferred to the new % coffin, which requires that the appropriate offsets are applied. That @@ -1126,16 +1119,16 @@ % \begin{macrocode} \dim_compare:nNnTF \l_@@_offset_x_dim < \c_zero_dim { - \@@_offset_poles:Nnn #1 { -\l_@@_offset_x_dim } { 0 pt } - \@@_offset_poles:Nnn #4 { 0 pt } { \l_@@_offset_y_dim } - \@@_offset_corners:Nnn #1 { -\l_@@_offset_x_dim } { 0 pt } - \@@_offset_corners:Nnn #4 { 0 pt } { \l_@@_offset_y_dim } + \@@_offset_poles:Nnn #1 { -\l_@@_offset_x_dim } { 0pt } + \@@_offset_poles:Nnn #4 { 0pt } { \l_@@_offset_y_dim } + \@@_offset_corners:Nnn #1 { -\l_@@_offset_x_dim } { 0pt } + \@@_offset_corners:Nnn #4 { 0pt } { \l_@@_offset_y_dim } } { - \@@_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_poles:Nnn #1 { 0pt } { 0pt } \@@_offset_poles:Nnn #4 { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } - \@@_offset_corners:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_corners:Nnn #1 { 0pt } { 0pt } \@@_offset_corners:Nnn #4 { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } } @@ -1170,7 +1163,7 @@ { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _prop } { l_@@_corners_ \__int_value:w #1 _prop } \@@_update_poles:N \l_@@_aligned_coffin - \@@_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_poles:Nnn #1 { 0pt } { 0pt } \@@_offset_poles:Nnn #4 { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } \@@_update_vertical_poles:NNN #1 #4 \l_@@_aligned_coffin @@ -1307,11 +1300,11 @@ \dim_compare:nNnTF {#2} < {#6} { \@@_set_pole:Nnx #9 { T } - { { 0 pt } {#6} { 1000 pt } { 0 pt } } + { { 0pt } {#6} { 1000pt } { 0pt } } } { \@@_set_pole:Nnx #9 { T } - { { 0 pt } {#2} { 1000 pt } { 0 pt } } + { { 0pt } {#2} { 1000pt } { 0pt } } } } \cs_new_protected:Npn \@@_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 @@ -1319,11 +1312,11 @@ \dim_compare:nNnTF {#2} < {#6} { \@@_set_pole:Nnx #9 { B } - { { 0 pt } {#2} { 1000 pt } { 0 pt } } + { { 0pt } {#2} { 1000pt } { 0pt } } } { \@@_set_pole:Nnx #9 { B } - { { 0 pt } {#6} { 1000 pt } { 0 pt } } + { { 0pt } {#6} { 1000pt } { 0pt } } } } % \end{macrocode} @@ -1412,7 +1405,7 @@ % displaying handles. % \begin{macrocode} \dim_new:N \l_@@_display_offset_dim -\dim_set:Nn \l_@@_display_offset_dim { 2 pt } +\dim_set:Nn \l_@@_display_offset_dim { 2pt } % \end{macrocode} % \end{variable} % @@ -1463,15 +1456,15 @@ \hcoffin_set:Nn \l_@@_display_pole_coffin { %<*initex> - \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO + \hbox:n { \tex_vrule:D width 1pt height 1pt \scan_stop: } % TODO %</initex> %<*package> \color {#4} - \rule { 1 pt } { 1 pt } + \rule { 1pt } { 1pt } %</package> } \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_@@_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } + \l_@@_display_pole_coffin { hc } { vc } { 0pt } { 0pt } \hcoffin_set:Nn \l_@@_display_coord_coffin { %<*initex> @@ -1493,7 +1486,7 @@ { \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} \l_@@_display_coord_coffin { l } { vc } - { 1 pt } { 0 pt } + { 1pt } { 0pt } } { \exp_last_unbraced:No \@@_mark_handle_aux:nnnnNnn @@ -1532,11 +1525,11 @@ \hcoffin_set:Nn \l_@@_display_pole_coffin { %<*initex> - \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO + \hbox:n { \tex_vrule:D width 1pt height 1pt \scan_stop: } % TODO %</initex> %<*package> \color {#2} - \rule { 1 pt } { 1 pt } + \rule { 1pt } { 1pt } %</package> } \prop_set_eq:Nc \l_@@_display_poles_prop @@ -1574,7 +1567,7 @@ \dim_set:Nn \l_@@_display_y_dim { \l_@@_y_dim } \@@_display_attach:Nnnnn \l_@@_display_pole_coffin { hc } { vc } - { 0 pt } { 0 pt } + { 0pt } { 0pt } \hcoffin_set:Nn \l_@@_display_coord_coffin { %<*initex> @@ -1596,7 +1589,7 @@ { \@@_display_attach:Nnnnn \l_@@_display_coord_coffin { l } { vc } - { 1 pt } { 0 pt } + { 1pt } { 0pt } } { \exp_last_unbraced:No diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx index e6631c63283..72bca5f43db 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -94,7 +94,7 @@ \cs_new_eq:NN \color_group_begin: \group_begin: \cs_new_protected:Npn \color_group_end: { - \tex_par:D + \par \group_end: } % \end{macrocode} @@ -104,33 +104,8 @@ % A driver-independent wrapper for setting the foreground color to the % current color \enquote{now}. % \begin{macrocode} -%<*initex> \cs_new_protected:Npn \color_ensure_current: { \__driver_color_ensure_current: } -%</initex> -% \end{macrocode} -% In package mode, the driver code may not be loaded. To keep down -% dependencies, if there is no driver code available and no \cs{set@color} -% then color is not in use and this function can be a no-op. -% \begin{macrocode} -%<*package> -\cs_new_protected:Npn \color_ensure_current: { } -\AtBeginDocument - { - \cs_if_exist:NTF \__driver_color_ensure_current: - { - \cs_set_protected:Npn \color_ensure_current: - { \__driver_color_ensure_current: } - } - { - \cs_if_exist:NT \set@color - { - \cs_set_protected:Npn \color_ensure_current: - { \set@color } - } - } - } -%</package> % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index 1f8c208d618..d1eaba62294 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -140,6 +140,8 @@ \@@_error:Nnn \tl_to_lowercase:n { } { 2017-12-31 } \@@_error:Nnn \tl_to_uppercase:n { } { 2017-12-31 } \@@_error:Nnn \ior_get_str:NN { \ior_str_get:NN } { 2017-12-31 } + \@@_error:Nnn \box_resize:Nnn { \box_resize_to_wd_and_ht_plus_dp:Nnn } { 2018-12-31 } + \@@_error:Nnn \box_resize:cnn { \box_resize_to_wd_and_ht_plus_dp:cnn } { 2018-12-31 } \@@_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } \@@_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } \@@_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 464320e84a1..516925b3e4a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -70,14 +70,14 @@ and all files in that bundle must be distributed together. % This isn't included in the typeset documentation because it's a bit % ugly: %<*class> -\ProvidesExplClass{l3doc}{2017/04/01}{} +\ProvidesExplClass{l3doc}{2017/05/13}{} {L3 Experimental documentation class} %</class> % \fi % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % \maketitle % \tableofcontents % @@ -2254,7 +2254,7 @@ and all files in that bundle must be distributed together. \clist_clear:N \l_@@_function_label_clist \tl_set:Nn \l_@@_override_module_tl { \q_no_value } \char_set_catcode_active:N \< - \cs_set_protected:Npn < ##1 > { \meta {##1} } + \cs_set_protected_nopar:Npn < ##1 > { \meta {##1} } } \group_end: % \end{macrocode} @@ -4370,5 +4370,3 @@ page_precedence "rnaA" % \end{implementation} % % \PrintIndex -% -% \endinput diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index dbcc32eac12..4f8ec457518 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 94f7d3ccd03..9584a9aa624 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -64,8 +64,8 @@ % \item \texttt{dvipdfmx}: The \texttt{dvipdfmx} program, which works in % conjugation with \pdfTeX{} or \LuaTeX{} in DVI mode. % \item \texttt{dvisvgm}: The \texttt{dvisvgm} program, which works in -% conjugation with \pdfTeX{} or \LuaTeX{} in DVI mode to create SVG -% output. +% conjugation with \pdfTeX{} or \LuaTeX{} when run in DVI mode as well +% as with (u)p\TeX{} and \XeTeX{}. % \item \texttt{xdvipdfmx}: The driver used by \XeTeX{}. % \end{itemize} % @@ -551,6 +551,93 @@ % \end{macrocode} % \end{macro} % +% \subsubsection{Box operations} +% +% \begin{macro}{\@@_box_use_clip:N} +% The general method is to save the current location, define a clipping path +% equivalent to the bounding box, then insert the content at the current +% position and in a zero width box. The \enquote{real} width is then made up +% using a horizontal skip before tidying up. There are other approaches that +% can be taken (for example using XForm objects), but the logic here shares +% as much code as possible and uses the same conversions (and so same +% rounding errors) in all cases. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_clip:N #1 + { + \@@_scope_begin: + \@@_literal:n + { + 0~ + \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~ + re~W~n + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + \skip_horizontal:n { \box_wd:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_box_use_rotate:Nn} +% \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp} +% Rotations are set using an affine transformation matrix which therefore +% requires sine/cosine values not the angle itself. We store the rounded +% values to avoid rounding twice. There are also a couple of comparisons to +% ensure that |-0| is not written to the output, as this avoids any issues +% with problematic display programs. Note that numbers are compared to~$0$ +% after rounding. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 + { + \@@_scope_begin: + \box_set_wd:Nn #1 \c_zero_dim + \fp_set:Nn \l_@@_cos_fp { round ( cosd ( #2 ) , 5 ) } + \fp_compare:nNnT \l_@@_cos_fp = \c_zero_fp + { \fp_zero:N \l_@@_cos_fp } + \fp_set:Nn \l_@@_sin_fp { round ( sind ( #2 ) , 5 ) } + \@@_matrix:n + { + \fp_use:N \l_@@_cos_fp \c_space_tl + \fp_compare:nNnTF \l_@@_sin_fp = \c_zero_fp + { 0~0 } + { + \fp_use:N \l_@@_sin_fp + \c_space_tl + \fp_eval:n { -\l_@@_sin_fp } + } + \c_space_tl + \fp_use:N \l_@@_cos_fp + } + \box_use:N #1 + \@@_scope_end: + } +\fp_new:N \l_@@_cos_fp +\fp_new:N \l_@@_sin_fp +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}{\@@_box_use_scale:Nnn} +% The same idea as for rotation but without the complexity of signs and +% cosines. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 + { + \@@_scope_begin: + \@@_matrix:n + { + \fp_eval:n { round ( #2 , 5 ) } ~ + 0~0~ + \fp_eval:n { round ( #3 , 5 ) } + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + } +% \end{macrocode} +% \end{macro} +% % \subsubsection{Color} % % \begin{variable}{\l_@@_current_color_tl} @@ -623,7 +710,9 @@ % % \begin{macro}[int]{\@@_literal:n} % Equivalent to \texttt{pdf:content} but favored as the link to -% the \pdfTeX{} primitive approach is clearer. +% the \pdfTeX{} primitive approach is clearer. Some higher-level operations +% use |\tex_special:D| directly: see the later comments on where this is +% useful. % \begin{macrocode} \cs_new_protected:Npn \@@_literal:n #1 { \tex_special:D { pdf:literal~ #1 } } @@ -631,22 +720,80 @@ % \end{macro} % % \begin{macro}[int]{\@@_scope_begin:, \@@_scope_end:} -% Scoping is done using direct PDF operations here. +% Scoping is done using the driver-specific specials. % \begin{macrocode} \cs_new_protected:Npn \@@_scope_begin: - { \@@_literal:n { q } } + { \tex_special:D { x:gsave } } \cs_new_protected:Npn \@@_scope_end: - { \@@_literal:n { Q } } + { \tex_special:D { x:grestore } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_matrix:n} -% With \texttt{(x)dvipdfmx} the matrix has to include a translation -% part: that is always zero and so is built in here so that the same -% internal interface works for all PDF-related drivers. +% \subsubsection{Box operations} +% +% \begin{macro}{\@@_box_use_clip:N} +% The code here is idential to that for \texttt{pdfmode}: unlike rotation and +% scaling, there is no higher-level support in the driver for clipping. % \begin{macrocode} -\cs_new_protected:Npn \@@_matrix:n #1 - { \@@_literal:n { #1 \c_space_tl 0~0~cm } } +\cs_new_protected:Npn \@@_box_use_clip:N #1 + { + \@@_scope_begin: + \@@_literal:n + { + 0~ + \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~ + re~W~n + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + \skip_horizontal:n { \box_wd:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_box_use_rotate:Nn} +% Rotating in \texttt{(x)}dvipdmfx can be implemented using either PDF or +% driver-specific code. The former approach however is not \enquote{aware} +% of the content of boxes: this means that any links embded will not be +% adjusted by the rotation. As such, the driver-native approach is prefered: +% the code therefore is similar (though not identical) to the \texttt{dvips} +% version (notice the rotation angle here is positive). As for +% \texttt{dvips}, zero rotation is written as |0| not |-0|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 + { + \@@_scope_begin: + \tex_special:D + { + x:rotate~ + \fp_compare:nNnTF {#2} = \c_zero_fp + { 0 } + { \fp_eval:n { round ( #2 , 5 ) } } + } + \box_use:N #1 + \@@_scope_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_box_use_scale:Nnn} +% Much the same idea for scaling: use the higher-level driver operation to allow +% for box content. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 + { + \@@_scope_begin: + \tex_special:D + { + x:scale~ + \fp_eval:n { round ( #2 , 5 ) } ~ + \fp_eval:n { round ( #3 , 5 ) } + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + } % \end{macrocode} % \end{macro} % @@ -724,103 +871,15 @@ %</xdvipdfmx> % \end{macrocode} % -% \subsection{Common code for PDF production} +% \subsection{Drawing commands: \texttt{pdfmode} and \texttt{(x)dvipdfmx}} % -% As all of the drivers which understand PDF-targeted specials act in much -% the same way there is a lot of shared code. Rather than try to DocStrip it -% interspersed with the above, we collect all of it here. +% Both \texttt{pdfmode} and \texttt{(x)dvipdfmx} directly produce PDF output +% and undertand a shared set of specials for drawing commands. % % \begin{macrocode} %<*dvipdfmx|pdfmode|xdvipdfmx> % \end{macrocode} % -% \subsubsection{Box operations} -% -% \begin{macro}{\@@_box_use_clip:N} -% The general method is to save the current location, define a clipping path -% equivalent to the bounding box, then insert the content at the current -% position and in a zero width box. The \enquote{real} width is then made up -% using a horizontal skip before tidying up. There are other approaches that -% can be taken (for example using XForm objects), but the logic here shares -% as much code as possible and uses the same conversions (and so same -% rounding errors) in all cases. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 - { - \@@_scope_begin: - \@@_literal:n - { - 0~ - \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~ - \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ - \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~ - re~W~n - } - \hbox_overlap_right:n { \box_use:N #1 } - \@@_scope_end: - \skip_horizontal:n { \box_wd:N #1 } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_box_use_rotate:Nn} -% \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp} -% Rotations are set using an affine transformation matrix which therefore -% requires sine/cosine values not the angle itself. We store the rounded -% values to avoid rounding twice. There are also a couple of comparisons to -% ensure that |-0| is not written to the output, as this avoids any issues -% with problematic display programs. Note that numbers are compared to~$0$ -% after rounding. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 - { - \@@_scope_begin: - \box_set_wd:Nn #1 \c_zero_dim - \fp_set:Nn \l_@@_cos_fp { round ( cosd ( #2 ) , 5 ) } - \fp_compare:nNnT \l_@@_cos_fp = \c_zero_fp - { \fp_zero:N \l_@@_cos_fp } - \fp_set:Nn \l_@@_sin_fp { round ( sind ( #2 ) , 5 ) } - \@@_matrix:n - { - \fp_use:N \l_@@_cos_fp \c_space_tl - \fp_compare:nNnTF \l_@@_sin_fp = \c_zero_fp - { 0~0 } - { - \fp_use:N \l_@@_sin_fp - \c_space_tl - \fp_eval:n { -\l_@@_sin_fp } - } - \c_space_tl - \fp_use:N \l_@@_cos_fp - } - \box_use:N #1 - \@@_scope_end: - } -\fp_new:N \l_@@_cos_fp -\fp_new:N \l_@@_sin_fp -% \end{macrocode} -% \end{variable} -% \end{macro} -% -% \begin{macro}{\@@_box_use_scale:Nnn} -% The same idea as for rotation but without the complexity of signs and -% cosines. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 - { - \@@_scope_begin: - \@@_matrix:n - { - \fp_eval:n { round ( #2 , 5 ) } ~ - 0~0~ - \fp_eval:n { round ( #3 , 5 ) } - } - \hbox_overlap_right:n { \box_use:N #1 } - \@@_scope_end: - } -% \end{macrocode} -% \end{macro} -% % \subsection{Drawing} % % \begin{macro}[aux]{\@@_draw_literal:n, \@@_draw_literal:x} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index fb54e04ad68..6908c0bc050 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 7422b8ccf8c..12ffc79a8c5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 79363feca39..2c25386e920 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -98,11 +98,9 @@ % (The primitives have to be available at point of use not just at point of % definition so a compatibility layer is hard to arrange here.) % \begin{macrocode} -\bool_if:nTF - { - \sys_if_engine_luatex_p: - || \sys_if_engine_xetex_p: - } +\bool_lazy_or:nnTF + { \sys_if_engine_luatex_p: } + { \sys_if_engine_xetex_p: } % \end{macrocode} % Unicode engines: make these two invalid (this happens after \TeX{} % has read and thrown away their use in the following). @@ -261,11 +259,9 @@ \tex_everyjob:D { \tex_the:D \tex_everyjob:D - \bool_if:nTF - { - \sys_if_engine_luatex_p: || - \sys_if_engine_xetex_p: - } + \bool_lazy_or:nnTF + { \sys_if_engine_luatex_p: } + { \sys_if_engine_xetex_p: } { \tex_font:D \exp_not:c { TU/lmr/m/n/10 } = "[lmroman10-regular.otf]/OT" \scan_stop: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index ef90edf32d5..658acbd3518 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index e71d44c8ee9..02a22405d25 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index e6bc6fa3f8d..4d7ccd55a90 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 35c1b24b006..cd8a2822cec 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index e639be1259a..463892caee7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 47a9536b72e..2cf6e06b8d5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 5c0e7151f5d..de04c7cf796 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index cafc264b333..c51dd6069f7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -376,21 +376,39 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\fp_step_inline:nnnn} +% \begin{macro}{\fp_step_inline:nnnn, \fp_step_variable:nnnNn} +% \begin{macro}[aux]{\@@_step:NNnnnn} % As for \cs{int_step_inline:nnnn}, create a global function and apply it, % following up with a break point. % \begin{macrocode} -\cs_new_protected:Npn \fp_step_inline:nnnn #1#2#3#4 +\cs_new_protected:Npn \fp_step_inline:nnnn { \int_gincr:N \g__prg_map_int - \cs_gset_protected:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } - ##1 {#4} - \fp_step_function:nnnc {#1} {#2} {#3} + \exp_args:NNc \@@_step:NNnnnn + \cs_gset_protected:Npn { __prg_map_ \int_use:N \g__prg_map_int :w } + } +\cs_new_protected:Npn \fp_step_variable:nnnNn #1#2#3#4#5 + { + \int_gincr:N \g__prg_map_int + \exp_args:NNc \@@_step:NNnnnn + \cs_gset_protected:Npx + { __prg_map_ \int_use:N \g__prg_map_int :w } + {#1} {#2} {#3} + { + \tl_set:Nn \exp_not:N #4 {##1} + \exp_not:n {#5} + } + } +\cs_new_protected:Npn \@@_step:NNnnnn #1#2#3#4#5#6 + { + #1 #2 ##1 {#6} + \fp_step_function:nnnN {#3} {#4} {#5} #2 \__prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__prg_map_int } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macrocode} \__msg_kernel_new:nnn { kernel } { fp-bad-step } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 13d6b319723..83dca37310c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -986,15 +986,23 @@ % the unknown word could be a mistyped function as well as a mistyped % constant, so there is no way to tell whether to look for arguments; % we do not. +% The standard requires \enquote{inf} and \enquote{infinity} and +% \enquote{nan} to be recognized regardless of case, but we probably +% don't want to allow every \pkg{l3fp} word to have an arbitrary +% mixture of lower and upper case, so we test and use a +% differently-named control sequence. % \begin{macrocode} \cs_new:Npn \@@_parse_word:Nw #1#2; { \cs_if_exist_use:cF { @@_parse_word_#2:N } { - \__msg_kernel_expandable_error:nnn - { kernel } { unknown-fp-word } {#2} - \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w - \@@_parse_infix:NN + \cs_if_exist_use:cF { @@_parse_caseless_ \str_fold_case:n {#2} :N } + { + \__msg_kernel_expandable_error:nnn + { kernel } { unknown-fp-word } {#2} + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w + \@@_parse_infix:NN + } } #1 } @@ -1924,6 +1932,21 @@ % % \begin{macro}[aux, EXP] % { +% \@@_parse_caseless_inf:N, +% \@@_parse_caseless_infinity:N, +% \@@_parse_caseless_nan:N +% } +% Copies of \cs[no-index]{@@_parse_word_\ldots{}:N} commands, to allow +% arbitrary case as mandated by the standard. +% \begin{macrocode} +\cs_new_eq:NN \@@_parse_caseless_inf:N \@@_parse_word_inf:N +\cs_new_eq:NN \@@_parse_caseless_infinity:N \@@_parse_word_inf:N +\cs_new_eq:NN \@@_parse_caseless_nan:N \@@_parse_word_nan:N +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP] +% { % \@@_parse_word_pt:N , \@@_parse_word_in:N , % \@@_parse_word_pc:N , \@@_parse_word_cm:N , \@@_parse_word_mm:N , % \@@_parse_word_dd:N , \@@_parse_word_cc:N , \@@_parse_word_nd:N , diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index edaf36026cf..d78c7c5e2de 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 88a50b7b6d4..dfc00ce2999 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index 8cfde36c7fb..b11c8532a12 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 88150107104..9ff46ddee9a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 3c8aff7343a..380dd7f3641 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -573,6 +573,20 @@ % \meta{code} should define a function of one argument~(|#1|). % \end{function} % +% \begin{function}[added = 2017-04-12]{\fp_step_variable:nnnNn} +% \begin{syntax} +% \cs{fp_step_variable:nnnNn} \\ +% ~~\Arg{initial value} \Arg{step} \Arg{final value} \meta{tl~var} \Arg{code} +% \end{syntax} +% This function first evaluates the \meta{initial value}, \meta{step} +% and \meta{final value}, all of which should be floating point expressions. +% Then for each \meta{value} from the \meta{initial value} to the +% \meta{final value} in turn (using \meta{step} between each +% \meta{value}), the \meta{code} is inserted into the input stream, +% with the \meta{tl~var} defined as the current \meta{value}. Thus +% the \meta{code} should make use of the \meta{tl~var}. +% \end{function} +% % \section{Some useful constants, and scratch variables} % % \begin{variable}[added = 2012-05-08]{\c_zero_fp, \c_minus_zero_fp} @@ -1029,8 +1043,8 @@ % Computes the sine, cosine, tangent, cotangent, cosecant, or secant % of the \meta{fpexpr} given in radians. For arguments given in % degrees, see \texttt{sind}, \texttt{cosd}, \emph{etc.} Note that -% since $\pi$~is irrational, $\operatorname{sin}(8pi)$ is not quite -% zero, while its analog $\operatorname{sind}(8\times 180)$ is exactly +% since $\pi$~is irrational, $\operatorname{sin}(8\mathrm{pi})$ is not quite +% zero, while its analogue $\operatorname{sind}(8\times 180)$ is exactly % zero. The trigonometric functions are undefined for % an argument of $\pm\infty$, leading to the \enquote{invalid % operation} exception. Additionally, evaluating tangent, @@ -1052,8 +1066,8 @@ % Computes the sine, cosine, tangent, cotangent, cosecant, or secant % of the \meta{fpexpr} given in degrees. For arguments given in % radians, see \texttt{sin}, \texttt{cos}, \emph{etc.} Note that -% since $\pi$~is irrational, $\operatorname{sin}(8pi)$ is not quite -% zero, while its analog $\operatorname{sind}(8\times 180)$ is exactly +% since $\pi$~is irrational, $\operatorname{sin}(8\mathrm{pi})$ is not quite +% zero, while its analogue $\operatorname{sind}(8\times 180)$ is exactly % zero. The trigonometric functions are undefined for % an argument of $\pm\infty$, leading to the \enquote{invalid % operation} exception. Additionally, evaluating tangent, diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 6514b100b29..7ea2be4fed0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -1322,7 +1322,7 @@ % code seen with token list variables. % \begin{macrocode} \cs_new_protected:Npn \int_set:Nn #1#2 - { #1 ~ \@@_eval:w #2\@@_eval_end: } + { #1 ~ \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gset:Nn { \tex_global:D \int_set:Nn } \cs_generate_variant:Nn \int_set:Nn { c } \cs_generate_variant:Nn \int_gset:Nn { c } @@ -1757,14 +1757,14 @@ { \int_gincr:N \g__prg_map_int \exp_args:NNc \@@_step:NNnnnn - \cs_gset:Npn + \cs_gset_protected:Npn { __prg_map_ \int_use:N \g__prg_map_int :w } } \cs_new_protected:Npn \int_step_variable:nnnNn #1#2#3#4#5 { \int_gincr:N \g__prg_map_int \exp_args:NNc \@@_step:NNnnnn - \cs_gset:Npx + \cs_gset_protected:Npx { __prg_map_ \int_use:N \g__prg_map_int :w } {#1}{#2}{#3} { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 68edc695ad3..13c088c2785 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 21d8175361c..9fd49d2acd4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 7427a556d09..466da628f8a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index ad97bd167ae..d46b5c9fbf6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index 7ba7671cfc4..b52cec077c2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -149,5 +149,4 @@ % \end{macrocode} % % \end{implementation} -% -% \endinput + diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 2636aa962af..055fab38e6b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index fc18d78ff68..b30ad2e1278 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -1065,13 +1065,15 @@ % of the form \cs{@@_pair:wn} \meta{key} \cs{s_@@} \Arg{value}, there % are a leading and a trailing tokens, but both are equal to % \cs{scan_stop:}, hence have no effect in such inline mapping. +% Such \cs{scan_stop:} could have affected ligatures if they appeared +% during the mapping. % \begin{macrocode} \cs_new_protected:Npn \prop_map_inline:Nn #1#2 { \cs_gset_eq:cN { __prg_map_ \int_use:N \g__prg_map_int :wn } \@@_pair:wn \int_gincr:N \g__prg_map_int - \cs_gset:Npn \@@_pair:wn ##1 \s_@@ ##2 {#2} + \cs_gset_protected:Npn \@@_pair:wn ##1 \s_@@ ##2 {#2} #1 \__prg_break_point:Nn \prop_map_break: { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 7895de31175..6cfbf18f043 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -641,5 +641,3 @@ % \end{implementation} % % \PrintIndex -% -% \endinput diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index e71c5c6de33..3681b4b4104 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 3db7d8feca1..0fc90333ab8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index a7055a98d9a..9a7e9709631 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 6eb0a994ef1..90c2f79fc8b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -418,7 +418,7 @@ % % \section{String manipulation} % -% \begin{function}[rEXP, added = 2015-03-01] +% \begin{function}[EXP, added = 2015-03-01] % { % \str_lower_case:n, \str_lower_case:f, % \str_upper_case:n, \str_upper_case:f diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index cb65137fb1a..ba1d67bd495 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -218,11 +218,9 @@ } \cs_if_exist:NT \ptex_kanjiskip:D { - \bool_if:nTF - { - \cs_if_exist_p:N \uptex_disablecjktoken:D && - \int_compare_p:nNn { \ptex_jis:D "2121 } = { "3000 } - } + \bool_lazy_and:nnTF + { \cs_if_exist_p:N \uptex_disablecjktoken:D } + { \int_compare_p:nNn { \ptex_jis:D "2121 } = { "3000 } } { \cs_gset_eq:NN \sys_if_engine_uptex:T \use:n \cs_gset_eq:NN \sys_if_engine_uptex:F \use_none:n diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 6209a7b5f8d..d111582686f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % @@ -2211,7 +2211,8 @@ \cs_new_protected:Npn \tl_map_inline:nn #1#2 { \int_gincr:N \g__prg_map_int - \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} + \cs_gset_protected:cpn + { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} \exp_args:Nc \@@_map_function:Nn { __prg_map_ \int_use:N \g__prg_map_int :w } #1 \q_recursion_tail diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index bda063e728c..9b74a8f8346 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/04/01} +% \date{Released 2017/05/13} % % \maketitle % |