diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-07 23:33:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-07 23:33:27 +0000 |
commit | f1cddb2ae051713a3d0b9efa1251d8f85d8131fc (patch) | |
tree | 47b6a38de15329b2ffd3a196e7d85e7ad1e93032 | |
parent | ea06cd2704b8ed1c5278b20798ab9e3811e0ca4e (diff) |
l3kernel 2729 (5sep11)
git-svn-id: svn://tug.org/texlive/trunk@23865 c570f23f-e606-0410-a88d-b1316a301751
39 files changed, 2621 insertions, 438 deletions
diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf Binary files differindex c069babd84f..7f55fe32105 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf Binary files differindex 0ef0de9cdc6..fe5b2c3bb15 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf Binary files differindex 13d7af542b8..43362a99002 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf Binary files differindex 48e130d080b..8232d227a5a 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf Binary files differindex 1a2a6307e59..9c3e9ec9082 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex index 1caee5bd0e2..d68e88af3d3 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex +++ b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex @@ -294,7 +294,9 @@ different types of argument: illustration should be described in the following text. \end{function} -Some functions are fully expandable, which allows it to be used within +\paragraph{Fully expandable functions} +\hypertarget{expstar}{Some functions are fully expandable}, +which allows it to be used within an \texttt{x}-type argument (in plain \TeX{} terms, inside an \cs{edef}). These fully expandable functions are indicated in the documentation by a star: @@ -308,14 +310,25 @@ a star: shorthand for a \meta{control sequence}. \end{function} -Conditional (\texttt{if}) functions are normally defined in three variants, -with +\paragraph{Restricted expandable functions} +\hypertarget{rexpstar}{A few functions are fully expandable} but cannot be fully expanded within +an \texttt{f}-type argument. In this case a hollow star is used to indicate +this: +\begin{function}[rEXP]{\seq_map_function:NN} + \begin{syntax} + \cs{tl_trim_spaces:n} \meta{seq} \meta{function} + \end{syntax} +\end{function} + +\paragraph{Conditional functions} +\hypertarget{explTF}{Conditional (\texttt{if}) functions} +are normally defined in three variants, with \texttt{T}, \texttt{F} and \texttt{TF} argument specifiers. This allows them to be used for different \enquote{true}/\enquote{false} branches, depending on which outcome the conditional is being used to test. To indicate this without repetition, this information is given in a shortened form: -\begin{function}[EXP,pTF]{\xetex_if_engine:} +\begin{function}[EXP,TF]{\xetex_if_engine:} \begin{syntax} \cs{xetex_if_engine:TF} \Arg{true code} \Arg{false code} \end{syntax} @@ -382,6 +395,8 @@ logical construct. \DocInput{l3clist.dtx} \DocInput{l3prop.dtx} \DocInput{l3box.dtx} +\DocInput{l3coffins.dtx} +\DocInput{l3color.dtx} \DocInput{l3io.dtx} \DocInput{l3msg.dtx} \DocInput{l3keys.dtx} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 0f30662fce5..fc8efd3c193 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -37,8 +37,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/08/28} -\def\ExplFileVersion{2678} +\def\ExplFileDate{2011/09/05} +\def\ExplFileVersion{2729} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -912,6 +912,14 @@ \RequirePackage{calc} % \end{macrocode} % +% The coffins system requires basic colour support along with graphics +% scaling and so on. When used as a package, it makes sense to load the +% \LaTeXe{} drivers. This is done on a \enquote{minimal} basis, to avoid +% for example option clashes. +% \begin{macrocode} +\RequirePackage{color,graphics} +% \end{macrocode} +% % Do the package identification: this will turn on code syntax. % \begin{macrocode} \ProvidesExplPackage @@ -1009,11 +1017,12 @@ l3io, l3file, l3skip, - l3box, l3keys, l3fp, - l3luatex, - l3coffins + l3box, + l3coffins, + l3color, + l3luatex } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 62d8f1caca2..3a51478f5cc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2689 2011-08-29 19:50:38Z joseph $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -741,10 +741,10 @@ % % \begin{function}[EXP]{\use:n, \use:nn, \use:nnn, \use:nnnn} % \begin{syntax} -% \cs{use:n} \Arg{group1} -% \cs{use:nn} \Arg{group1} \Arg{group2} -% \cs{use:nnn} \Arg{group1} \Arg{group2} \Arg{group3} -% \cs{use:nnn} \Arg{group1} \Arg{group2} \Arg{group3} \Arg{group4} +% \cs{use:n} \Arg{group1} +% \cs{use:nn} \Arg{group1} \Arg{group2} +% \cs{use:nnn} \Arg{group1} \Arg{group2} \Arg{group3} +% \cs{use:nnnn} \Arg{group1} \Arg{group2} \Arg{group3} \Arg{group4} % \end{syntax} % As illustrated, these functions will absorb between one and four % arguments, as indicated by the argument specifier. The braces @@ -849,8 +849,9 @@ % \end{syntax} % Fully expands the \meta{expandable tokens} and inserts the % result into the input stream at the current location. +% Any hash characters ("#") in the argument must be doubled. % \end{function} -% +% % \subsection{Selecting tokens from delimited arguments} % % A different kind of function for selecting tokens from the token @@ -941,7 +942,7 @@ % (other). % \end{function} % -% \begin{function}{[EXP]\cs_get_function_signature:N} +% \begin{function}[EXP]{\cs_get_function_signature:N} % \begin{syntax} % \cs{cs_get_function_signature:NN} \meta{function} % \end{syntax} @@ -951,7 +952,7 @@ % tokens with category code $12$ (other). % \end{function} % -% \begin{function}EXP]{\cs_split_function:NN} +% \begin{function}[EXP]{\cs_split_function:NN} % \begin{syntax} % \cs{cs_split_function:NN} \meta{function} \meta{processor} % \end{syntax} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 509f3b1ad7f..8ed5fa7a137 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -83,7 +83,7 @@ {\def\ExplFileDate{#2}} \protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 2558 2011-08-13 06:32:00Z joseph $ +\GetIdInfo$Id: l3bootstrap.dtx 2687 2011-08-29 19:48:45Z joseph $ {L3 experimental bootstrap code} %</package> %<*driver> @@ -131,7 +131,7 @@ % \cs{ExplSyntaxOn} \meta{code} \cs{ExplSyntaxOff} % \end{syntax} % The \cs{ExplSyntaxOn} function switches to a category code -% regim{\'e} in which spaces are ignored and in which the colon (|:|) +% r{\'e}gime in which spaces are ignored and in which the colon (|:|) % and underscore (|_|) are treated as \enquote{letters}, thus allowing % access to the names of code functions and variables. Within this % environment, |~| is used to input a space. The \cs{ExplSyntaxOff} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 8e5070145b4..d839bee4342 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3box.dtx 2711 2011-09-02 12:15:53Z joseph $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -193,7 +193,7 @@ % such that its reference point is displaced horizontally by the given % \meta{dimexpr} from the reference point for typesetting, to the right % or left as appropriate. The \meta{box function} should be -% a box opeeration such as |\box_use:N \<box>| or a \enquote{raw} +% a box operation such as |\box_use:N \<box>| or a \enquote{raw} % box specification such as |\vbox:n { xyz }|. % \end{function} % @@ -206,7 +206,7 @@ % such that its reference point is displaced vertical by the given % \meta{dimexpr} from the reference point for typesetting, up % or down as appropriate. The \meta{box function} should be -% a box opeeration such as |\box_use:N \<box>| or a \enquote{raw} +% a box operation such as |\box_use:N \<box>| or a \enquote{raw} % box specification such as |\vbox:n { xyz }|. % \end{function} % @@ -273,6 +273,92 @@ % Set the width of the \meta{box} to the value of the % \Arg{dimension expression}. This is a global assignment. % \end{function} +% +% \section{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. The resizing applies +% within the current \TeX{} group level. +% +% \textbf{This function is experimental} +% \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:Nnn} \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. The resizing applies +% within the current \TeX{} group level. +% +% \textbf{This function is experimental} +% \end{function} +% +% \begin{function}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} +% \begin{syntax} +% \cs{box_resize_to_wd:Nnn} \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. The resizing applies +% within the current \TeX{} group level. +% +% \textbf{This function is experimental} +% \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. +% +% \textbf{This function is experimental} +% \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. +% The scaling applies within the current \TeX{} group level. +% +% \textbf{This function is experimental} +% \end{function} % % \section{Box conditionals} % @@ -1210,6 +1296,580 @@ { \tex_setbox:D #1 \tex_vsplit:D #2 to \dim_eval:w #3 \dim_eval_end: } % \end{macrocode} % \end{macro} +% +% \subsection{Affine transformations} +% +% \begin{variable}{\l_box_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_box_angle_fp +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_box_cos_fp, \l_box_sin_fp} +% These are used to hold the calculated sine and cosine values while +% carrying out a rotation. +% \begin{macrocode} +\fp_new:N \l_box_cos_fp +\fp_new:N \l_box_sin_fp +% \end{macrocode} +% \end{variable} +% +% \begin{variable} +% {\l_box_top_dim, \l_box_bottom_dim, \l_box_left_dim, \l_box_right_dim} +% These are the positions of the four edges of a box before +% manipulation. +% \begin{macrocode} +\dim_new:N \l_box_top_dim +\dim_new:N \l_box_bottom_dim +\dim_new:N \l_box_left_dim +\dim_new:N \l_box_right_dim +% \end{macrocode} +% \end{variable} +% +% \begin{variable} +% { +% \l_box_top_new_dim, \l_box_bottom_new_dim , +% \l_box_left_new_dim, \l_box_right_new_dim +% } +% These are the positions of the four edges of a box after +% manipulation. +% \begin{macrocode} +\dim_new:N \l_box_top_new_dim +\dim_new:N \l_box_bottom_new_dim +\dim_new:N \l_box_left_new_dim +\dim_new:N \l_box_right_new_dim +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_box_tmp_box, \l_box_tmp_fp} +% Scratch space. +% \begin{macrocode} +\box_new:N \l_box_tmp_box +\fp_new:N \l_box_tmp_fp +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_box_x_fp, \l_box_y_fp, \l_box_x_new_fp, \l_box_y_new_fp} +% Used as the input and output values for a point when manipulation the +% location. +% \begin{macrocode} +\fp_new:N \l_box_x_fp +\fp_new:N \l_box_y_fp +\fp_new:N \l_box_x_new_fp +\fp_new:N \l_box_y_new_fp +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\box_rotate:Nn} +% \begin{macro}[aux]{\box_rotate_aux:N} +% \begin{macro}[aux]{\box_rotate_set_sin_cos:} +% \begin{macro}[aux]{\box_rotate_x:nnN, \box_rotate_y:nnN} +% \begin{macro}[aux] +% { +% \box_rotate_quadrant_one:, \box_rotate_quadrant_two:, +% \box_rotate_quadrant_three:, \box_rotate_quadrant_four: +% } +% Rotation of a box starts with working out the relevant sine and +% cosine. There is then a check to avoid doing any real work for the +% trivial rotation. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \box_rotate:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l_box_angle_fp {#2} + \box_rotate_set_sin_cos: + \fp_compare:NNNTF \l_box_sin_fp = \c_zero_fp + { + \fp_compare:NNNTF \l_box_cos_fp = \c_one_fp + { \box_use:N #1 } + { \box_rotate_aux:N #1 } + } + { \box_rotate_aux: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_nopar:Npn \box_rotate_aux:N #1 + { + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_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: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: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_box_sin_fp > \c_zero_fp + { + \fp_compare:NNNTF \l_box_cos_fp > \c_zero_fp + { \box_rotate_quadrant_one: } + { \box_rotate_quadrant_two: } + } + { + \fp_compare:NNNTF \l_box_cos_fp < \c_zero_fp + { \box_rotate_quadrant_three: } + { \box_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_box_tmp_box { \box_use:N #1 } + \hbox_set:Nn \l_box_tmp_box + { + \tex_kern:D -\l_box_left_new_dim + \hbox:n + { + \driver_box_rotate_begin: + \box_use:N \l_box_tmp_box + \driver_box_rotate_end: + } + } +% \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_box_tmp_box { \l_box_top_new_dim } + \box_set_dp:Nn \l_box_tmp_box { -\l_box_bottom_new_dim } + \box_set_wd:Nn \l_box_tmp_box + { \l_box_right_new_dim - \l_box_left_new_dim } + \box_use:N \l_box_tmp_box + } +% \end{macrocode} +% When loaded on top of \LaTeXe{} the \cs{rotatebox} function can be +% used. There is just a slight adjustment in the syntax. +% \begin{macrocode} +%<*package> +\cs_set_protected_nopar:Npn \box_rotate:Nn #1#2 + { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% A simple conversion from degrees to radians followed by calculation +% of the sine and cosine. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \box_rotate_set_sin_cos: + { + \fp_set_eq:NN \l_box_tmp_fp \l_box_angle_fp + \fp_div:Nn \l_box_tmp_fp { 180 } + \fp_mul:Nn \l_box_tmp_fp { \c_pi_fp } + \fp_sin:Nn \l_box_sin_fp { \l_box_tmp_fp } + \fp_cos:Nn \l_box_cos_fp { \l_box_tmp_fp } + } +% \end{macrocode} +% 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_nopar:Npn \box_rotate_x:nnN #1#2#3 + { + \fp_set_from_dim:Nn \l_box_x_fp {#1} + \fp_set_from_dim:Nn \l_box_y_fp {#2} + \fp_set_eq:NN \l_box_x_new_fp \l_box_x_fp + \fp_set_eq:NN \l_box_tmp_fp \l_box_y_fp + \fp_mul:Nn \l_box_x_new_fp { \l_box_cos_fp } + \fp_mul:Nn \l_box_tmp_fp { \l_box_sin_fp } + \fp_sub:Nn \l_box_x_new_fp { \l_box_tmp_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_box_x_new_fp } + } +\cs_new_protected_nopar:Npn \box_rotate_y:nnN #1#2#3 + { + \fp_set_from_dim:Nn \l_box_x_fp {#1} + \fp_set_from_dim:Nn \l_box_y_fp {#2} + \fp_set_eq:NN \l_box_y_new_fp \l_box_y_fp + \fp_set_eq:NN \l_box_tmp_fp \l_box_x_fp + \fp_mul:Nn \l_box_y_new_fp { \l_box_cos_fp } + \fp_mul:Nn \l_box_tmp_fp { \l_box_sin_fp } + \fp_add:Nn \l_box_y_new_fp { \l_box_tmp_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_box_y_new_fp } +} +% \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_nopar:Npn \box_rotate_quadrant_one: + { + \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_two: + { + \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_three: + { + \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_four: + { + \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim + \l_box_right_new_dim + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\l_box_scale_x_fp, \l_box_scale_y_fp} +% Scaling is potentially-different in the two axes. +% \begin{macrocode} +\fp_new:N \l_box_scale_x_fp +\fp_new:N \l_box_scale_y_fp +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\box_resize:Nnn, \box_resize:cnn} +% \begin{macro}[aux]{\box_resize_aux: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: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim +% \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_from_dim:Nn \l_box_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp { \l_box_right_dim } + \fp_div:Nn \l_box_scale_x_fp { \l_box_tmp_fp } +% \end{macrocode} +% The $y$-scaling needs both the height and the depth of the current box. +% \begin{macrocode} + \fp_set_from_dim:Nn \l_box_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_box_tmp_fp + { \l_box_top_dim - \l_box_bottom_dim } + \fp_div:Nn \l_box_scale_y_fp { \l_box_tmp_fp } +% \end{macrocode} +% At this stage, check for trivial scaling. If both scalings are unity, then +% the code does nothing. Otherwise, pass on to the auxiliary function to +% find the new dimensions. +% \begin{macrocode} + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#3} } + } + { \box_resize_aux:Nnn #1 {#2} {#3} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize:Nnn { c } +% \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. This is done using the absolute value of the +% scale so that the new edge is in the correct place. 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 \box_resize_aux:Nnn #1#2#3 + { + \dim_compare:nNnTF {#2} > \c_zero_dim + { \dim_set:Nn \l_box_right_new_dim {#2} } + { \dim_set:Nn \l_box_right_new_dim { \c_zero_dim - ( #2 ) } } + \dim_compare:nNnTF {#3} > \c_zero_dim + { + \dim_set:Nn \l_box_top_new_dim + { \fp_use:N \l_box_scale_y_fp \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim + { \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } + } + { + \dim_set:Nn \l_box_top_new_dim + { - \fp_use:N \l_box_scale_y_fp \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim + { - \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } + } + \box_resize_common:N #1 + } +% \end{macrocode} +% When loaded on top of \LaTeXe{} the \cs{resizebox} function can be +% used. There is just a slight adjustment in the syntax. +% \begin{macrocode} +%<*package> +\cs_set_protected_nopar:Npn \box_resize:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \resizebox * + { \etex_dimexpr:D #2 \scan_stop: } + { \etex_dimexpr:D #3 \scan_stop: } + { \box_use:N #1 } + } + } +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \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} +% 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_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_set_from_dim:Nn \l_box_scale_y_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp + { \l_box_top_dim - \l_box_bottom_dim } + \fp_div:Nn \l_box_scale_y_fp { \l_box_tmp_fp } + \fp_set_eq:NN \l_box_scale_x_fp \l_box_scale_y_fp + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#2} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } +\cs_new_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp { \l_box_right_dim } + \fp_div:Nn \l_box_scale_x_fp { \l_box_tmp_fp } + \fp_set_eq:NN \l_box_scale_y_fp \l_box_scale_x_fp + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#2} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } +% \end{macrocode} +% Again, in package mode the scaling can be handled by \cs{resizebox}. +% \begin{macrocode} +%<*package> +\cs_set_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { ! } { \etex_dimexpr:D #2 \scan_stop: } { \box_use:N #1 } + } + } +\cs_set_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { \etex_dimexpr:D #2 \scan_stop: } { ! } { \box_use:N #1 } + } + } +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\box_scale:Nnn, \box_scale:cnn} +% \begin{macro}[aux]{\box_scale_aux:Nnn} +% 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 \texttt{fp} +% operations. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \box_scale:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l_box_scale_x_fp {#2} + \fp_set:Nn \l_box_scale_y_fp {#3} + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_scale_aux:Nnn #1 {#2} {#3} } + } + { \box_scale_aux:Nnn #1 {#2} {#3} } + \group_end: + } + } +\cs_generate_variant:Nn \box_scale:Nnn { c } +\cs_new_protected_nopar:Npn \box_scale_aux:Nnn #1#2#3 + { + \fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp + { + \dim_set:Nn \l_box_top_new_dim { #3 \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim { #3 \l_box_bottom_dim } + } + { + \dim_set:Nn \l_box_top_new_dim { -#3 \l_box_bottom_dim } + \dim_set:Nn \l_box_bottom_new_dim { -#3 \l_box_top_dim } + } + \fp_compare:NNNTF \l_box_scale_x_fp > \c_zero_fp + { \l_box_right_new_dim #2 \l_box_right_dim } + { \l_box_right_new_dim -#2 \l_box_right_dim } + \box_resize_common:N #1 + } +% \end{macrocode} +% When loaded on top of \LaTeXe{} the \cs{scalebox} function can be +% used. There is just a slight adjustment in the syntax. +% \begin{macrocode} +%<*package> +\cs_set_protected_nopar:Npn \box_scale:Nnn #1#2#3 + { \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } } +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\box_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_nopar:Npn \box_resize_common:N #1 + { + \hbox_set:Nn \l_box_tmp_box + { + \driver_box_scale_begin: + \hbox_overlap_right:n { \box_use:N #1 } + \driver_box_scale_end: + } +% \end{macrocode} +% The new height and depth can be applied directly. +% \begin{macrocode} + \box_set_ht:Nn \l_box_tmp_box { \l_box_top_new_dim } + \box_set_dp:Nn \l_box_tmp_box { \l_box_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_box_scale_x_fp < \c_zero_fp + { + \hbox_to_wd:nn { \l_box_right_new_dim } + { + \tex_kern:D \l_box_right_new_dim + \box_use:N \l_box_tmp_box + \tex_hss:D + } + } + { + \box_set_wd:Nn \l_box_tmp_box { \l_box_right_new_dim } + \box_use:N \l_box_tmp_box + } + } +% \end{macrocode} +%\end{macro} % % \begin{macrocode} %</initex|package> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index bd15dbffb01..b2c09e72e15 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2666 2011-08-26 06:10:09Z joseph $ +\GetIdInfo$Id: l3clist.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental comma separated lists} %</driver|package> %<*driver> @@ -69,15 +69,25 @@ % \begin{documentation} % % Comma lists contain ordered data where items can be added to the left -% or right end of the sequence. This gives an ordered list which can -% then be utilised with the \cs{clist_map_function:NN} function. Comma -% Comma lists cannot contain empty items, thus +% or right end of the list. The resulting ordered list can then +% be mapped over using \cs{clist_map_function:NN}. Several items can +% be added at once, and spaces are removed from both sides of each item +% on input. Hence, % \begin{verbatim} % \clist_new:N \l_my_clist -% \clist_put_right:Nn \l_my_clist { } +% \clist_put_left:Nn \l_my_clist { ~ a ~ , ~ {b} ~ } +% \clist_put_right:Nn \l_my_clist { ~ { c ~ } , d } +% \end{verbatim} +% results in \cs{l_my_clist} containing |a,{b},{c~},d|. +% Comma lists cannot contain empty items, thus +% \begin{verbatim} +% \clist_clear_new:N \l_my_clist +% \clist_put_right:Nn \l_my_clist { , ~ , , } % \clist_if_empty:NTF \l_my_clist { true } { false } % \end{verbatim} -% will leave \texttt{true} in the input stream. +% will leave \texttt{true} in the input stream. To include an item +% which contains a comma, or starts or ends with a space, +% surround it with braces. % % \section{Creating and initialising comma lists} % @@ -183,9 +193,10 @@ % \clist_put_left:co, \clist_put_left:cx % } % \begin{syntax} -% \cs{clist_put_left:Nn} \meta{comma list} \Arg{item} +% \cs{clist_put_left:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} -% Appends the \meta{item} to the left of the \meta{comma list}. +% Appends the \meta{items} to the left of the \meta{comma list}. +% Spaces are removed from both sides of each item. % The assignment is restricted to the current \TeX{} group. % \end{function} % @@ -196,9 +207,10 @@ % \clist_gput_left:co, \clist_gput_left:cx % } % \begin{syntax} -% \cs{clist_gput_left:Nn} \meta{comma list} \Arg{item} +% \cs{clist_gput_left:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} -% Appends the \meta{item} to the left of the \meta{comma list}. +% Appends the \meta{items} to the left of the \meta{comma list}. +% Spaces are removed from both sides of each item. % The assignment is global. % \end{function} % @@ -209,9 +221,10 @@ % \clist_put_right:co, \clist_put_right:cx % } % \begin{syntax} -% \cs{clist_put_right:Nn} \meta{comma list} \Arg{item} +% \cs{clist_put_right:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} -% Appends the \meta{item} to the right of the \meta{comma list}. +% Appends the \meta{items} to the right of the \meta{comma list}. +% Spaces are removed from both sides of each item. % The assignment is restricted to the current \TeX{} group. % \end{function} % @@ -222,77 +235,13 @@ % \clist_gput_right:co, \clist_gput_right:cx % } % \begin{syntax} -% \cs{clist_gput_right:Nn} \meta{comma list} \Arg{item} +% \cs{clist_gput_right:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} % Appends the \meta{item} to the right of the \meta{comma list}. +% Spaces are removed from both sides of each item. % The assignment is global. % \end{function} % -% \section{Comma lists as stacks} -% -% \begin{function}{\clist_get:NN, \clist_get:cN} -% \begin{syntax} -% \cs{clist_get:NN} \meta{comma list} \meta{token list variable} -% \end{syntax} -% Stores the left-most item from a \meta{comma list} in the -% \meta{token list variable} without removing it from the -% \meta{comma list}. The \meta{token list variable} is assigned locally. -% \end{function} -% -% \begin{function}{\clist_get:NN, \clist_get:cN} -% \begin{syntax} -% \cs{clist_get:NN} \meta{comma list} \meta{token list variable} -% \end{syntax} -% Stores the right-most item from a \meta{comma list} in the -% \meta{token list variable} without removing it from the -% \meta{comma list}. The \meta{token list variable} is assigned locally. -% \end{function} -% -% \begin{function}{\clist_pop:NN, \clist_pop:cN} -% \begin{syntax} -% \cs{clist_pop:NN} \meta{comma list} \meta{token list variable} -% \end{syntax} -% Pops the left-most item from a \meta{comma list} into the -% \meta{token list variable}, \emph{i.e.}~removes the item from the -% comma list and stores it in the \meta{token list variable}. -% Both of the variables are assigned locally. -% \end{function} -% -% \begin{function}{\clist_gpop:NN, \clist_gpop:cN} -% \begin{syntax} -% \cs{clist_gpop:NN} \meta{comma list} \meta{token list variable} -% \end{syntax} -% Pops the left-most item from a \meta{comma list} into the -% \meta{token list variable}, \emph{i.e.}~removes the item from the -% comma list and stores it in the \meta{token list variable}. -% The \meta{comma list} is modified globally, while the assignment of -% the \meta{token list variable} is local. -% \end{function} -% -% \begin{function} -% { -% \clist_push:Nn, \clist_push:NV, \clist_push:No, \clist_push:Nx, -% \clist_push:cn, \clist_push:cV, \clist_push:co, \clist_push:cx -% } -% \begin{syntax} -% \cs{clist_push:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Adds the \Arg{item} to the top of the \meta{comma list}. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function} -% { -% \clist_gpush:Nn, \clist_gpush:NV, \clist_gpush:No, \clist_gpush:Nx, -% \clist_gpush:cn, \clist_gpush:cV, \clist_gpush:co, \clist_gpush:cx -% } -% \begin{syntax} -% \cs{clist_gpush:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Pushes the \meta{item} onto the end of the top of the -% \meta{comma list}. The assignment is global. -% \end{function} -% % \section{Using comma lists} % % \begin{function}[EXP]{\clist_use:N, \clist_use:c} @@ -322,6 +271,9 @@ % This function iterates through every item in the \meta{comma list} and % does a comparison with the \meta{items} already checked. It is therefore % relatively slow with large comma lists. +% Furthermore, it will not work if any of the items in the +% \meta{comma list} contains |{|, |}|, or |#| +% (assuming the usual \TeX{} category codes apply). % \end{texnote} % \end{function} % @@ -337,6 +289,9 @@ % This function iterates through every item in the \meta{comma list} and % does a comparison with the \meta{items} already checked. It is therefore % relatively slow with large comma lists. +% Furthermore, it will not work if any of the items in the +% \meta{comma list} contains |{|, |}|, or |#| +% (assuming the usual \TeX{} category codes apply). % \end{texnote} % \end{function} % @@ -347,6 +302,10 @@ % Removes every occurrence of \meta{item} from the \meta{comma list}. % The \meta{item} comparison takes place on a token basis, as for % \cs{tl_if_eq:nn(TF)}. The removal is local to the current \TeX{} group. +% \begin{texnote} +% The \meta{item} may not contain |{|, |}|, or |#| +% (assuming the usual \TeX{} category codes apply). +% \end{texnote} % \end{function} % % \begin{function}{\clist_gremove_all:Nn, \clist_gremove_all:cn} @@ -356,33 +315,10 @@ % Removes each occurrence of \meta{item} from the \meta{comma list}. % The \meta{item} comparison takes place on a token basis, as for % \cs{tl_if_eq:nn(TF)}. The removal is applied globally. -% \end{function} -% -% \begin{function}{\clist_trim_spaces:N, \clist_trim_spaces:c} -% \begin{syntax} -% \cs{clist_trim_spaces:N} \meta{comma list} -% \end{syntax} -% Removes leading and trailing spaces from each \meta{item} in the -% \meta{comma list} within the current \TeX{} group. This space-removal -% process takes place as described for \cs{tl_trim_spaces:n}. -% \end{function} -% -% \begin{function}{\clist_gtrim_spaces:N, \clist_gtrim_spaces:c} -% \begin{syntax} -% \cs{clist_gtrim_spaces:N} \meta{comma list} -% \end{syntax} -% Removes leading and trailing spaces from each \meta{item} in the -% \meta{comma list} globally. This space-removal -% process takes place as described for \cs{tl_trim_spaces:n}. -% \end{function} -% -% \begin{function}[EXP]{\clist_trim_spaces:n} -% \begin{syntax} -% \cs{clist_trim_spaces:N} \meta{comma list} -% \end{syntax} -% Removes leading and trailing spaces from each \meta{item} in the -% \meta{comma list}, leaving the resulting modified list in the -% input stream. +% \begin{texnote} +% The \meta{item} may not contain |{|, |}|, or |#| +% (assuming the usual \TeX{} category codes apply). +% \end{texnote} % \end{function} % % \section{Comma list conditionals} @@ -418,11 +354,32 @@ % ~~\Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{item} is present in the \meta{comma list}. +% \begin{texnote} +% The \meta{item} may not contain |{|, |}|, or |#| +% (assuming the usual \TeX{} category codes apply). +% \end{texnote} % \end{function} % % \section{Mapping to comma lists} % -% \begin{function}[EXP] +% The functions described in this section apply a specified function +% to each item of a comma list. +% +% When the comma list is given explicitly, as an \texttt{n}-type argument, +% spaces are trimmed around each item. +% If the result of trimming spaces is empty, the item is ignored. +% Otherwise, if the item is surrounded by braces, one set is removed, +% and the result is passed to the mapped function. Thus, if your +% comma list that is being mapped is \verb*|{a , {b }, ,{}, {c},}| +% then the arguments passed to the mapped function are +% `\verb*|a|', `\verb*|{b }|', an empty argument, and `\verb*|c|'. +% +% When the comma list is given as an \texttt{N}-type argument, spaces +% have already been trimmed on input, and items are simply stripped +% of one set of braces if any. This case is more efficient than using +% \texttt{n}-type comma lists. +% +% \begin{function}[rEXP] % {\clist_map_function:NN, \clist_map_function:cN, \clist_map_function:nN} % \begin{syntax} % \cs{clist_map_function:NN} \meta{comma list} \meta{function} @@ -461,7 +418,7 @@ % are returned from left to right. % \end{function} % -% \begin{function}[EXP]{\clist_map_break:} +% \begin{function}[rEXP]{\clist_map_break:} % \begin{syntax} % \cs{clist_map_break:} % \end{syntax} @@ -480,7 +437,7 @@ % \end{verbatim} % Use outside of a \cs{clist_map_\ldots} scenario will lead to low % level \TeX{} errors. -% \begin{texnote} +% \begin{texnote}^^A temporarily untrue, fixed next week. % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{clist_break_point:n} before further items are taken % from the input stream. This will depend on the design of the mapping @@ -488,7 +445,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\clist_map_break:n} +% \begin{function}[rEXP]{\clist_map_break:n} % \begin{syntax} % \cs{clist_map_break:n} \Arg{tokens} % \end{syntax} @@ -525,50 +482,64 @@ % in the previous section: a comma list should either be used as an % ordered data type or as a stack, but not in both ways. % +% \section{Comma lists as stacks} +% % \begin{function}{\clist_get:NN, \clist_get:cN} % \begin{syntax} % \cs{clist_get:NN} \meta{comma list} \meta{token list variable} % \end{syntax} -% Reads the top item from a \meta{comma list} into the +% Stores the left-most item from a \meta{comma list} in the +% \meta{token list variable} without removing it from the +% \meta{comma list}. The \meta{token list variable} is assigned locally. +% \end{function} +% +% \begin{function}{\clist_get:NN, \clist_get:cN} +% \begin{syntax} +% \cs{clist_get:NN} \meta{comma list} \meta{token list variable} +% \end{syntax} +% Stores the right-most item from a \meta{comma list} in the % \meta{token list variable} without removing it from the % \meta{comma list}. The \meta{token list variable} is assigned locally. -% If \meta{comma list} is empty an error will be raised. % \end{function} % % \begin{function}{\clist_pop:NN, \clist_pop:cN} % \begin{syntax} % \cs{clist_pop:NN} \meta{comma list} \meta{token list variable} % \end{syntax} -% Pops the top item from a \meta{comma list} into the -% \meta{token list variable}. Both of the variables are assigned -% locally. If \meta{comma list} is empty an error will be raised. +% Pops the left-most item from a \meta{comma list} into the +% \meta{token list variable}, \emph{i.e.}~removes the item from the +% comma list and stores it in the \meta{token list variable}. +% Both of the variables are assigned locally. % \end{function} % % \begin{function}{\clist_gpop:NN, \clist_gpop:cN} % \begin{syntax} % \cs{clist_gpop:NN} \meta{comma list} \meta{token list variable} % \end{syntax} -% Pops the top item from a \meta{comma list} into the -% \meta{token list variable}. The \meta{comma list} is modified globally, -% while the \meta{token list variable} is assigned locally. If -% \meta{comma list} is empty an error will be raised. +% Pops the left-most item from a \meta{comma list} into the +% \meta{token list variable}, \emph{i.e.}~removes the item from the +% comma list and stores it in the \meta{token list variable}. +% The \meta{comma list} is modified globally, while the assignment of +% the \meta{token list variable} is local. % \end{function} % -% \begin{function}{ -% \clist_push:Nn, \clist_push:NV, \clist_push:No, \clist_push:Nx, -% \clist_push:cn, \clist_push:cV, \clist_push:co, \clist_push:cx -% } +% \begin{function} +% { +% \clist_push:Nn, \clist_push:NV, \clist_push:No, \clist_push:Nx, +% \clist_push:cn, \clist_push:cV, \clist_push:co, \clist_push:cx +% } % \begin{syntax} % \cs{clist_push:Nn} \meta{comma list} \Arg{item} % \end{syntax} % Adds the \Arg{item} to the top of the \meta{comma list}. -% The assignment is restricted to the current \TeX{} group. +% The assignment is restricted to the current \TeX{} group. % \end{function} % -% \begin{function}{ -% \clist_gpush:Nn, \clist_gpush:NV, \clist_gpush:No, \clist_gpush:Nx, -% \clist_gpush:cn, \clist_gpush:cV, \clist_gpush:co, \clist_gpush:cx -% } +% \begin{function} +% { +% \clist_gpush:Nn, \clist_gpush:NV, \clist_gpush:No, \clist_gpush:Nx, +% \clist_gpush:cn, \clist_gpush:cV, \clist_gpush:co, \clist_gpush:cx +% } % \begin{syntax} % \cs{clist_gpush:Nn} \meta{comma list} \Arg{item} % \end{syntax} @@ -638,6 +609,36 @@ % \meta{sequence}. % \end{function} % +% \section{Deprecated comma-list functions} +% +% \begin{function}{\clist_trim_spaces:N, \clist_trim_spaces:c} +% \begin{syntax} +% \cs{clist_trim_spaces:N} \meta{comma list} +% \end{syntax} +% Removes leading and trailing spaces from each \meta{item} in the +% \meta{comma list} within the current \TeX{} group. This space-removal +% process takes place as described for \cs{tl_trim_spaces:n}. +% \end{function} +% +% \begin{function}{\clist_gtrim_spaces:N, \clist_gtrim_spaces:c} +% \begin{syntax} +% \cs{clist_gtrim_spaces:N} \meta{comma list} +% \end{syntax} +% Removes leading and trailing spaces from each \meta{item} in the +% \meta{comma list} globally. This space-removal +% process takes place as described for \cs{tl_trim_spaces:n}. +% \end{function} +% +% \begin{function}[rEXP]{\clist_trim_spaces:n} +% \begin{syntax} +% \cs{clist_trim_spaces:N} \meta{comma list} +% \end{syntax} +% Removes leading and trailing spaces from each \meta{item} in the +% \meta{comma list}, leaving the resulting modified list in the +% input stream. +% \end{function} +% +% % \end{documentation} % % \begin{implementation} @@ -658,6 +659,8 @@ %</package> % \end{macrocode} % +%^^A todo: provide users with \l_tmpa_clist and friends? +% % \begin{variable}{\l_clist_tmpa_tl, \l_clist_tmpb_tl} % Scratch space for various internal uses. % \begin{macrocode} @@ -765,6 +768,91 @@ % \end{macro} % \end{macro} % +% \subsection{Removing spaces around items} +% +% \begin{macro}[aux]{\clist_tmp:w} +% A temporary function for various purposes. +% \begin{macrocode} +\cs_new_protected:Npn \clist_tmp:w { } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int,EXP]{\clist_trim_spaces_generic:nw} +% \begin{macro}[aux]{\clist_trim_spaces_generic_aux:w} +% \begin{macro}[aux]{\clist_trim_spaces_generic_aux_ii:nn} +% Used as `\cs{clist_trim_spaces_generic:nw} \Arg{code} +% \cs{q_mark} \meta{item} |,|' (including the comma). +% This expands to the \meta{code}, followed by a brace group +% containing the \meta{item}, with leading and trailing spaces removed. +% The calling function is responsible for inserting \cs{q_mark} +% in front of the \meta{item}, as well as testing for the end of the list. +% See \cs{tl_trim_spaces:n} for a partial explanation of what +% is happening here. We changed \cs{tl_trim_spaces_aux_iv:w} +% into \cs{clist_trim_spaces_generic_aux:w} compared to +% \cs{tl_trim_spaces:n}, and dropped a \cs{q_mark}, which is +% already included in the argument |##2|. +% \begin{macrocode} +\cs_set:Npn \clist_tmp:w #1 + { + \cs_new:Npn \clist_trim_spaces_generic:nw ##1 ##2 , + { + \tl_trim_spaces_aux_i:w + ##2 + \q_nil + \q_mark #1 { } + \q_mark \tl_trim_spaces_aux_ii:w + \tl_trim_spaces_aux_iii:w + #1 \q_nil + \clist_trim_spaces_generic_aux:w + \q_stop + {##1} + } + } +\clist_tmp:w {~} +\cs_new:Npn \clist_trim_spaces_generic_aux:w #1 \q_nil #2 \q_stop + { \exp_args:No \clist_trim_spaces_generic_aux_ii:nn { \use_none:n #1 } } +\cs_new:Npn \clist_trim_spaces_generic_aux_ii:nn #1 #2 { #2 {#1} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int,rEXP]{\clist_trim_spaces:n} +% \begin{macro}[aux]{\clist_trim_spaces_aux:n,\clist_trim_spaces_aux_ii:nn} +% The argument of \cs{clist_trim_spaces_aux:n} is initially empty, +% and later a comma, namely, as soon as we have added an item to the +% resulting list. The second auxiliary tests for the end of the list, +% and also prevents empty arguments from finding their way into the +% output. +% \begin{macrocode} +\cs_new:Npn \clist_trim_spaces:n #1 + { + \clist_trim_spaces_aux:n { } \q_mark #1 , + \q_recursion_tail, \q_recursion_stop + } +\cs_new:Npn \clist_trim_spaces_aux:n #1 + { + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux_ii:nn {#1} } + } +\cs_new:Npn \clist_trim_spaces_aux_ii:nn #1 #2 + { + \quark_if_recursion_tail_stop:n {#2} + \tl_if_empty:nTF {#2} + { + \clist_trim_spaces_aux:n {#1} \q_mark + } + { + #1 \exp_not:n {#2} + \clist_trim_spaces_aux:n { , } \q_mark + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% % \subsection{Appending items to comma lists} % % \begin{macro} @@ -774,7 +862,7 @@ % \clist_put_left:cn, \clist_put_left:cV, % \clist_put_left:co, \clist_put_left:cx % } -% \UnitTested +%^^A \UnitTested % \begin{macro} % { % \clist_gput_left:Nn, \clist_gput_left:NV, @@ -782,19 +870,23 @@ % \clist_gput_left:cn, \clist_gput_left:cV, % \clist_gput_left:co, \clist_gput_left:cx % } -% \UnitTested +%^^A \UnitTested % Comma lists cannot hold empty values: there are therefore a couple % of sanity checks to avoid accumulating commas. % \begin{macrocode} \cs_new_protected_nopar:Npn \clist_put_left:Nn - { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_left:Nn { } , } + { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_left:Nx { } , } \cs_new_protected_nopar:Npn \clist_gput_left:Nn - { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_left:Nn { } , } + { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_left:Nx { } , } \cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 { + \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#6} } \clist_if_empty:NTF #5 - { #1 #5 {#6} } - { \tl_if_empty:nF {#6} { #2 #5 { #3 #6 #4 } } } + { #1 #5 \l_clist_tmpa_tl } + { + \tl_if_empty:NF \l_clist_tmpa_tl + { #2 #5 { #3 \exp_not:o \l_clist_tmpa_tl #4 } } + } } \cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } @@ -811,6 +903,7 @@ % \clist_put_right:cn, \clist_put_right:cV, % \clist_put_right:co, \clist_put_right:cx % } +% \UnitTested % \begin{macro} % { % \clist_gput_right:Nn, \clist_gput_right:NV, @@ -818,12 +911,12 @@ % \clist_gput_right:cn, \clist_gput_right:cV, % \clist_gput_right:co, \clist_gput_right:cx % } -% The same for the right side. +% \UnitTested % \begin{macrocode} \cs_new_protected:Npn \clist_put_right:Nn - { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_right:Nn , { } } + { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_right:Nx , { } } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_right:Nn , { } } + { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_right:Nx , { } } \cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } @@ -859,6 +952,7 @@ % |#2| containing either the remainder of the list \emph{or} \cs{q_nil} % if there were insufficient items. That keeps the number of auxiliary % functions down. +%^^A broken for {a,{b,c}}, which unbraces {b,c}. % \begin{macrocode} \cs_new_protected_nopar:Npn \clist_pop:NN { \clist_pop_aux:NNN \tl_set:Nn } @@ -1010,47 +1104,9 @@ % \end{macro} % \end{macro} % \end{macro} -% -% \begin{macro}{\clist_trim_spaces:n} -% \begin{macro} -% { -% \clist_trim_spaces:N, \clist_trim_spaces:c, -% \clist_gtrim_spaces:N, \clist_gtrim_spaces:c -% } -% \begin{macro}{\clist_trim_spaces_aux_i:n} -% \begin{macro}{\clist_trim_spaces_aux_ii:n} -% Here, the basic plan is to use \cs{tl_trim_spaces:n} to do the work: -% the only issue is to make sure that the number of commas at the end of -% the process is correct. -% \begin{macrocode} -\cs_new:Npn \clist_trim_spaces:n #1 - { - \exp_args:Nf \clist_trim_spaces_aux_i:n - { \clist_map_function:nN {#1} \clist_trim_spaces_aux_ii:n } - } -\cs_new:Npn \clist_trim_spaces_aux_i:n #1 { \use_ii:nn #1 } -\cs_new:Npn \clist_trim_spaces_aux_ii:n #1 - { , \tl_trim_spaces:n {#1} } -\cs_new_protected:Npn \clist_trim_spaces:N #1 - { \tl_set:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } -\cs_new_protected:Npn \clist_gtrim_spaces:N #1 - { \tl_gset:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } -\cs_generate_variant:Nn \clist_trim_spaces:N { c } -\cs_generate_variant:Nn \clist_gtrim_spaces:N { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \subsection{Comma list conditionals} % -% \begin{macro}[aux]{\clist_tmp:w} -% A temporary function for comparison. -% \begin{macrocode} -\cs_new_protected:Npn \clist_tmp:w { } -% \end{macrocode} -% \end{macro} +% \subsection{Comma list conditionals} % % \begin{macro}[pTF]{\clist_if_empty:N, \clist_if_empty:c} % \UnitTested @@ -1135,14 +1191,6 @@ , \q_recursion_tail , \q_recursion_stop } } -\cs_new:Npn \clist_map_function:nN #1#2 - { - \tl_if_empty:nF {#1} - { - \clist_map_function_aux:Nw #2 #1 - , \q_recursion_tail , \q_recursion_stop - } - } \cs_new:Npn \clist_map_function_aux:Nw #1#2 , { \quark_if_recursion_tail_stop:n {#2} @@ -1197,32 +1245,78 @@ % % \begin{macro}{\clist_map_variable:NNn, \clist_map_variable:cNn} % \UnitTested -% This is just a dedicated version of the inline mapping. +% \begin{macro}{\clist_map_variable:nNn} +% \begin{macro}[aux]{\clist_map_variable_aux:Nnw} +% This is similar to the \cs{clist_map_function:NN} code. +% The \texttt{n} version is done by first trimming all spaces, +% then using the \texttt{N} version. % \begin{macrocode} \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 { - \clist_map_inline:Nn #1 + \clist_if_empty:NF #1 { - \tl_set:Nn #2 {##1} - #3 + \exp_args:Nno \use:nn + { \clist_map_variable_aux:Nnw #2 {#3} } + #1 + , \q_recursion_tail , \q_recursion_stop } } -\cs_new_protected:Npn \clist_map_variable:nNn #1#2#3 +\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3 , { - \clist_map_inline:nn {#1} - { - \tl_set:Nn #2 {##1} - #3 - } + \quark_if_recursion_tail_stop:n {#3} + \tl_set:Nn #1 {#3} + #2 + \clist_map_variable_aux:Nnw #1 {#2} + } +\cs_new_protected:Npn \clist_map_variable:nNn #1 + { + \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#1} } + \clist_map_variable:NNn \l_clist_tmpa_tl } \cs_generate_variant:Nn \clist_map_variable:NNn { c } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\clist_map_aux_unbrace:Nw} +% Within mappings with explicit \texttt{n}-type comma lists, +% braces must be stripped after space trimming. Here, |#1| +% is the function to map, and |#2| the item to brace-strip. +% \begin{macrocode} +\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\clist_map_function:nN} +% \begin{macro}[aux]{\clist_map_function_n_aux:Nn} +% Space trimming is again based on \cs{clist_trim_spaces_generic:nw}. +% The auxiliary \cs{clist_map_function_n_aux:Nn} receives +% as arguments the function, and the result of removing leading +% and trailing spaces from the item which lies until the next comma. +% Empty items are ignored before brace stripping by +% \cs{clist_map_aux_unbrace:Nw}. +% \begin{macrocode} +\cs_new:Npn \clist_map_function:nN #1#2 + { + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } + \q_mark #1, \q_recursion_tail, \q_recursion_stop + } +\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 + { + \quark_if_recursion_tail_stop:n {#2} + \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } + \q_mark + } +% \end{macrocode} +% \end{macro} +% \end{macro} % % \begin{macro}{\clist_map_break:} % \UnitTested % \begin{macro}{\clist_map_break:n} -% Both are simple renaming. +% Both are simple renaming.^^A todo: fix \clist_map_break:n (cf. seq). % \begin{macrocode} \cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w \cs_new_eq:NN \clist_map_break:n \use_i_delimit_by_q_recursion_stop:nw @@ -1246,13 +1340,13 @@ { \clist_if_empty:NTF #1 { - \iow_term:x { Comma~list~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Comma~list~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Comma~list~\token_to_str:N #1 \c_space_tl + Comma~list~\token_to_str:N #1~ contains~the~items~(without~outer~braces): } \tl_set:Nx \l_clist_show_tl @@ -1281,6 +1375,7 @@ % Counting the items in a comma list is done using the same approach as for % other length functions: turn each entry into a \texttt{+1} then use % integer evaluation to actually do the mathematics. +%^^A todo: make a faster version avoiding \clist_map_function:nN? % \begin{macrocode} \cs_new:Npn \clist_length:N #1 { @@ -1347,11 +1442,13 @@ % \clist_set_from_seq:NN, \clist_set_from_seq:cN, % \clist_set_from_seq:Nc, \clist_set_from_seq:cc % } +% \UnitTested % \begin{macro} % { % \clist_gset_from_seq:NN, \clist_gset_from_seq:cN, % \clist_gset_from_seq:Nc, \clist_gset_from_seq:cc % } +% \UnitTested % Setting a comma list from a comma-separated list is done using a simple % mapping. We wrap each item with braces, \cs{exp_not:n}, and a comma. The % first comma must be removed, except in the case of an empty comma-list. @@ -1372,7 +1469,7 @@ \seq_if_empty:NTF #2 { \clist_gclear:N #1 } { - \seq_push_item_def:n { , \exp_not:n {##1} } + \seq_push_item_def:n { , \exp_not:n {{##1}} } \tl_gset:Nx #1 { \exp_after:wN \use_none:n \tex_romannumeral:D -`\0 #2 } \seq_pop_item_def: @@ -1391,6 +1488,7 @@ % Deprecated on 2011-05-27, for removal by 2011-08-31. % % \begin{macro}{\clist_top:NN, \clist_top:cN} +% \UnitTested % These are old stack functions. % \begin{macrocode} \cs_new_eq:NN \clist_top:NN \clist_get:NN @@ -1398,15 +1496,14 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\clist_remove_element:Nn} -% \begin{macro}{\clist_gremove_element:Nn} +% \begin{macro}{\clist_remove_element:Nn,\clist_gremove_element:Nn} +% \UnitTested % An older name for \cs{clist_remove_all:Nn}. % \begin{macrocode} \cs_new_eq:NN \clist_remove_element:Nn \clist_remove_all:Nn \cs_new_eq:NN \clist_gremove_element:Nn \clist_gremove_all:Nn % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\clist_display:N, \clist_display:c} % An older name for \cs{clist_show:N}. @@ -1415,6 +1512,26 @@ \cs_new_eq:NN \clist_display:c \clist_show:c % \end{macrocode} % \end{macro} +% +% Deprecated on 2011-09-05, for removal by 2012-09-04. +% +% \begin{macro} +% { +% \clist_trim_spaces:N, \clist_trim_spaces:c, +% \clist_gtrim_spaces:N, \clist_gtrim_spaces:c +% } +% Since clist items are now always stripped from their surrounding +% spaces, it is redundant to provide these functions. +% \begin{macrocode} +\cs_new_protected:Npn \clist_trim_spaces:N #1 + { \tl_set:Nx #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_new_protected:Npn \clist_gtrim_spaces:N #1 + { \tl_gset:Nx #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_generate_variant:Nn \clist_trim_spaces:N { c } +\cs_generate_variant:Nn \clist_gtrim_spaces:N { c } +% \end{macrocode} +% \end{macro} +% % % \begin{macrocode} %</initex|package> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 87df9402d1d..8feef032c77 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -35,8 +35,8 @@ %% % %<*driver|package> -\RequirePackage{l3names,graphicx,color} -\GetIdInfo$Id: l3coffins.dtx 2624 2011-08-18 19:02:45Z joseph $ +\RequirePackage{l3names} +\GetIdInfo$Id: l3coffins.dtx 2717 2011-09-03 13:40:31Z joseph $ {L3 Experimental coffin code layer} %</driver|package> %<*driver> @@ -72,7 +72,7 @@ % for coffins. For details about the design concept of a coffin, see % the \pkg{xcoffins} module (in the \pkg{l3experimental} bundle). % -% \section{Code-level coffin functions} +% \section{Creating and initialising coffins} % % \begin{function}{\coffin_new:N, \coffin_new:c} % \begin{syntax} @@ -99,6 +99,8 @@ % Sets both the content and poles of \meta{coffin1} equal to those % of \meta{coffin2} within the current \TeX\ group level. % \end{function} +% +% \section{Setting coffin content and poles} % % \begin{function}{\hcoffin_set:Nn, \hcoffin_set:cn} % \begin{syntax} @@ -148,7 +150,22 @@ % \cs{Width}, which will evaluate to the appropriate dimensions of % the \meta{coffin}. % \end{function} -% +% +% \section{Coffin transformations} +% +% \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn} +% \begin{syntax} +% \cs{coffin_resize:Nnn} \meta{coffin} \Arg{width} \Arg{total-height} +% \end{syntax} +% Resized the \meta{coffin} to \meta{width} and \meta{total-height}, +% both of which should be given as dimension expressions. These may +% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and +% \cs{Width}, which will evaluate to the appropriate dimensions of +% the \meta{coffin}. +% +% \textbf{This function is experimental.} +% \end{function} +% % \begin{function}{\coffin_rotate:Nn, \coffin_rotate:cn} % \begin{syntax} % \cs{coffin_rotate:Nn} \meta{coffin} \Arg{angle} @@ -159,6 +176,19 @@ % the bounding box of the coffin growing unnecessarily. % \end{function} % +% \begin{function}{\coffin_scale:Nnn, \coffin_scale:cnn} +% \begin{syntax} +% \cs{coffin_scale:Nnn} \meta{coffin} \Arg{x-scale} \Arg{y-scale} +% \end{syntax} +% Scales the \meta{coffin} by a factors \meta{x-scale} and +% \meta{y-scale} in the horizontal and vertical directions, +% respectively. The two scale factors should be given as real numbers. +% +% \textbf{This function is experimental.} +% \end{function} +% +% \section{Joining and using coffins} +% % \begin{function} % { % \coffin_attach:NnnNnnnn, \coffin_attach:cnnNnnnn, @@ -221,6 +251,8 @@ % therefore analogous to carrying out an alignment where the % \enquote{parent} coffin is the current insertion point. % \end{function} +% +% \section{Coffin diagnostics} % % \begin{function}{\coffin_display_handles:cn, \coffin_display_handles:cn} % \begin{syntax} @@ -476,12 +508,12 @@ \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } { #2 } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } @@ -535,15 +567,10 @@ { \hbox_set:Nn #1 { - \group_begin: -%<*initex> - \color_set_current: % TODO -%</initex> -%<*package> - \set@color -%</package> + \color_group_begin: + \color_ensure_current: #2 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -567,15 +594,10 @@ \vbox_set:Nn #1 { \dim_set:Nn \tex_hsize:D {#2} - \group_begin: -%<*initex> - \color_set_current: -%</initex> -%<*package> - \set@color -%</package> + \color_group_begin: + \color_ensure_current: #3 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -641,7 +663,7 @@ \prop_get:cnNF { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 { - \msg_kernel_error:nnxx { coffin } { unknown-coffin-pole } + \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } } @@ -843,7 +865,7 @@ \l_coffin_pole_a_tl \l_coffin_pole_b_tl \bool_if:NT \l_coffin_error_bool { - \msg_kernel_error:nn { coffin } { no-pole-intersection } + \msg_kernel_error:nn { coffins } { no-pole-intersection } \dim_zero:N \l_coffin_x_dim \dim_zero:N \l_coffin_y_dim } @@ -1379,12 +1401,7 @@ % \begin{macrocode} \coffin_find_corner_maxima:N #1 \coffin_find_bounding_shift: -%<*initex> - \hbox_set:Nn #1 { \box_rotate:Nn #1 {#2} } % TODO -%</initex> -%<*package> - \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } -%</package> + \box_rotate:Nn #1 {#2} % \end{macrocode} % The correction of the box position itself takes place here. The idea % is that the bounding box for a coffin is tight up to the content, and @@ -1587,6 +1604,168 @@ % \end{macrocode} % \end{macro} % \end{macro} +% +% \subsection{Resizing coffins} +% +% \begin{variable}{\l_coffin_scale_x_fp} +% \begin{variable}{\l_coffin_scale_y_fp} +% Storage for the scaling factors in $x$ and $y$, respectively. +% \begin{macrocode} +\fp_new:N \l_coffin_scale_x_fp +\fp_new:N \l_coffin_scale_y_fp +% \end{macrocode} +% \end{variable} +% \end{variable} +% +% \begin{variable}{\l_coffin_scaled_total_height_dim} +% \begin{variable}{\l_coffin_scaled_width_dim} +% When scaling, the values given have to be turned into absolute values. +% \begin{macrocode} +\dim_new:N \l_coffin_scaled_total_height_dim +\dim_new:N \l_coffin_scaled_width_dim +% \end{macrocode} +% \end{variable} +% \end{variable} +% +% \begin{macro}{\coffin_resize:Nnn, \coffin_resize:cnn} +% Resizing a coffin begins by setting up the user-friendly names for +% the dimensions of the coffin box. The new sizes are then turned into +% scale factor. This is the same operation as takes place for the +% underlying box, but that operation is grouped and so the same +% calculation is done here. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_resize:Nnn #1#2#3 + { + \coffin_set_user_dimensions:N #1 + \box_resize:Nnn #1 {#2} {#3} + \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \Width } + \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \TotalHeight } + \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_tmp_fp } + \coffin_resize_common:Nnn #1 {#2} {#3} + } +\cs_generate_variant:Nn \coffin_resize:Nnn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\coffin_resize_common:Nnn} +% The poles and corners of the coffin are scaled to the appropriate +% places before actually resizing the underlying box. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_resize_common:Nnn #1#2#3 + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_scale_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } +% \end{macrocode} +% Negative $x$-scaling values will place the poles in the wrong +% location: this is corrected here. +% \begin{macrocode} + \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } + } + \coffin_end_user_dimensions: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\coffin_scale:Nnn, \coffin_scale:cnn} +% For scaling, the opposite calculation is done to find the new +% dimensions for the coffin. Only the total height is needed, as this +% is the shift required for corners and poles. The scaling is done +% the \TeX{} way as this works properly with floating point values +% without needing to use the \texttt{fp} module. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_scale:Nnn #1#2#3 + { + \box_scale:Nnn #1 {#2} {#3} + \coffin_set_user_dimensions:N #1 + \fp_set:Nn \l_coffin_scale_x_fp {#2} + \fp_set:Nn \l_coffin_scale_y_fp {#3} + \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp + { \l_coffin_scaled_total_height_dim #3 \TotalHeight } + { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } + \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp + { \l_coffin_scaled_width_dim -#2 \Width } + { \l_coffin_scaled_width_dim #2 \Width } + \coffin_resize_common:Nnn #1 + { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } + } +\cs_generate_variant:Nn \coffin_scale:Nnn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\coffin_scale_vector:nnNN} +% This functions scales a vector from the origin using the pre-set scale +% factors in $x$ and $y$. This is a much less complex operation +% than rotation, and as a result the code is a lot clearer. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_scale_vector:nnNN #1#2#3#4 + { + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#1} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_x_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#2} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_y_fp } + \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_tmp_fp } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\coffin_scale_corner:Nnnn} +% \begin{macro}{\coffin_scale_pole:Nnnnnn} +% Scaling both corners and poles is a simple calculation using the +% preceding vector scaling. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_scale_corner:Nnnn #1#2#3#4 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } + } +\cs_new_protected_nopar:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + {#5} {#6} + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\coffin_x_shift_corner:Nnnn} +% \begin{macro}{\coffin_x_shift_pole:Nnnnnn} +% These functions correct for the $x$ displacement that takes +% place with a negative horizontal scaling. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 + { + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} + } + } +\cs_new_protected_nopar:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 + { + \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n #3 + \box_wd:N #1 } {#4} + {#5} {#6} + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} % % \subsection{Coffin diagnostics} % @@ -1954,7 +2133,7 @@ % \subsection{Messages} % % \begin{macrocode} -\msg_kernel_new:nnnn { coffin } { no-pole-intersection } +\msg_kernel_new:nnnn { coffins } { no-pole-intersection } { No~intersection~between~coffin~poles. } { \c_msg_coding_error_text_tl @@ -1962,10 +2141,10 @@ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin } +\msg_kernel_new:nnnn { coffins } { unknown-coffin } { Unknown~coffin~'#1'. } { The~coffin~'#1'~was~never~defined. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin-pole } +\msg_kernel_new:nnnn { coffins } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { \c_msg_coding_error_text_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx new file mode 100644 index 00000000000..0570e50a575 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -0,0 +1,152 @@ +% \iffalse meta-comment +% +%% File: l3color.dtx Copyright(C) 2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +% +%<*driver|package> +\RequirePackage{l3names} +\GetIdInfo$Id: l3color.dtx 2717 2011-09-03 13:40:31Z joseph $ + {L3 Experimental colour support} +%</driver|package> +%<*driver> +\documentclass[full]{l3doc} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \title{^^A +% The \textsf{l3drivers} package\\ Colour support^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% This module provides support for colour in \LaTeX3{}. At present, the +% material here is mainly intended to support a small number of low-level +% requirements in other \pkg{l3kernel} modules. +% +% \section{Colour in boxes} +% +% Controlling the colour of text in boxes requires a small number of control +% functions, so that the boxed material uses the colour at the point where +% it is set, rather than where it is used. +% +% \begin{function}{\color_group_begin:, \color_group_end:} +% \begin{syntax} +% \cs{color_group_begin:} +% \ldots +% \cs{color_group_end:} +% \end{syntax} +% Creates a colour group: one used to \enquote{trap} colour settings. +% \end{function} +% +% \begin{function}{\color_ensure_current:} +% \begin{syntax} +% \cs{color_ensure_current:} +% \end{syntax} +% Ensures that material inside a box will use the foreground colour +% at the point where the box is set, rather than that in force when the +% box is used. This function should usually be used within a +% \cs{color_group_begin:} \ldots \cs{color_group_end:} group. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3color} Implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +%</package> +% \end{macrocode} +% +% \begin{macro}{\color_group_begin:, \color_group_end:} +% Grouping for colour is almost the same as using the basic \cs{group_begin:} +% and \cs{group_end:} functions. However, in vertical mode the end-of-group +% needs a \cs{tex_par:D}, which in horizontal mode does nothing. +% \begin{macrocode} +\cs_new_eq:NN \color_group_begin: \group_begin: +\cs_new_protected_nopar:Npn \color_group_end: + { + \tex_par:D + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color_ensure_current:} +% A driver-independent wrapper for setting the foreground colour to the +% current colour \enquote{now}. +% \begin{macrocode} +%<*initex> +\cs_new_protected_nopar:Npn \color_ensure_current: + { \driver_color_ensure_current: } +%</initex> +%<*package> +\cs_new_protected_nopar:Npn \color_ensure_current: { \set@color } +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</initex|package> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 7bc2ffb5687..d7d925dbfa5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2674 2011-08-27 19:43:44Z mittelba $ +\GetIdInfo$Id: l3doc.dtx 2719 2011-09-04 13:40:25Z will $ {L3 Experimental documentation class} %</driver|class> % @@ -180,11 +180,12 @@ Do not distribute a modified version of this file. % % \section{Problems \& Todo} % -% Problems at the moment: (1)~not flexible in the types of things that -% can be documented; (2)~very nonstandard markup (e.g., the odd `"/ -% (...)"' tags; (3)~no obvious link between the "\begin{function}" -% environment for documenting things to the "\begin{macro}" function -% that's used analogously in the implementation. +% Problems at the moment: +% (1)~not flexible in the types of things that can be documented; +% (2)~very nonstandard markup (e.g., the odd `"/ (...)"' tags; +% (3)~no obvious link between the "\begin{function}" environment for +% documenting things to the "\begin{macro}" function that's used +% analogously in the implementation. % % The "macro" should probably be renamed to "function" when it is used within % an implementation section. But they should have the same syntax before that happens! @@ -295,7 +296,7 @@ Do not distribute a modified version of this file. % \end{framed} % % Function environments take an optional argument to indicate whether the function(s) it -% describes are expandable or defined in conditional forms. Use "EXP", "TF", or "pTF" +% describes are expandable or restricted-expandable or defined in conditional forms. Use "EXP", "rEXP", "TF", or "pTF" % for this; note that "pTF" implies "EXP" since predicates must always be expandable. % As an example: % \begin{framed} @@ -324,7 +325,7 @@ Do not distribute a modified version of this file. % In the old syntax, individual functions could be suffixed by an optional flag or % two to indicate the same information given in the optional argument. % This is still supported; use "/" to separate the function name -% from the flag(s) and then add any of "(EXP)", "(TF)", or "(pTF)". +% from the flag(s) and then add any of "(EXP)", "(rEXP)", "(TF)", or "(pTF)". % % \DescribeEnv{variable} % If you are documenting a variable instead of a function, use the "variable" environment instead; it behaves identically to the "function" environment above. @@ -547,13 +548,21 @@ Do not distribute a modified version of this file. % \begin{macrocode} \LoadClass{article} \RequirePackage{doc} -\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes} +\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,pifont,textcomp,trace,underscore,csquotes} % \end{macrocode} % % \begin{macrocode} \bool_if:NT \g_doc_lmodern_bool { \RequirePackage[T1]{fontenc} \RequirePackage{lmodern} +% \end{macrocode} +% Now replace the italic typewriter font with the oblique shape instead; +% the former makes my skin crawl. (Will, Aug 2011) +% \begin{macrocode} + \begingroup + \ttfamily + \DeclareFontShape{T1}{lmtt}{m}{it}{<->ec-lmtto10}{} + \endgroup } % \end{macrocode} % @@ -805,6 +814,7 @@ Do not distribute a modified version of this file. \bool_gset_false:N \l_doc_meta_TF_bool \bool_gset_false:N \l_doc_meta_pTF_bool \bool_gset_false:N \l_doc_meta_EXP_bool + \bool_gset_false:N \l_doc_meta_rEXP_bool \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} } \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1} @@ -832,6 +842,11 @@ Do not distribute a modified version of this file. } \cs_set:Nn \doc_meta_opt_EXP: { \bool_gset_true:N \l_doc_meta_EXP_bool + \bool_gset_false:N \l_doc_meta_rEXP_bool +} +\cs_set:Nn \doc_meta_opt_rEXP: { + \bool_gset_false:N \l_doc_meta_EXP_bool + \bool_gset_true:N \l_doc_meta_rEXP_bool } \cs_set:Nn \doc_meta_opt_pTF: { \bool_gset_true:N \l_doc_meta_pTF_bool @@ -889,9 +904,10 @@ Do not distribute a modified version of this file. \bool_new:N \l_doc_meta_TF_bool \bool_new:N \l_doc_meta_pTF_bool \bool_new:N \l_doc_meta_EXP_bool +\bool_new:N \l_doc_meta_rEXP_bool % \end{macrocode} % -% \begin{macro}{\doc_showmacro_aux:w} +% \begin{macro}[aux]{\doc_showmacro_aux:w} % This macro is passed one of: % \begin{quote} % "\abc:cnx / (EXP) / \q_stop" \\ @@ -912,6 +928,9 @@ Do not distribute a modified version of this file. \tl_if_in:nnT {#2} { (EXP) } { \bool_gset_true:N \l_doc_meta_EXP_bool } + \tl_if_in:nnT {#2} { (rEXP) } { + \bool_gset_true:N \l_doc_meta_rEXP_bool + } \tl_if_in:nnT {#2} { (pTF) } { \bool_gset_true:N \l_doc_meta_TF_bool @@ -941,13 +960,15 @@ Do not distribute a modified version of this file. \bool_gset_true:N \l_doc_meta_TF_bool \doc_showmacro_aux_ii:w #1::\q_stop }{ - \doc_showmacro_aux_ii:w #1::\q_stop + \exp_args:Nf \tl_if_head_eq_charcode:nNTF { \use_none:n #1 } {:} + { \doc_showmacro_aux_iii:n {#1} } + { \doc_showmacro_aux_ii:w #1::\q_stop } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\doc_showmacro_aux_ii:w} +% \begin{macro}[aux]{\doc_showmacro_aux_ii:w} % This macro is passed arguments in the following ways: % \begin{quote} % "\doc_showmacro_aux_ii:w "^^A @@ -979,7 +1000,11 @@ Do not distribute a modified version of this file. & \bool_if:NT \l_doc_meta_EXP_bool { \hspace{\tabcolsep} - $\star$ + \hyperlink{expstar}{$\star$} + } + \bool_if:NT \l_doc_meta_rEXP_bool { + \hspace{\tabcolsep} + \hyperlink{rexpstar}{\ding{73}}% hollow star } \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} @@ -990,6 +1015,23 @@ Do not distribute a modified version of this file. } % \end{macrocode} % \end{macro} +% +% \begin{macro}[aux]{\doc_showmacro_aux_iii:w} +% This is for the case when the function is one of the weird ones like \cs{::N}. +% \begin{macrocode} +\cs_set_nopar:Nn \doc_showmacro_aux_iii:n { + \nextnewline + \tl_gset:Nx \g_doc_macro_tl {#1} + #1 & + \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {} + \bool_if:NT \g_doc_full_bool { + \exp_args:Nf\label{doc/function/\g_doc_macro_tl} + } +} +% \end{macrocode} +% \end{macro} % % \begin{environment}{syntax} % Syntax block placed next to the list of functions to illustrate their use. @@ -998,7 +1040,6 @@ Do not distribute a modified version of this file. \dim_set:Nn \g_doc_syntax_dim {0.7\textwidth} \newenvironment{syntax}{ \minipage[b]{\g_doc_syntax_dim} - \cs_set_nopar:Npn \meta@font@select{\rmfamily\itshape} % (Will: I HATE italic cmtt!) \small\ttfamily\raggedright \obeyspaces\obeylines }{ @@ -1242,10 +1283,13 @@ Do not distribute a modified version of this file. % conditionals and auxiliary functions. % \begin{macrocode} \cs_set_nopar:Npn \doc_typeset_TF: { - \itshape TF% - \makebox[0pt][r]{% - \color[gray]{0.5} - \underline { \phantom{\itshape TF} \kern-0.1em } + \hyperlink{explTF}{% + \color{black}% + \itshape TF% + \makebox[0pt][r]{% + \color{red} + \underline { \phantom{\itshape TF} \kern-0.1em } + } } } \cs_set_nopar:Npn \doc_typeset_aux:n #1 { @@ -2038,6 +2082,17 @@ page_precedence "rnaA" % \end{macro} % % +% \begin{function}{\::N} +% this is (no longer) weird +% \end{function} +% +% \begin{macro}{\::N} +% this is (no longer) weird +% \end{macro} +% +% \begin{function}[EXP]{\foo}\end{function} +% \begin{function}[rEXP]{\foo}\end{function} +% % \begin{macro}{\c_minus_one, % \c_zero, % \c_one, diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx new file mode 100644 index 00000000000..d2449c5cb94 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -0,0 +1,377 @@ +% \iffalse meta-comment +% +%% File: l3drivers.dtx Copyright(C) 2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +% +%<*driver> +\RequirePackage{l3names} +\GetIdInfo$Id: l3drivers.dtx 2717 2011-09-03 13:40:31Z joseph $ + {L3 Experimental drivers} +%</driver> +%<*driver> +\documentclass[full]{l3doc} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \title{^^A +% The \textsf{l3drivers} package\\ Drivers^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% \TeX{} relies on drivers in order to carry out a number of tasks, such +% as using colour, including graphics and setting up hyper-links. The nature +% of the code required depends on the exact driver in use. Currently, +% \LaTeX3 is aware of the following drivers: +% \begin{itemize} +% \item \texttt{pdfmode}: The \enquote{driver} for direct PDF output by +% \emph{both} \pdfTeX{} and \LuaTeX{} (no separate driver is used in this +% case: the engine deals with PDF creation itself). +% \item \texttt{dvips}: The dvips program, which works in conjugation with +% \pdfTeX{} or \LuaTeX{} in DVI mode. +% \item \texttt{xdvipdfmx}: The driver used by \XeTeX{}. +% \end{itemize} +% +% The code here is all very low-level, and should not in general be used +% outside of the kernel. It is also important to note that many of the +% functions here are closely tied to the immediate level \enquote{up}: +% several variable values must be in the correct locations for the driver +% code to function. +% +% \section{Box rotation and scaling} +% +% \begin{function}{\driver_box_rotate_begin:, \driver_box_rotate_end:} +% \begin{syntax} +% \cs{driver_box_rotate_begin:} +% \cs{box_use:N} \cs{l_box_tmp_box} +% \cs{driver_box_rotate_end:} +% \end{syntax} +% Rotates the \meta{box material} anti-clockwise around the current +% insertion point. The angle of rotation (in degrees counter-clockwise) +% and the sine and cosine of this angle should be stored in +% \cs{l_box_angle_fp}, \cs{l_box_sin_fp} and \cs{l_box_cos_fp}, +% respectively. Typically, the box material inserted between the beginning +% and end markers will be stored in \cs{l_box_tmp_box}: this fact is +% required by some drivers to obtain the correct output. +% \end{function} +% +% \begin{function}{\driver_box_scale_begin:, \driver_box_scale_end:} +% \begin{syntax} +% \cs{driver_box_scale_begin:} +% \meta{box material} +% \cs{driver_box_scale_end:} +% \end{syntax} +% Scales the \meta{box material} (which should be either a \cs{box_use:N} +% or \cs{hbox:n} construct). The \meta{box material} is scaled by the values +% stored in \cs{l_box_scale_x_fp} and \cs{l_box_scale_y_fp} in the +% horizontal and vertical directions, respectively. This function is +% also reused when resizing boxes: at a driver level, only scalings are +% supported and so the higher-level code must convert the absolute sizes +% to scale factors. +% \end{function} +% +% \section{Colour support} +% +% \begin{function}{\driver_color_ensure_current:} +% \begin{syntax} +% \cs{driver_color_ensure_current:} +% \end{syntax} +% Ensures that the colour used to typeset material is that which was +% set when the material was placed in a box. This function is therefore +% required inside any \enquote{colour safe} box to ensure that the box may +% be inserted in a location where the foreground colour has been altered, +% while preserving the colour used in the box. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3drivers} Implementation} +% +% \begin{macrocode} +%<*initex> +% \end{macrocode} +% +% \subsection{Settings for direct PDF output} +% +% If the driver loaded is \texttt{pdfmode} then direct PDF output is required. +% (This may of course alter: it might be that the driver is picked based on the +% value of \cs{pdfmode_pdfoutput:D}.) +% \begin{macrocode} +%<*pdfmode> +\pdftex_pdfoutput:D = 1 \scan_stop: +%</pdfmode> +% \end{macrocode} +% +% Set up the driver for direct PDF output to set the PDF origin equal to +% \TeX{}'s standard origin. The other settings make use of PDF~$1.5$, which +% is standard in \TeX{} Live 2011 and should be a reasonable baseline for +% the future. +% \begin{macrocode} +%<*pdfmode> +\pdftex_pdfhorigin:D = 1 true in \scan_stop: +\pdftex_pdfvorigin:D = 1 true in \scan_stop: +\pdftex_pdfdecimaldigits:D = 3 \scan_stop: +\pdftex_pdfpkresolution:D = 600 \scan_stop: +\pdftex_pdfminorversion:D = 5 \scan_stop: +\pdftex_pdfcompresslevel:D = 9 \scan_stop: +\pdftex_pdfobjcompresslevel:D = 2 \scan_stop: +%</pdfmode> +% \end{macrocode} +% +% \subsection{Box rotation and scaling} +% +% \begin{variable}{\l_driver_box_matrix_tl} +% A token list for the affine transformation matrix. +% \begin{macrocode} +%<*pdfmode> +\tl_new:N \l_driver_box_matrix_tl +%</pdfmode> +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_driver_tmp_fp} +% Needed for a safe sign inversion in PDF mode. +% \begin{macrocode} +%<*pdfmode> +\fp_new:N \l_driver_tmp_fp +%</pdfmode> +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\driver_box_rotate_begin:, \driver_box_rotate_end:} +% Systems which require only the rotation angle have simple drivers. +% On the other hand, in PDF mode the affine transformation matrix is +% needed, which has to be set up. This also requires that the sine +% value does not have two |-| tokens at the start, hence having to +% work out the negative sine carefully. This driver also requires +% that the width of the box in use for the output is set to zero, hence +% needing to know where the output is actually stored. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \driver_box_rotate_begin: + { +%<*dvips> + \tex_special:D + { + ps:~gsave~currentpoint~ + currentpoint~translate~ \fp_use:N \l_box_angle_fp \c_space_tl + neg~rotate~neg~exch~neg~exch~translate + } +%</dvips> +%<*pdfmode> + \fp_set_eq:NN \l_driver_tmp_fp \l_box_sin_fp + \fp_neg:N \l_driver_tmp_fp + \tl_set:Nx \l_driver_box_matrix_tl + { + \fp_use:N \l_box_cos_fp \c_space_tl + \fp_use:N \l_box_sin_fp \c_space_tl + \fp_use:N \l_driver_tmp_fp \c_space_tl + \fp_use:N \l_box_cos_fp + } + \pdftex_pdfsave:D + \pdftex_pdfsetmatrix:D { \l_driver_box_matrix_tl } + \box_set_wd:Nn \l_box_tmp_box \c_zero_dim +%</pdfmode> +%<*xdvipdfmx> + \tex_special:D { x:gsave } + \tex_special:D { x:rotate~ \fp_use:N \l_box_angle_fp } +%</xdvipdfmx> + } +% \end{macrocode} +% The end of a rotation means tidying up the output grouping. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \driver_box_rotate_end: +%<*dvips> + { \tex_special:D { ps:~currentpoint~grestore~moveto } } +%</dvips> +%<*pdfmode> + { \pdftex_pdfrestore:D } +%</pdfmode> +%<*xdvipdfmx> + { \tex_special:D { x:grestore } } +%</xdvipdfmx> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\driver_box_scale_begin:, \driver_box_scale_end:} +% Scaling is not dissimilar to rotation, but the calculations are somewhat +% less complex. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \driver_box_scale_begin: + { +%<*dvips> + \tex_special:D + { + ps:~currentpoint~ + currentpoint~translate~ + \fp_use:N \l_box_scale_x_fp \c_space_tl + \fp_use:N \l_box_scale_y_fp \c_space_tl + scale~neg~exch~neg~exch~ + translate + } +%</dvips> +%<*pdfmode> + \tl_set:Nx \l_driver_box_matrix_tl + { + \fp_use:N \l_box_scale_x_fp \c_space_tl + 0 ~ 0 ~ + \fp_use:N \l_box_scale_y_fp + } + \pdftex_pdfsave:D + \pdftex_pdfsetmatrix:D { \l_driver_box_matrix_tl } +%</pdfmode> +%<*xdvipdfmx> + \tex_special:D { x:gsave } + \tex_special:D + { + x:scale ~ + \fp_use:N \l_box_scale_x_fp \c_space_tl + \fp_use:N \l_box_scale_y_fp + } +%</xdvipdfmx> + } +% \end{macrocode} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \driver_box_scale_end: +%<*dvips> + { + \tex_special:D + { + ps:~currentpoint~ + currentpoint~translate~ + 1~\fp_use:N \l_box_scale_x_fp \c_space_tl div~ + 1~\fp_use:N \l_box_scale_y_fp \c_space_tl div~ + scale~neg~exch~neg~exch~ + translate + } + } +%</dvips> +%<*pdfmode> + { \pdftex_pdfrestore:D } +%</pdfmode> +%<*xdvipdfmx> + { \tex_special:D { x:grestore } } +%</xdvipdfmx> +% \end{macrocode} +% \end{macro} +% +% \subsection{Colour support} +% +% \begin{variable}{\l_driver_current_color_tl} +% The current colour is needed by all of the engines, but the way this +% is stored varies. +% \begin{macrocode} +\tl_new:N \l_driver_current_color_tl +%<*dvips> +\tl_set:Nn \l_driver_current_color_tl { Black } +%</dvips> +%<*pdfmode> +\tl_set:Nn \l_driver_current_color_tl { 0~g~0~G } +%</pdfmode> +%<*xdvipdfmx> +\tl_set:Nn \l_driver_current_color_tl { gray~0 } +%</xdvipdfmx> +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_driver_color_stack_int} +% \pdfTeX{} and \LuaTeX{} have multiple stacks available, and the colour +% stack therefore needs a number. +% \begin{macrocode} +%<*pdfmode> +\int_new:N \l_driver_color_stack_int +%</pdfmode> +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\driver_color_group_begin:, \driver_color_group_end:} +% \begin{macrocode} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\driver_color_ensure_current:} +% \begin{macro}[aux]{\driver_color_reset:} +% Setting the current colour depends on the nature of the colour stack +% available. In all cases there is a need to reset the colour after +% the current group. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \driver_color_ensure_current: + { +%<*dvips|xdvipdfmx> + \tex_special:D { color~push~\l_driver_current_color_tl } +%</dvips|xdvipdfmx> +%<*pdfmode> + \pdftex_pdfcolorstack:D \l_driver_color_stack_int push + { \l_driver_current_color_tl } +%</pdfmode> + \group_insert_after:N \driver_color_reset: + } +\cs_new_protected_nopar:Npn \driver_color_reset: +%<*dvips|xdvipdfmx> + { \tex_special:D { color~pop } } +%</dvips|xdvipdfmx> +%<*pdfmode> + { \pdftex_pdfcolorstack:D \l_driver_color_stack_int pop \scan_stop: } +%</pdfmode> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</initex> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx index f89c10d2562..880b32b5080 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3io.dtx 2724 2011-09-05 18:51:51Z bruno $ {L3 Experimental input-output operations} %</driver|package> %<*driver> @@ -271,6 +271,11 @@ % and MiK\TeX{} systems. % \end{variable} % +% \begin{variable}{\c_catcode_other_space_tl} +% Token list containing one character with category code $12$, +% (\enquote{other}), and character code $32$ (space). +% \end{variable} +% % \section{Reading from files} % % \begin{function}{\ior_to:NN} @@ -734,9 +739,7 @@ \cs_new:Npn \ior_show_aux:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl - #1 \iow_char:N - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl - \exp_not:n {#2} + #1 \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} } \cs_new_protected_nopar:Npn \iow_list_streams: { @@ -910,6 +913,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\c_catcode_other_space_tl} +% Lowercase a character with category code $12$ to produce an +% \enquote{other} space. We can do everything within the group, +% because \cs{tl_const:Nn} defines its argument globally. +% \begin{macrocode} +\group_begin: + \char_set_catcode_other:N \* + \char_set_lccode:nn {`\*} {`\ } + \tl_to_lowercase:n { \tl_const:Nn \c_catcode_other_space_tl { * } } +\group_end: +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\iow_wrap:xnnnN} % \begin{macro}[aux]{\iow_wrap_loop:w} % \begin{macro}[aux]{\iow_wrap_word:} @@ -924,7 +940,11 @@ % will do the actual wrapping. After the loop, the resulting text is % passed on to the function which has been given as a post-processor. % The argument |#4| is available for additional set up steps for -% the output. +% the output. The definition of |\\| and \verb*|\ | use an +% \enquote{other} space rather than a normal space, because the latter +% might be absorbed by \TeX{} to end a number or other \texttt{f}-type +% expansions. The \cs{tl_to_str:N} step converts the \enquote{other} +% space back to a normal space. % \begin{macrocode} \cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 { @@ -934,8 +954,9 @@ \tl_clear:N \l_iow_current_line_tl \tl_clear:N \l_iow_wrap_tl \bool_set_true:N \l_iow_line_start_bool - \cs_set:Npx \\ { \c_space_tl \iow_newline: \c_space_tl } - \cs_set_eq:NN \ \c_space_tl + \cs_set:Npx \\ + { \c_catcode_other_space_tl \iow_newline: \c_catcode_other_space_tl } + \cs_set_eq:NN \ \c_catcode_other_space_tl #4 %<*initex> \tl_set:Nx \l_iow_wrap_tl {#1} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 0325817636e..631faf966d9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 2677 2011-08-28 06:54:22Z joseph $ +\GetIdInfo$Id: l3keys.dtx 2722 2011-09-05 08:49:40Z joseph $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 635c1a0a827..fd58910af9a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2601 2011-08-16 23:20:27Z bruno $ +\GetIdInfo$Id: l3msg.dtx 2728 2011-09-05 19:13:18Z joseph $ {L3 Experimental messages} %</driver|package> %<*driver> @@ -74,7 +74,7 @@ % % The system used by \pkg{l3msg} to create messages divides the process % into two distinct parts. Named messages are created in the first part -% of the process; at this stage, no decision is made about the type +% of the process; at this stage, no decision is made about the type of % output that the message will produce. The second part of the process % is actually producing a message. At this stage a choice of message % \emph{class} has to be made, for example \texttt{error}, @@ -388,6 +388,30 @@ % \end{function} % % \section{Redirecting messages} +% +% Each message has a \enquote{name}, which can be used to alter the behaviour +% of the message when it is given. Thus we might have +% \begin{verbatim} +% \msg_new:nnnn { module } { my-message } { Some~text } { Some~more~text } +% \end{verbatim} +% to define a message, with +% \begin{verbatim} +% \msg_error:nn { module } { my-message } +% \end{verbatim} +% when it is used. With no filtering, this will raise an error. However, we +% could alter the behaviour with +% \begin{verbatim} +% \msg_redirect_class:nn { error } { warning } +% \end{verbatim} +% to turn all errors into warnings, or with +% \begin{verbatim} +% \msg_redirect_module:nnn { module } { error } { warning } +% \end{verbatim} +% to alter just those messages for module, or even +% \begin{verbatim} +% \msg_redirect_name:nnn { module } { my-message } { warning } +% \end{verbatim} +% to target just one message. % % \begin{function}{\msg_redirect_class:nn} % \begin{syntax} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 66b9837a8be..dfed4100ac0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2720 2011-09-05 08:12:39Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -87,7 +87,7 @@ % |\cs_if_free:NTF| which also takes one argument (the |N|) and then % executes either \meta{true} or \meta{false} depending on the % result. Important to note here is that the arguments are executed -% after exiting the underlying |\if...\fi:| structure +% after exiting the underlying |\if...\fi:| structure. % % \section{Defining a set of conditional functions} % @@ -646,9 +646,9 @@ % should define a function of one argument (|#1|). % \end{function} % -% \begin{function}{\prg_stepwise_variable:nnnn} +% \begin{function}{\prg_stepwise_variable:nnnNn} % \begin{syntax} -% \cs{prg_stepwise_inline:nnnn} \Arg{initial value} \Arg{step} +% \cs{prg_stepwise_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} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 0923121015d..d7409586cac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3prop.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental property lists} %</driver|package> %<*driver> @@ -78,6 +78,10 @@ % added to a property list which already contains the \meta{key} then the new % entry will overwrite the existing one. The \meta{keys} are compared on a % string basis, using the same method as \cs{str_if_eq:nn}. +% +% Property lists are intended for storing key-based information for use within +% code. This is in contrast to key--value lists, which are a form of +% \emph{input} parsed by the \pkg{keys} module. % % \section{Creating and initialising property lists} % @@ -322,7 +326,11 @@ % or absence of a key in a property list. They offer increased readability % and performance over separate testing and recovery phases. % -% \begin{function}[TF]{\prop_get:NnN, \prop_get:cnN} +% \begin{function}[TF] +% { +% \prop_get:NnN, \prop_get:NVN, \prop_get:NoN, +% \prop_get:cnN, \prop_get:cVN, \prop_get:coN +% } % \begin{syntax} % \cs{prop_get:NnNTF} \meta{property list} \Arg{key} % ~~\meta{token list variable} \Arg{true code} \Arg{false code} @@ -352,7 +360,7 @@ % % \section{Mapping to property lists} % -% \begin{function}[EXP]{\prop_map_function:NN, \prop_map_function:cN} +% \begin{function}[rEXP]{\prop_map_function:NN, \prop_map_function:cN} % \begin{syntax} % \cs{prop_map_function:NN} \meta{property list} \meta{function} % \end{syntax} @@ -375,7 +383,7 @@ % should not be relied upon. % \end{function} % -% \begin{function}[EXP]{\prop_map_break:} +% \begin{function}[rEXP]{\prop_map_break:} % \begin{syntax} % \cs{prop_map_break:} % \end{syntax} @@ -925,7 +933,11 @@ % % \subsection{Recovering values from property lists with branching} % -% \begin{macro}[TF]{\prop_get:NnN, \prop_get:cnN} +% \begin{macro}[TF] +% { +% \prop_get:NnN, \prop_get:NVN, \prop_get:NoN, +% \prop_get:cnN, \prop_get:cVN, \prop_get:coN +% } % \begin{macro}[aux]{\prop_get_aux_true:Nnnn} % Getting the value corresponding to a key, keeping track of whether % the key was present or not, is implemented as a conditional (with @@ -942,9 +954,12 @@ \tl_set:Nn #1 {#3} \prg_return_true: } -\cs_generate_variant:Nn \prop_get:NnNT { c } -\cs_generate_variant:Nn \prop_get:NnNF { c } -\cs_generate_variant:Nn \prop_get:NnNTF { c } +\cs_generate_variant:Nn \prop_get:NnNT { NV , No } +\cs_generate_variant:Nn \prop_get:NnNF { NV , No } +\cs_generate_variant:Nn \prop_get:NnNTF { NV , No } +\cs_generate_variant:Nn \prop_get:NnNT { c , cV , co } +\cs_generate_variant:Nn \prop_get:NnNF { c , cV , co } +\cs_generate_variant:Nn \prop_get:NnNTF { c , cV , co } % \end{macrocode} % \end{macro} % \end{macro} @@ -1040,13 +1055,13 @@ { \prop_if_empty:NTF #1 { - \iow_term:x { Property~list~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Property~list~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Property~list~\token_to_str:N #1 \c_space_tl + Property~list~\token_to_str:N #1~ contains~the~pairs~(without~outer~braces): } \tl_set:Nx \l_prop_show_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 01e719a9ccc..4b9109dbb1d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3seq.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> @@ -372,7 +372,7 @@ % % \section{Mapping to sequences} % -% \begin{function}[EXP]{\seq_map_function:NN, \seq_map_function:cN} +% \begin{function}[rEXP]{\seq_map_function:NN, \seq_map_function:cN} % \begin{syntax} % \cs{seq_map_function:NN} \meta{sequence} \meta{function} % \end{syntax} @@ -411,7 +411,7 @@ % are returned from left to right. % \end{function} % -% \begin{function}[EXP]{\seq_map_break:} +% \begin{function}[rEXP]{\seq_map_break:} % \begin{syntax} % \cs{seq_map_break:} % \end{syntax} @@ -438,7 +438,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\seq_map_break:n} +% \begin{function}[rEXP]{\seq_map_break:n} % \begin{syntax} % \cs{seq_map_break:n} \Arg{tokens} % \end{syntax} @@ -507,7 +507,7 @@ % \begin{function} % { % \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx, -% seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx +% \seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx % } % \begin{syntax} % \cs{seq_push:Nn} \meta{sequence} \Arg{item} @@ -1517,13 +1517,13 @@ { \seq_if_empty:NTF #1 { - \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Sequence~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Sequence~\token_to_str:N #1 \c_space_tl + Sequence~\token_to_str:N #1~ contains~the~items~(without~outer~braces): } \tl_set:Nx \l_seq_show_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index f5a36e95bad..cfe96ac73af 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2686 2011-08-29 19:41:06Z joseph $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -66,18 +66,25 @@ % \maketitle % % \begin{documentation} -% -% \LaTeX3 stores lists of token in variables also called \enquote{token lists}. -% Variables of this type get the suffix |tl| and functions of this type -% have the prefix |tl|. To use a token list variable you simply call -% the corresponding variable. -% -% Often you find yourself with not a token list variable but an -% arbitrary token list which has to undergo certain tests. We will \emph{also} -% prefix these functions with |tl|. While token list variables are -% always single tokens, token lists are always surrounded by -% braces. Many of the functions for token lists and token list variables -% are very similar, and so are grouped together here. +% +% \TeX{} works with tokens, and \LaTeX3 therefore provides a number of +% functions to deal with token lists. Token lists may be present direct in +% the argument to a function: +% \begin{verbatim} +% \foo:n { a collection of \tokens } +% \end{verbatim} +% or may be stored for processing in a so-called \enquote{token list +% variable}, which have the suffix \texttt{tl}: +% the argument to a function: +% \begin{verbatim} +% \foo:N \l_some_tl +% \end{verbatim} +% In both cases, functions are available to test an manipulate the lists +% of tokens, and these have the module prefix \texttt{tl}. +% In many cases, function which can be applied to token list variables +% are paired with similar functions for application to explicit lists +% of tokens: the two \enquote{views} of a token list are therefore collected +% together here. % % A token list can be seen either as a list of \enquote{items}, % or a list of \enquote{tokens}. An item is whatever \cs{use_none:n} @@ -85,7 +92,15 @@ % with optional leading explicit space characters (each item is thus % itself a token list). A token is either a normal \texttt{N} argument, % or | |, |{|, or |}| (assuming normal \TeX{} category codes). -% Functions which act on items are often faster than their analog acting +% Thus for example +% \begin{verbatim} +% { Hello } ~ world +% \end{verbatim} +% contains six items (\texttt{Hello}, \texttt{w}, \texttt{o}, \texttt{r}, +% \texttt{l} and \texttt{d}), but thirteen tokens (|{|, \texttt{H}, \texttt{e}, +% \texttt{l}, \texttt{l}, \texttt{o}, |}|, \verb*| |, \texttt{w}, \texttt{o}, +% \texttt{r}, \texttt{l} and \texttt{d}). +% Functions which act on items are often faster than their analogue acting % directly on tokens. % % \section{Creating and initialising token list variables} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index c67a876db3d..293de965779 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3token.dtx 2691 2011-08-29 20:08:46Z joseph $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -107,28 +107,7 @@ % \begin{verbatim} % \cs_new:Npn \show_until_if:w #1 \if:w { \tl_show:n {#1} } % \show_until_if:w \tex_if:D \if_charcode:w \if:w -% \end{verbatim} -% -% It is easier to start by considering the possibilities for what a -% token looks like, in other words, how \TeX{} sees it from the point -% of view of delimited arguments. Two cases: the token is either a -% control sequence or a single character. -% \begin{center} -% \begin{tabular}{p{4cm}p{4cm}} -% \toprule -% Control sequence & Character \\ -% \midrule -% Control word: an escape character followed by some letters. & -% \end{tabular} -% \end{center} -% The token can be a control sequence, -% in other words, an escape character followed by some letters, or by -% a single non-letter character. Examples of this include \cs{begin}, -% \cs{;}, \cs{emph}\ldots{} The other case -% There are two cases. either the token -% is a single character, in which case it is associated with a category -% code: -% +% \end{verbatim} % % \section{Character tokens} % @@ -152,7 +131,7 @@ % \char_set_catcode_invalid:N % } % \begin{syntax} -% \cs{char_make_letter:N} \meta{character} +% \cs{char_set_catcode_letter:N} \meta{character} % \end{syntax} % Sets the category code of the \meta{character} to that indicated in % the function name. Depending on the current category code of the @@ -183,7 +162,7 @@ % \char_set_catcode_invalid:n % } % \begin{syntax} -% \cs{char_make_letter:n} \Arg{integer expression} +% \cs{char_set_catcode_letter:n} \Arg{integer expression} % \end{syntax} % Sets the category code of the \meta{character} which has character % code as given by the \meta{integer expression}. This version can be diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 610d2b169ca..dd8e487b69e 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -48,11 +48,12 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/08/28} -\def\ExplFileVersion{2678} +\def\ExplFileDate{2011/09/05} +\def\ExplFileVersion{2729} \RequirePackage{etex} \reserveinserts{32} \RequirePackage{calc} +\RequirePackage{color,graphics} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \newcommand* \@l@expl@check@declarations@bool { 0 } @@ -117,11 +118,12 @@ l3io, l3file, l3skip, - l3box, l3keys, l3fp, - l3luatex, - l3coffins + l3box, + l3coffins, + l3color, + l3luatex } \RequirePackage{l3toks} \bool_if:nT { \@l@expl@check@declarations@bool } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index 4d82350bb19..8034a2ff274 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2689 2011-08-29 19:50:38Z joseph $ {L3 Experimental basic definitions} \ProvidesExplPackage diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty index 4c575fdc144..ee4c4decd6f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -94,7 +94,7 @@ {\def\ExplFileDate{#2}} \protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 2558 2011-08-13 06:32:00Z joseph $ +\GetIdInfo$Id: l3bootstrap.dtx 2687 2011-08-29 19:48:45Z joseph $ {L3 experimental bootstrap code} \ProvidesPackage{l3bootstrap} [% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty index 57415ec278d..cb83228019a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3box.dtx 2711 2011-09-02 12:15:53Z joseph $ {L3 Experimental boxes} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -214,6 +214,328 @@ \cs_generate_variant:Nn \vbox_unpack_clear:N { c } \cs_new_protected_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3 { \tex_setbox:D #1 \tex_vsplit:D #2 to \dim_eval:w #3 \dim_eval_end: } +\fp_new:N \l_box_angle_fp +\fp_new:N \l_box_cos_fp +\fp_new:N \l_box_sin_fp +\dim_new:N \l_box_top_dim +\dim_new:N \l_box_bottom_dim +\dim_new:N \l_box_left_dim +\dim_new:N \l_box_right_dim +\dim_new:N \l_box_top_new_dim +\dim_new:N \l_box_bottom_new_dim +\dim_new:N \l_box_left_new_dim +\dim_new:N \l_box_right_new_dim +\box_new:N \l_box_tmp_box +\fp_new:N \l_box_tmp_fp +\fp_new:N \l_box_x_fp +\fp_new:N \l_box_y_fp +\fp_new:N \l_box_x_new_fp +\fp_new:N \l_box_y_new_fp +\cs_new_protected_nopar:Npn \box_rotate:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l_box_angle_fp {#2} + \box_rotate_set_sin_cos: + \fp_compare:NNNTF \l_box_sin_fp = \c_zero_fp + { + \fp_compare:NNNTF \l_box_cos_fp = \c_one_fp + { \box_use:N #1 } + { \box_rotate_aux:N #1 } + } + { \box_rotate_aux:N #1 } + \group_end: + } + } +\cs_new_protected_nopar:Npn \box_rotate_aux:N #1 + { + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_compare:NNNTF \l_box_sin_fp > \c_zero_fp + { + \fp_compare:NNNTF \l_box_cos_fp > \c_zero_fp + { \box_rotate_quadrant_one: } + { \box_rotate_quadrant_two: } + } + { + \fp_compare:NNNTF \l_box_cos_fp < \c_zero_fp + { \box_rotate_quadrant_three: } + { \box_rotate_quadrant_four: } + } + \hbox_set:Nn \l_box_tmp_box { \box_use:N #1 } + \hbox_set:Nn \l_box_tmp_box + { + \tex_kern:D -\l_box_left_new_dim + \hbox:n + { + \driver_box_rotate_begin: + \box_use:N \l_box_tmp_box + \driver_box_rotate_end: + } + } + \box_set_ht:Nn \l_box_tmp_box { \l_box_top_new_dim } + \box_set_dp:Nn \l_box_tmp_box { -\l_box_bottom_new_dim } + \box_set_wd:Nn \l_box_tmp_box + { \l_box_right_new_dim - \l_box_left_new_dim } + \box_use:N \l_box_tmp_box + } +\cs_set_protected_nopar:Npn \box_rotate:Nn #1#2 + { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } +\cs_new_protected_nopar:Npn \box_rotate_set_sin_cos: + { + \fp_set_eq:NN \l_box_tmp_fp \l_box_angle_fp + \fp_div:Nn \l_box_tmp_fp { 180 } + \fp_mul:Nn \l_box_tmp_fp { \c_pi_fp } + \fp_sin:Nn \l_box_sin_fp { \l_box_tmp_fp } + \fp_cos:Nn \l_box_cos_fp { \l_box_tmp_fp } + } +\cs_new_protected_nopar:Npn \box_rotate_x:nnN #1#2#3 + { + \fp_set_from_dim:Nn \l_box_x_fp {#1} + \fp_set_from_dim:Nn \l_box_y_fp {#2} + \fp_set_eq:NN \l_box_x_new_fp \l_box_x_fp + \fp_set_eq:NN \l_box_tmp_fp \l_box_y_fp + \fp_mul:Nn \l_box_x_new_fp { \l_box_cos_fp } + \fp_mul:Nn \l_box_tmp_fp { \l_box_sin_fp } + \fp_sub:Nn \l_box_x_new_fp { \l_box_tmp_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_box_x_new_fp } + } +\cs_new_protected_nopar:Npn \box_rotate_y:nnN #1#2#3 + { + \fp_set_from_dim:Nn \l_box_x_fp {#1} + \fp_set_from_dim:Nn \l_box_y_fp {#2} + \fp_set_eq:NN \l_box_y_new_fp \l_box_y_fp + \fp_set_eq:NN \l_box_tmp_fp \l_box_x_fp + \fp_mul:Nn \l_box_y_new_fp { \l_box_cos_fp } + \fp_mul:Nn \l_box_tmp_fp { \l_box_sin_fp } + \fp_add:Nn \l_box_y_new_fp { \l_box_tmp_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_box_y_new_fp } +} +\cs_new_protected_nopar:Npn \box_rotate_quadrant_one: + { + \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_two: + { + \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_three: + { + \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim + \l_box_right_new_dim + } +\cs_new_protected_nopar:Npn \box_rotate_quadrant_four: + { + \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim + \l_box_top_new_dim + \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim + \l_box_bottom_new_dim + \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim + \l_box_left_new_dim + \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim + \l_box_right_new_dim + } +\fp_new:N \l_box_scale_x_fp +\fp_new:N \l_box_scale_y_fp +\cs_new_protected:Npn \box_resize:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp { \l_box_right_dim } + \fp_div:Nn \l_box_scale_x_fp { \l_box_tmp_fp } + \fp_set_from_dim:Nn \l_box_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_box_tmp_fp + { \l_box_top_dim - \l_box_bottom_dim } + \fp_div:Nn \l_box_scale_y_fp { \l_box_tmp_fp } + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#3} } + } + { \box_resize_aux:Nnn #1 {#2} {#3} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize:Nnn { c } +\cs_new_protected:Npn \box_resize_aux:Nnn #1#2#3 + { + \dim_compare:nNnTF {#2} > \c_zero_dim + { \dim_set:Nn \l_box_right_new_dim {#2} } + { \dim_set:Nn \l_box_right_new_dim { \c_zero_dim - ( #2 ) } } + \dim_compare:nNnTF {#3} > \c_zero_dim + { + \dim_set:Nn \l_box_top_new_dim + { \fp_use:N \l_box_scale_y_fp \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim + { \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } + } + { + \dim_set:Nn \l_box_top_new_dim + { - \fp_use:N \l_box_scale_y_fp \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim + { - \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } + } + \box_resize_common:N #1 + } +\cs_set_protected_nopar:Npn \box_resize:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \resizebox * + { \etex_dimexpr:D #2 \scan_stop: } + { \etex_dimexpr:D #3 \scan_stop: } + { \box_use:N #1 } + } + } +\cs_new_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_set_from_dim:Nn \l_box_scale_y_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp + { \l_box_top_dim - \l_box_bottom_dim } + \fp_div:Nn \l_box_scale_y_fp { \l_box_tmp_fp } + \fp_set_eq:NN \l_box_scale_x_fp \l_box_scale_y_fp + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#2} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } +\cs_new_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_box_tmp_fp { \l_box_right_dim } + \fp_div:Nn \l_box_scale_x_fp { \l_box_tmp_fp } + \fp_set_eq:NN \l_box_scale_y_fp \l_box_scale_x_fp + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { \box_use:N #1 } + { \box_resize_aux:Nnn #1 {#2} {#2} } + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } +\cs_set_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { ! } { \etex_dimexpr:D #2 \scan_stop: } { \box_use:N #1 } + } + } +\cs_set_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { \etex_dimexpr:D #2 \scan_stop: } { ! } { \box_use:N #1 } + } + } +\cs_new_protected_nopar:Npn \box_scale:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l_box_scale_x_fp {#2} + \fp_set:Nn \l_box_scale_y_fp {#3} + \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } + \dim_zero:N \l_box_left_dim + \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp + { + \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp + { \box_use:N #1 } + { \box_scale_aux:Nnn #1 {#2} {#3} } + } + { \box_scale_aux:Nnn #1 {#2} {#3} } + \group_end: + } + } +\cs_generate_variant:Nn \box_scale:Nnn { c } +\cs_new_protected_nopar:Npn \box_scale_aux:Nnn #1#2#3 + { + \fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp + { + \dim_set:Nn \l_box_top_new_dim { #3 \l_box_top_dim } + \dim_set:Nn \l_box_bottom_new_dim { #3 \l_box_bottom_dim } + } + { + \dim_set:Nn \l_box_top_new_dim { -#3 \l_box_bottom_dim } + \dim_set:Nn \l_box_bottom_new_dim { -#3 \l_box_top_dim } + } + \fp_compare:NNNTF \l_box_scale_x_fp > \c_zero_fp + { \l_box_right_new_dim #2 \l_box_right_dim } + { \l_box_right_new_dim -#2 \l_box_right_dim } + \box_resize_common:N #1 + } +\cs_set_protected_nopar:Npn \box_scale:Nnn #1#2#3 + { \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } } +\cs_new_protected_nopar:Npn \box_resize_common:N #1 + { + \hbox_set:Nn \l_box_tmp_box + { + \driver_box_scale_begin: + \hbox_overlap_right:n { \box_use:N #1 } + \driver_box_scale_end: + } + \box_set_ht:Nn \l_box_tmp_box { \l_box_top_new_dim } + \box_set_dp:Nn \l_box_tmp_box { \l_box_bottom_new_dim } + \fp_compare:NNNTF \l_box_scale_x_fp < \c_zero_fp + { + \hbox_to_wd:nn { \l_box_right_new_dim } + { + \tex_kern:D \l_box_right_new_dim + \box_use:N \l_box_tmp_box + \tex_hss:D + } + } + { + \box_set_wd:Nn \l_box_tmp_box { \l_box_right_new_dim } + \box_use:N \l_box_tmp_box + } + } %% %% %% End of file `l3box.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty index 1f19e3490e0..fa86133edb0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -47,7 +47,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2666 2011-08-26 06:10:09Z joseph $ +\GetIdInfo$Id: l3clist.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental comma separated lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -94,24 +94,71 @@ } \cs_generate_variant:Nn \clist_concat:NNN { ccc } \cs_generate_variant:Nn \clist_gconcat:NNN { ccc } +\cs_new_protected:Npn \clist_tmp:w { } +\cs_set:Npn \clist_tmp:w #1 + { + \cs_new:Npn \clist_trim_spaces_generic:nw ##1 ##2 , + { + \tl_trim_spaces_aux_i:w + ##2 + \q_nil + \q_mark #1 { } + \q_mark \tl_trim_spaces_aux_ii:w + \tl_trim_spaces_aux_iii:w + #1 \q_nil + \clist_trim_spaces_generic_aux:w + \q_stop + {##1} + } + } +\clist_tmp:w {~} +\cs_new:Npn \clist_trim_spaces_generic_aux:w #1 \q_nil #2 \q_stop + { \exp_args:No \clist_trim_spaces_generic_aux_ii:nn { \use_none:n #1 } } +\cs_new:Npn \clist_trim_spaces_generic_aux_ii:nn #1 #2 { #2 {#1} } +\cs_new:Npn \clist_trim_spaces:n #1 + { + \clist_trim_spaces_aux:n { } \q_mark #1 , + \q_recursion_tail, \q_recursion_stop + } +\cs_new:Npn \clist_trim_spaces_aux:n #1 + { + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux_ii:nn {#1} } + } +\cs_new:Npn \clist_trim_spaces_aux_ii:nn #1 #2 + { + \quark_if_recursion_tail_stop:n {#2} + \tl_if_empty:nTF {#2} + { + \clist_trim_spaces_aux:n {#1} \q_mark + } + { + #1 \exp_not:n {#2} + \clist_trim_spaces_aux:n { , } \q_mark + } + } \cs_new_protected_nopar:Npn \clist_put_left:Nn - { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_left:Nn { } , } + { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_left:Nx { } , } \cs_new_protected_nopar:Npn \clist_gput_left:Nn - { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_left:Nn { } , } + { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_left:Nx { } , } \cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 { + \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#6} } \clist_if_empty:NTF #5 - { #1 #5 {#6} } - { \tl_if_empty:nF {#6} { #2 #5 { #3 #6 #4 } } } + { #1 #5 \l_clist_tmpa_tl } + { + \tl_if_empty:NF \l_clist_tmpa_tl + { #2 #5 { #3 \exp_not:o \l_clist_tmpa_tl #4 } } + } } \cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx } \cs_new_protected:Npn \clist_put_right:Nn - { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_right:Nn , { } } + { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_right:Nx , { } } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_right:Nn , { } } + { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_right:Nx , { } } \cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } @@ -201,21 +248,6 @@ \cs_new_protected:Npn \clist_remove_all_aux:w { } \cs_generate_variant:Nn \clist_remove_all:Nn { c } \cs_generate_variant:Nn \clist_gremove_all:Nn { c } -\cs_new:Npn \clist_trim_spaces:n #1 - { - \exp_args:Nf \clist_trim_spaces_aux_i:n - { \clist_map_function:nN {#1} \clist_trim_spaces_aux_ii:n } - } -\cs_new:Npn \clist_trim_spaces_aux_i:n #1 { \use_ii:nn #1 } -\cs_new:Npn \clist_trim_spaces_aux_ii:n #1 - { , \tl_trim_spaces:n {#1} } -\cs_new_protected:Npn \clist_trim_spaces:N #1 - { \tl_set:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } -\cs_new_protected:Npn \clist_gtrim_spaces:N #1 - { \tl_gset:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } -\cs_generate_variant:Nn \clist_trim_spaces:N { c } -\cs_generate_variant:Nn \clist_gtrim_spaces:N { c } -\cs_new_protected:Npn \clist_tmp:w { } \prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N { p , T , F , TF } \prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c { p , T , F , TF } \prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN { p , T , F , TF } @@ -265,14 +297,6 @@ , \q_recursion_tail , \q_recursion_stop } } -\cs_new:Npn \clist_map_function:nN #1#2 - { - \tl_if_empty:nF {#1} - { - \clist_map_function_aux:Nw #2 #1 - , \q_recursion_tail , \q_recursion_stop - } - } \cs_new:Npn \clist_map_function_aux:Nw #1#2 , { \quark_if_recursion_tail_stop:n {#2} @@ -304,34 +328,53 @@ \cs_generate_variant:Nn \clist_map_inline:Nn { c } \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 { - \clist_map_inline:Nn #1 + \clist_if_empty:NF #1 { - \tl_set:Nn #2 {##1} - #3 + \exp_args:Nno \use:nn + { \clist_map_variable_aux:Nnw #2 {#3} } + #1 + , \q_recursion_tail , \q_recursion_stop } } -\cs_new_protected:Npn \clist_map_variable:nNn #1#2#3 +\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3 , { - \clist_map_inline:nn {#1} - { - \tl_set:Nn #2 {##1} - #3 - } + \quark_if_recursion_tail_stop:n {#3} + \tl_set:Nn #1 {#3} + #2 + \clist_map_variable_aux:Nnw #1 {#2} + } +\cs_new_protected:Npn \clist_map_variable:nNn #1 + { + \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#1} } + \clist_map_variable:NNn \l_clist_tmpa_tl } \cs_generate_variant:Nn \clist_map_variable:NNn { c } +\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } +\cs_new:Npn \clist_map_function:nN #1#2 + { + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } + \q_mark #1, \q_recursion_tail, \q_recursion_stop + } +\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 + { + \quark_if_recursion_tail_stop:n {#2} + \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } + \q_mark + } \cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w \cs_new_eq:NN \clist_map_break:n \use_i_delimit_by_q_recursion_stop:nw \cs_new_protected_nopar:Npn \clist_show:N #1 { \clist_if_empty:NTF #1 { - \iow_term:x { Comma~list~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Comma~list~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Comma~list~\token_to_str:N #1 \c_space_tl + Comma~list~\token_to_str:N #1~ contains~the~items~(without~outer~braces): } \tl_set:Nx \l_clist_show_tl @@ -405,7 +448,7 @@ \seq_if_empty:NTF #2 { \clist_gclear:N #1 } { - \seq_push_item_def:n { , \exp_not:n {##1} } + \seq_push_item_def:n { , \exp_not:n {{##1}} } \tl_gset:Nx #1 { \exp_after:wN \use_none:n \tex_romannumeral:D -`\0 #2 } \seq_pop_item_def: @@ -421,6 +464,12 @@ \cs_new_eq:NN \clist_gremove_element:Nn \clist_gremove_all:Nn \cs_new_eq:NN \clist_display:N \clist_show:N \cs_new_eq:NN \clist_display:c \clist_show:c +\cs_new_protected:Npn \clist_trim_spaces:N #1 + { \tl_set:Nx #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_new_protected:Npn \clist_gtrim_spaces:N #1 + { \tl_gset:Nx #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_generate_variant:Nn \clist_trim_spaces:N { c } +\cs_generate_variant:Nn \clist_gtrim_spaces:N { c } %% %% %% End of file `l3clist.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty index 6e4116ee770..02c53d2a03c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty @@ -46,8 +46,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{l3names,graphicx,color} -\GetIdInfo$Id: l3coffins.dtx 2624 2011-08-18 19:02:45Z joseph $ +\RequirePackage{l3names} +\GetIdInfo$Id: l3coffins.dtx 2717 2011-09-03 13:40:31Z joseph $ {L3 Experimental coffin code layer} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -108,12 +108,12 @@ \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } { #2 } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } @@ -143,10 +143,10 @@ { \hbox_set:Nn #1 { - \group_begin: - \set@color + \color_group_begin: + \color_ensure_current: #2 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -161,10 +161,10 @@ \vbox_set:Nn #1 { \dim_set:Nn \tex_hsize:D {#2} - \group_begin: - \set@color + \color_group_begin: + \color_ensure_current: #3 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -199,7 +199,7 @@ \prop_get:cnNF { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 { - \msg_kernel_error:nnxx { coffin } { unknown-coffin-pole } + \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } } @@ -326,7 +326,7 @@ \l_coffin_pole_a_tl \l_coffin_pole_b_tl \bool_if:NT \l_coffin_error_bool { - \msg_kernel_error:nn { coffin } { no-pole-intersection } + \msg_kernel_error:nn { coffins } { no-pole-intersection } \dim_zero:N \l_coffin_x_dim \dim_zero:N \l_coffin_y_dim } @@ -624,7 +624,7 @@ { \coffin_rotate_bounding:nnn {##1} ##2 } \coffin_find_corner_maxima:N #1 \coffin_find_bounding_shift: - \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } + \box_rotate:Nn #1 {#2} \hbox_set:Nn #1 { \tex_kern:D \l_coffin_bounding_shift_dim @@ -737,6 +737,93 @@ {#5} {#6} } } +\fp_new:N \l_coffin_scale_x_fp +\fp_new:N \l_coffin_scale_y_fp +\dim_new:N \l_coffin_scaled_total_height_dim +\dim_new:N \l_coffin_scaled_width_dim +\cs_new_protected_nopar:Npn \coffin_resize:Nnn #1#2#3 + { + \coffin_set_user_dimensions:N #1 + \box_resize:Nnn #1 {#2} {#3} + \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \Width } + \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \TotalHeight } + \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_tmp_fp } + \coffin_resize_common:Nnn #1 {#2} {#3} + } +\cs_generate_variant:Nn \coffin_resize:Nnn { c } +\cs_new_protected_nopar:Npn \coffin_resize_common:Nnn #1#2#3 + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_scale_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } + \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } + } + \coffin_end_user_dimensions: + } +\cs_new_protected_nopar:Npn \coffin_scale:Nnn #1#2#3 + { + \box_scale:Nnn #1 {#2} {#3} + \coffin_set_user_dimensions:N #1 + \fp_set:Nn \l_coffin_scale_x_fp {#2} + \fp_set:Nn \l_coffin_scale_y_fp {#3} + \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp + { \l_coffin_scaled_total_height_dim #3 \TotalHeight } + { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } + \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp + { \l_coffin_scaled_width_dim -#2 \Width } + { \l_coffin_scaled_width_dim #2 \Width } + \coffin_resize_common:Nnn #1 + { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } + } +\cs_generate_variant:Nn \coffin_scale:Nnn { c } +\cs_new_protected_nopar:Npn \coffin_scale_vector:nnNN #1#2#3#4 + { + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#1} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_x_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#2} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_y_fp } + \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_tmp_fp } + } +\cs_new_protected_nopar:Npn \coffin_scale_corner:Nnnn #1#2#3#4 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } + } +\cs_new_protected_nopar:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + {#5} {#6} + } + } +\cs_new_protected_nopar:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 + { + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} + } + } +\cs_new_protected_nopar:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 + { + \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n #3 + \box_wd:N #1 } {#4} + {#5} {#6} + } + } \coffin_new:N \l_coffin_display_coffin \coffin_new:N \l_coffin_display_coord_coffin \coffin_new:N \l_coffin_display_pole_coffin @@ -965,7 +1052,7 @@ } \cs_new_nopar:Npn \coffin_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \coffin_show_structure:N { c } -\msg_kernel_new:nnnn { coffin } { no-pole-intersection } +\msg_kernel_new:nnnn { coffins } { no-pole-intersection } { No~intersection~between~coffin~poles. } { \c_msg_coding_error_text_tl @@ -973,10 +1060,10 @@ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin } +\msg_kernel_new:nnnn { coffins } { unknown-coffin } { Unknown~coffin~'#1'. } { The~coffin~'#1'~was~never~defined. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin-pole } +\msg_kernel_new:nnnn { coffins } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { \c_msg_coding_error_text_tl diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty new file mode 100644 index 00000000000..20de4534b8b --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty @@ -0,0 +1,64 @@ +%% +%% This is file `l3color.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3color.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3color.dtx Copyright(C) 2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: l3color.dtx 2717 2011-09-03 13:40:31Z joseph $ + {L3 Experimental colour support} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_eq:NN \color_group_begin: \group_begin: +\cs_new_protected_nopar:Npn \color_group_end: + { + \tex_par:D + \group_end: + } +\cs_new_protected_nopar:Npn \color_ensure_current: { \set@color } +%% +%% +%% End of file `l3color.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index e7c0b14659e..bc296c6ccde 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -52,7 +52,7 @@ \let \filedateOld \ExplFileDate \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription -\GetIdInfo$Id: l3doc.dtx 2674 2011-08-27 19:43:44Z mittelba $ +\GetIdInfo$Id: l3doc.dtx 2719 2011-09-04 13:40:25Z will $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -92,10 +92,14 @@ \ProcessOptions \LoadClass{article} \RequirePackage{doc} -\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes} +\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,pifont,textcomp,trace,underscore,csquotes} \bool_if:NT \g_doc_lmodern_bool { \RequirePackage[T1]{fontenc} \RequirePackage{lmodern} + \begingroup + \ttfamily + \DeclareFontShape{T1}{lmtt}{m}{it}{<->ec-lmtto10}{} + \endgroup } \RequirePackage{hypdoc} \let\doc@verbatim\verbatim @@ -234,6 +238,7 @@ \bool_gset_false:N \l_doc_meta_TF_bool \bool_gset_false:N \l_doc_meta_pTF_bool \bool_gset_false:N \l_doc_meta_EXP_bool + \bool_gset_false:N \l_doc_meta_rEXP_bool \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} } \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1} @@ -258,6 +263,11 @@ } \cs_set:Nn \doc_meta_opt_EXP: { \bool_gset_true:N \l_doc_meta_EXP_bool + \bool_gset_false:N \l_doc_meta_rEXP_bool +} +\cs_set:Nn \doc_meta_opt_rEXP: { + \bool_gset_false:N \l_doc_meta_EXP_bool + \bool_gset_true:N \l_doc_meta_rEXP_bool } \cs_set:Nn \doc_meta_opt_pTF: { \bool_gset_true:N \l_doc_meta_pTF_bool @@ -292,6 +302,7 @@ \bool_new:N \l_doc_meta_TF_bool \bool_new:N \l_doc_meta_pTF_bool \bool_new:N \l_doc_meta_EXP_bool +\bool_new:N \l_doc_meta_rEXP_bool \cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop { \tl_if_in:nnT {#2} { (TF) } { @@ -301,6 +312,9 @@ \tl_if_in:nnT {#2} { (EXP) } { \bool_gset_true:N \l_doc_meta_EXP_bool } + \tl_if_in:nnT {#2} { (rEXP) } { + \bool_gset_true:N \l_doc_meta_rEXP_bool + } \tl_if_in:nnT {#2} { (pTF) } { \bool_gset_true:N \l_doc_meta_TF_bool @@ -330,7 +344,9 @@ \bool_gset_true:N \l_doc_meta_TF_bool \doc_showmacro_aux_ii:w #1::\q_stop }{ - \doc_showmacro_aux_ii:w #1::\q_stop + \exp_args:Nf \tl_if_head_eq_charcode:nNTF { \use_none:n #1 } {:} + { \doc_showmacro_aux_iii:n {#1} } + { \doc_showmacro_aux_ii:w #1::\q_stop } } } \cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop { @@ -348,7 +364,11 @@ & \bool_if:NT \l_doc_meta_EXP_bool { \hspace{\tabcolsep} - $\star$ + \hyperlink{expstar}{$\star$} + } + \bool_if:NT \l_doc_meta_rEXP_bool { + \hspace{\tabcolsep} + \hyperlink{rexpstar}{\ding{73}}% hollow star } \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} @@ -357,11 +377,21 @@ \exp_args:Nf\label{doc/function/\g_doc_macro_tl#3#2} } } +\cs_set_nopar:Nn \doc_showmacro_aux_iii:n { + \nextnewline + \tl_gset:Nx \g_doc_macro_tl {#1} + #1 & + \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {} + \bool_if:NT \g_doc_full_bool { + \exp_args:Nf\label{doc/function/\g_doc_macro_tl} + } +} \dim_new:N \g_doc_syntax_dim \dim_set:Nn \g_doc_syntax_dim {0.7\textwidth} \newenvironment{syntax}{ \minipage[b]{\g_doc_syntax_dim} - \cs_set_nopar:Npn \meta@font@select{\rmfamily\itshape} % (Will: I HATE italic cmtt!) \small\ttfamily\raggedright \obeyspaces\obeylines }{ @@ -541,10 +571,13 @@ \fontfamily{lmtt}\fontseries{lc}\small } \cs_set_nopar:Npn \doc_typeset_TF: { - \itshape TF% - \makebox[0pt][r]{% - \color[gray]{0.5} - \underline { \phantom{\itshape TF} \kern-0.1em } + \hyperlink{explTF}{% + \color{black}% + \itshape TF% + \makebox[0pt][r]{% + \color{red} + \underline { \phantom{\itshape TF} \kern-0.1em } + } } } \cs_set_nopar:Npn \doc_typeset_aux:n #1 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty index c46f6d3deee..348ad546d9f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3io.dtx 2724 2011-09-05 18:51:51Z bruno $ {L3 Experimental input-output operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -236,9 +236,7 @@ \cs_new:Npn \ior_show_aux:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl - #1 \iow_char:N - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl - \exp_not:n {#2} + #1 \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} } \cs_new_protected_nopar:Npn \iow_list_streams: { @@ -297,6 +295,11 @@ \tl_new:N \l_iow_wrapped_tl \quark_new:N \q_iow_stop \bool_new:N \l_iow_line_start_bool +\group_begin: + \char_set_catcode_other:N \* + \char_set_lccode:nn {`\*} {`\ } + \tl_to_lowercase:n { \tl_const:Nn \c_catcode_other_space_tl { * } } +\group_end: \cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 { \group_begin: @@ -305,8 +308,9 @@ \tl_clear:N \l_iow_current_line_tl \tl_clear:N \l_iow_wrap_tl \bool_set_true:N \l_iow_line_start_bool - \cs_set:Npx \\ { \c_space_tl \iow_newline: \c_space_tl } - \cs_set_eq:NN \ \c_space_tl + \cs_set:Npx \\ + { \c_catcode_other_space_tl \iow_newline: \c_catcode_other_space_tl } + \cs_set_eq:NN \ \c_catcode_other_space_tl #4 \protected@edef \l_iow_wrap_tl {#1} \cs_set:Npn \\ { \iow_newline: #2 } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty index 434ba050077..8a34a4c8331 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 2677 2011-08-28 06:54:22Z joseph $ +\GetIdInfo$Id: l3keys.dtx 2722 2011-09-05 08:49:40Z joseph $ {L3 Experimental key-value interfaces} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index c98aad9f7c2..eca399c5b79 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2601 2011-08-16 23:20:27Z bruno $ +\GetIdInfo$Id: l3msg.dtx 2728 2011-09-05 19:13:18Z joseph $ {L3 Experimental messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 2aeb1f516e6..67ee78ebee3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2720 2011-09-05 08:12:39Z bruno $ {L3 Experimental control structures} %% \ProvidesExplPackage diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty index 222170544df..5bda2318bec 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3prop.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental property lists} %% \ProvidesExplPackage @@ -220,9 +220,12 @@ \tl_set:Nn #1 {#3} \prg_return_true: } -\cs_generate_variant:Nn \prop_get:NnNT { c } -\cs_generate_variant:Nn \prop_get:NnNF { c } -\cs_generate_variant:Nn \prop_get:NnNTF { c } +\cs_generate_variant:Nn \prop_get:NnNT { NV , No } +\cs_generate_variant:Nn \prop_get:NnNF { NV , No } +\cs_generate_variant:Nn \prop_get:NnNTF { NV , No } +\cs_generate_variant:Nn \prop_get:NnNT { c , cV , co } +\cs_generate_variant:Nn \prop_get:NnNF { c , cV , co } +\cs_generate_variant:Nn \prop_get:NnNTF { c , cV , co } \cs_new_nopar:Npn \prop_map_function:NN #1#2 { \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 @@ -256,13 +259,13 @@ { \prop_if_empty:NTF #1 { - \iow_term:x { Property~list~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Property~list~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Property~list~\token_to_str:N #1 \c_space_tl + Property~list~\token_to_str:N #1~ contains~the~pairs~(without~outer~braces): } \tl_set:Nx \l_prop_show_tl diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 9db270f6006..7bfc1f31ae2 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3seq.dtx 2725 2011-09-05 18:53:03Z bruno $ {L3 Experimental sequences and stacks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -343,13 +343,13 @@ { \seq_if_empty:NTF #1 { - \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty } + \iow_term:x { Sequence~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { - Sequence~\token_to_str:N #1 \c_space_tl + Sequence~\token_to_str:N #1~ contains~the~items~(without~outer~braces): } \tl_set:Nx \l_seq_show_tl diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index f304c84c084..f77fb545024 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2686 2011-08-29 19:41:06Z joseph $ {L3 Experimental token lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty index 4ffd05760ff..274bbdd2bd9 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2665 2011-08-25 22:15:27Z joseph $ +\GetIdInfo$Id: l3token.dtx 2691 2011-08-29 20:08:46Z joseph $ {L3 Experimental token manipulation} %% \begin{function}[EXP,pTF]{\token_if_protected_long_macro:N} \ProvidesExplPackage |