From 4796116f06de1574987757c8945f6678d21f0a40 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 25 Nov 2011 00:14:23 +0000 Subject: l3kernel 2966 (19nov11) git-svn-id: svn://tug.org/texlive/trunk@24657 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 4 +- .../texmf-dist/source/latex/l3kernel/l3basics.dtx | 87 ++++-- Master/texmf-dist/source/latex/l3kernel/l3box.dtx | 295 +++++++++++++++------ .../texmf-dist/source/latex/l3kernel/l3coffins.dtx | 53 +++- .../texmf-dist/source/latex/l3kernel/l3drivers.dtx | 285 +++++++++++++------- Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 32 +-- .../texmf-dist/source/latex/l3kernel/l3names.dtx | 5 +- Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 35 ++- Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 225 +++++++++++----- Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 14 +- .../texmf-dist/source/latex/l3kernel/l3token.dtx | 6 +- 11 files changed, 736 insertions(+), 305 deletions(-) (limited to 'Master/texmf-dist/source/latex/l3kernel') diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index a5c7cde052a..e4e3f97ae46 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/10/09} -\def\ExplFileVersion{2900} +\def\ExplFileDate{2011/11/19} +\def\ExplFileVersion{2966} % %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 51bbd55bfab..fe88fa327ee 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 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2915 2011-10-15 21:21:08Z bruno $ {L3 Experimental basic definitions} % %<*driver> @@ -1143,24 +1143,6 @@ % identical. "\if_charcode:w" is an alternative name for "\if:w". % \end{function} % -% \begin{function}[EXP]{\if_predicate:w} -% \begin{syntax} -% "\if_predicate:w" "\else:" "\fi:" -% \end{syntax} -% This function takes a predicate function and -% branches according to the result. (In practice this function would also -% accept a single boolean variable in place of the but to make the -% coding clearer this should be done through "\if_bool:N".) -% \end{function} -% -% \begin{function}[EXP]{\if_bool:N} -% \begin{syntax} -% "\if_bool:N" "\else:" "\fi:" -% \end{syntax} -% This function takes a boolean variable and -% branches according to the result. -% \end{function} -% % \begin{function}[EXP]{\if_cs_exist:N, \if_cs_exist:w} % \begin{syntax} % "\if_cs_exist:N" "\else:" "\fi:" \\ @@ -1205,6 +1187,35 @@ % error. % \end{function} % +% \section{Experimental functions} +% +% \begin{function}[EXP,TF,added=2011-10-10] +% {\cs_if_exist_use:N, \cs_if_exist_use:c} +% \begin{syntax} +% \cs{cs_if_exist_use:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} +% \end{syntax} +% \begin{function}[EXP,added=2011-10-10] +% {\cs_if_exist_use:N, \cs_if_exist_use:c} +% \begin{syntax} +% \cs{cs_if_exist_use:N} \meta{control sequence} +% \end{syntax} +% If the \meta{control sequence} exists, leave it in the input stream, +% followed by the \meta{true code} (unbraced). Otherwise, leave the +% \meta{false} code in the input stream. For example, +% \begin{verbatim} +% \cs_set:Npn \mypkg_use_character:N #1 +% { \cs_if_exist_use:cF { mypkg_#1:n } { \mypkg_default:N #1 } } +% \end{verbatim} +% calls the function |\mypkg_#1:n| if it exists, and falls back to +% a default action otherwise. This could also be done (more slowly) +% using \cs{prg_case_str:xxn}. +% \begin{texnote} +% The \texttt{c} variants do not introduce the \meta{control sequence} +% in the hash table if it is not there. +% \end{texnote} +% \end{function} +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -1239,8 +1250,6 @@ % \begin{macro}{\fi:} % \begin{macro}{\reverse_if:N} % \begin{macro}{\if:w} -% \begin{macro}{\if_bool:N} -% \begin{macro}{\if_predicate:w} % \begin{macro}{\if_charcode:w} % \begin{macro}{\if_catcode:w} % \begin{macro}{\if_meaning:w} @@ -1253,8 +1262,6 @@ \tex_let:D \fi: \tex_fi:D \tex_let:D \reverse_if:N \etex_unless:D \tex_let:D \if:w \tex_if:D -\tex_let:D \if_bool:N \tex_ifodd:D -\tex_let:D \if_predicate:w \tex_ifodd:D \tex_let:D \if_charcode:w \tex_if:D \tex_let:D \if_catcode:w \tex_ifcat:D \tex_let:D \if_meaning:w \tex_ifx:D @@ -1269,8 +1276,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\if_mode_math:} % \begin{macro}{\if_mode_horizontal:} @@ -2163,6 +2168,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP,TF,added=2011-10-10] +% {\cs_if_exist_use:N, \cs_if_exist_use:c} +% \begin{macro}[EXP,added=2011-10-10] +% {\cs_if_exist_use:N, \cs_if_exist_use:c} +% The \cs{cs_if_exist_use:\ldots{}} functions cannot be implemented +% as conditionals because the true branch must leave both the control +% sequence itself and the true code in the input stream. +% For the \texttt{c} variants, we are careful not to put the control +% sequence in the hash table if it does not exist. +% \begin{macrocode} +\cs_set:Npn \cs_if_exist_use:NTF #1#2 + { \cs_if_exist:NTF #1 { #1 #2} } +\cs_set:Npn \cs_if_exist_use:NF #1 + { \cs_if_exist:NTF #1 { #1 } } +\cs_set:Npn \cs_if_exist_use:NT #1 #2 + { \cs_if_exist:NTF #1 { #1#2 } { } } +\cs_set:Npn \cs_if_exist_use:N #1 + { \cs_if_exist:NTF #1 { #1 } { } } +\cs_set:Npn \cs_if_exist_use:cTF #1#2 + { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } } +\cs_set:Npn \cs_if_exist_use:cF #1 + { \cs_if_exist:cTF {#1} { \use:c {#1} } } +\cs_set:Npn \cs_if_exist_use:cT #1#2 + { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } { } } +\cs_set:Npn \cs_if_exist_use:c #1 + { \cs_if_exist:cTF {#1} { \use:c {#1} } { } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Defining and checking (new) functions} % % \begin{macro}{\c_minus_one, \c_zero, \c_sixteen} @@ -2561,7 +2596,7 @@ { \cs_split_function:NN #1 \cs_get_arg_count_from_signature_aux:nnN } \cs_new:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3 { - \if_predicate:w #3 + \if_meaning:w \c_true_bool #3 \exp_after:wN \use_i:nn \else: \exp_after:wN\use_ii:nn diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 6dc66cd9c85..ff71f36659d 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 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3box.dtx 2960 2011-11-15 08:50:21Z joseph $ {L3 Experimental boxes} % %<*driver> @@ -212,45 +212,40 @@ % % \section{Measuring and setting box dimensions} % -% \begin{function}[EXP]{\box_dp:N, \box_dp:c} +% \begin{function}{\box_dp:N, \box_dp:c} % \begin{syntax} % \cs{box_dp:N} \meta{box} % \end{syntax} % Calculates the depth (below the baseline) of the \meta{box} -% and leaves this in the input stream. The output of this function -% is suitable for use in a \meta{dimension expression} for -% calculations. +% in a form suitable for use in a \meta{dimension expression}. % \begin{texnote} % This is the \TeX{} primitive \tn{dp}. % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\box_ht:N, \box_ht:c} +% \begin{function}{\box_ht:N, \box_ht:c} % \begin{syntax} % \cs{box_ht:N} \meta{box} % \end{syntax} % Calculates the height (above the baseline) of the \meta{box} -% and leaves this in the input stream. The output of this function -% is suitable for use in a \meta{dimension expression} for -% calculations. +% in a form suitable for use in a \meta{dimension expression}. % \begin{texnote} % This is the \TeX{} primitive \tn{ht}. % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\box_wd:N, \box_wd:c} +% \begin{function}{\box_wd:N, \box_wd:c} % \begin{syntax} % \cs{box_wd:N} \meta{box} % \end{syntax} -% Calculates the width of the \meta{box} and leaves this in the -% input stream. The output of this function is suitable for use in a -% \meta{dimension expression} for calculations. +% Calculates the width of the \meta{box} in a form +% suitable for use in a \meta{dimension expression}. % \begin{texnote} % This is the \TeX{} primitive \tn{wd}. % \end{texnote} % \end{function} % -% \begin{function}{\box_set_dp:Nn, \box_set_dp:cn} +% \begin{function}[updated = 2011-10-22]{\box_set_dp:Nn, \box_set_dp:cn} % \begin{syntax} % \cs{box_set_dp:Nn} \meta{box} \Arg{dimension expression} % \end{syntax} @@ -258,7 +253,7 @@ % the \Arg{dimension expression}. This is a global assignment. % \end{function} % -% \begin{function}{\box_set_ht:Nn, \box_set_ht:cn} +% \begin{function}[updated = 2011-10-22]{\box_set_ht:Nn, \box_set_ht:cn} % \begin{syntax} % \cs{box_set_ht:Nn} \meta{box} \Arg{dimension expression} % \end{syntax} @@ -266,7 +261,7 @@ % the \Arg{dimension expression}. This is a global assignment. % \end{function} % -% \begin{function}{\box_set_wd:Nn, \box_set_wd:cn} +% \begin{function}[updated = 2011-10-22]{\box_set_wd:Nn, \box_set_wd:cn} % \begin{syntax} % \cs{box_set_wd:Nn} \meta{box} \Arg{dimension expression} % \end{syntax} @@ -298,10 +293,10 @@ % \textbf{This function is experimental} % \end{function} % -% \begin{function}[added = 2011-09-02] +% \begin{function}[added = 2011-09-02, updated = 2011-10-22] % {\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} +% \cs{box_resize_to_ht_plus_dp:Nn} \meta{box} \Arg{y-size} % \end{syntax} % Resize the \meta{box} to \meta{y-size} vertically, scaling the horizontal % size by the same amount (\meta{y-size} is a dimension expression). @@ -316,7 +311,7 @@ % \textbf{This function is experimental} % \end{function} % -% \begin{function}[added = 2011-09-02] +% \begin{function}[added = 2011-09-02, updated = 2011-10-22] % {\box_resize_to_wd:Nn, \box_resize_to_wd:cn} % \begin{syntax} % \cs{box_resize_to_wd:Nnn} \meta{box} \Arg{x-size} @@ -332,7 +327,8 @@ % \textbf{This function is experimental} % \end{function} % -% \begin{function}[added = 2011-09-02]{\box_rotate:Nn, \box_rotate:cn} +% \begin{function}[added = 2011-09-02, updated = 2011-10-22] +% {\box_rotate:Nn, \box_rotate:cn} % \begin{syntax} % \cs{box_rotate:Nn} \meta{box} \Arg{angle} % \end{syntax} @@ -347,7 +343,8 @@ % \textbf{This function is experimental} % \end{function} % -% \begin{function}[added = 2011-09-02]{\box_scale:Nnn, \box_scale:cnn} +% \begin{function}[added = 2011-09-02, updated = 2011-10-22] +% {\box_scale:Nnn, \box_scale:cnn} % \begin{syntax} % \cs{box_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale} % \end{syntax} @@ -362,6 +359,63 @@ % \textbf{This function is experimental} % \end{function} % +% \section{Viewing part of a box} +% +% \begin{function}[added = 2011-11-13]{\box_clip:N, \box_clip:c} +% \begin{syntax} +% \cs{box_clip:N} \meta{box} +% \end{syntax} +% Clips the \meta{box} in the output so that only material inside the +% bounding box is displayed in the output. The updated \meta{box} will be an +% hbox, irrespective of the nature of the \meta{box} before the clipping is +% applied. The clipping applies within the current \TeX{} group level. +% +% \textbf{This function is experimental} +% \begin{texnote} +% Clipping is implemented by the driver, and as such the full content of +% the box is places in the output file. Thus clipping does not remove +% any information from the raw output, and hidden material can therefore +% be viewed by direct examination of the file. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2011-11-13] +% {\box_trim:Nnnnn, \box_trim:cnnnn} +% \begin{syntax} +% \cs{box_trim:Nnnnn} \meta{box} \Arg{left} \Arg{bottom} \Arg{right} \Arg{top} +% \end{syntax} +% Adjusts the bounding box of the \meta{box} \meta{left} is removed from +% the left-hand edge of the bounding box, \meta{right} from the right-hand +% edge and so fourth. All adjustments are \meta{dimension expressions}. +% Material output of the bounding box will still be displayed in the output +% unless \cs{box_clip:N} is subsequently applied. +% The updated \meta{box} will be an +% hbox, irrespective of the nature of the \meta{box} before the viewport +% operation is applied. The clipping applies within the current \TeX{} +% group level. +% +% \textbf{This function is experimental} +% \end{function} +% +% \begin{function}[added = 2011-11-13] +% {\box_viewport:Nnnnn, \box_viewport:cnnnn} +% \begin{syntax} +% \cs{box_viewport:Nnnnn} \meta{box} \Arg{llx} \Arg{lly} \Arg{urx} \Arg{ury} +% \end{syntax} +% Adjusts the bounding box of the \meta{box} such that it has lower-left +% co-ordinates (\meta{llx}, \meta{lly}) and upper-right co-ordinates +% (\meta{urx}, \meta{ury}). All four co-ordinate positions are +% \meta{dimension expressions}. Material output of the bounding box will +% still be displayed in the output unless \cs{box_clip:N} is +% subsequently applied. +% The updated \meta{box} will be an +% hbox, irrespective of the nature of the \meta{box} before the viewport +% operation is applied. The clipping applies within the current \TeX{} +% group level. +% +% \textbf{This function is experimental} +% \end{function} +% % \section{Box conditionals} % % \begin{function}[EXP,pTF]{\box_if_empty:N, \box_if_empty:c} @@ -389,7 +443,7 @@ % \end{function} % % \section{The last box inserted} -% +% % \begin{function} % { % \box_set_to_last:N, \box_set_to_last:c, @@ -404,17 +458,6 @@ % it is not possible to recover the last added item. % \end{function} % -% \begin{variable}{\l_last_box} -% This is a box containing the last item added to the current partial -% list, except in the case of the main vertical list (main galley), in -% which case this box is always void. Notice that although this is -% not a constant, it is \emph{not} settable by the programmer but is -% instead varied by \TeX{}. -% \begin{texnote} -% This is the \TeX{} primitive \tn{lastbox} renamed. -% \end{texnote} -% \end{variable} -% % \section{Constant boxes} % % \begin{variable}{\c_empty_box} @@ -714,7 +757,7 @@ % where the \meta{content} may not be a simple argument. % \end{function} % -% \begin{function}{\vbox_set_split_to_ht:NNn} +% \begin{function}[updated = 2011-10-22]{\vbox_set_split_to_ht:NNn} % \begin{syntax} % \cs{vbox_set_split_to_ht:NNn} \meta{box1} \meta{box2} \Arg{dimexpr} % \end{syntax} @@ -837,9 +880,9 @@ % \testfile* % Clear a \meta{box} register. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_clear:N #1 +\cs_new_protected:Npn \box_clear:N #1 { \box_set_eq:NN #1 \c_empty_box } -\cs_new_protected_nopar:Npn \box_gclear:N #1 +\cs_new_protected:Npn \box_gclear:N #1 { \box_gset_eq:NN #1 \c_empty_box } \cs_generate_variant:Nn \box_clear:N { c } \cs_generate_variant:Nn \box_gclear:N { c } @@ -852,13 +895,13 @@ % \testfile* % Clear or new. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_clear_new:N #1 +\cs_new_protected:Npn \box_clear_new:N #1 { \cs_if_exist:NTF #1 { \box_set_eq:NN #1 \c_empty_box } { \box_new:N #1 } } -\cs_new_protected_nopar:Npn \box_gclear_new:N #1 +\cs_new_protected:Npn \box_gclear_new:N #1 { \cs_if_exist:NTF #1 { \box_gset_eq:NN #1 \c_empty_box } @@ -878,9 +921,9 @@ % \testfile* % Assigning the contents of a box to be another box. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_set_eq:NN #1#2 +\cs_new_protected:Npn \box_set_eq:NN #1#2 { \tex_setbox:D #1 \tex_copy:D #2 } -\cs_new_protected_nopar:Npn \box_gset_eq:NN +\cs_new_protected:Npn \box_gset_eq:NN { \tex_global:D \box_set_eq:NN } \cs_generate_variant:Nn \box_set_eq:NN { cN , Nc , cc } \cs_generate_variant:Nn \box_gset_eq:NN { cN , Nc , cc } @@ -903,9 +946,9 @@ % Assigning the contents of a box to be another box. % This clears the second box globally (that's how \TeX{} does it). % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_set_eq_clear:NN #1#2 +\cs_new_protected:Npn \box_set_eq_clear:NN #1#2 { \tex_setbox:D #1 \tex_box:D #2 } -\cs_new_protected_nopar:Npn \box_gset_eq_clear:NN +\cs_new_protected:Npn \box_gset_eq_clear:NN { \tex_global:D \box_set_eq_clear:NN } \cs_generate_variant:Nn \box_set_eq_clear:NN { cN , Nc , cc } \cs_generate_variant:Nn \box_gset_eq_clear:NN { cN , Nc , cc } @@ -938,11 +981,11 @@ % Measuring is easy: all primitive work. These primitives are not % expandable, so the derived functions are not either. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_set_dp:Nn #1#2 +\cs_new_protected:Npn \box_set_dp:Nn #1#2 { \box_dp:N #1 \dim_eval:w #2 \dim_eval_end: } -\cs_new_protected_nopar:Npn \box_set_ht:Nn #1#2 +\cs_new_protected:Npn \box_set_ht:Nn #1#2 { \box_ht:N #1 \dim_eval:w #2 \dim_eval_end: } -\cs_new_protected_nopar:Npn \box_set_wd:Nn #1#2 +\cs_new_protected:Npn \box_set_wd:Nn #1#2 { \box_wd:N #1 \dim_eval:w #2 \dim_eval_end: } \cs_generate_variant:Nn \box_set_ht:Nn { c } \cs_generate_variant:Nn \box_set_dp:Nn { c } @@ -1038,21 +1081,14 @@ % % \subsection{The last box inserted} % -% \begin{variable}{\l_last_box} -% A different name for this read-only primitive. -% \begin{macrocode} -\cs_new_eq:NN \l_last_box \tex_lastbox:D -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\box_set_to_last:N, \box_set_to_last:c} % \begin{macro}{\box_gset_to_last:N, \box_gset_to_last:c} % \testfile* % Set a box to the previous box. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_set_to_last:N #1 - { \tex_setbox:D #1 \l_last_box } -\cs_new_protected_nopar:Npn \box_gset_to_last:N +\cs_new_protected:Npn \box_set_to_last:N #1 + { \tex_setbox:D #1 \tex_lastbox:D } +\cs_new_protected:Npn \box_gset_to_last:N { \tex_global:D \box_set_to_last:N } \cs_generate_variant:Nn \box_set_to_last:N { c } \cs_generate_variant:Nn \box_gset_to_last:N { c } @@ -1104,7 +1140,7 @@ % \testfile{m3box002.lvt} % Put a horizontal box directly into the input stream. % \begin{macrocode} -\cs_new_protected_nopar:Npn \hbox:n { \tex_hbox:D \scan_stop: } +\cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: } % \end{macrocode} % \end{macro} % @@ -1113,7 +1149,7 @@ % \testfile* % \begin{macrocode} \cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} } -\cs_new_protected_nopar:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn } +\cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn } \cs_generate_variant:Nn \hbox_set:Nn { c } \cs_generate_variant:Nn \hbox_gset:Nn { c } % \end{macrocode} @@ -1127,7 +1163,7 @@ % \begin{macrocode} \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 { \tex_setbox:D #1 \tex_hbox:D to \dim_eval:w #2 \dim_eval_end: {#3} } -\cs_new_protected_nopar:Npn \hbox_gset_to_wd:Nnn +\cs_new_protected:Npn \hbox_gset_to_wd:Nnn { \tex_global:D \hbox_set_to_wd:Nnn } \cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c } \cs_generate_variant:Nn \hbox_gset_to_wd:Nnn { c } @@ -1142,9 +1178,9 @@ % Storing material in a horizontal box. This type is useful in % environment definitions. % \begin{macrocode} -\cs_new_protected_nopar:Npn \hbox_set:Nw #1 +\cs_new_protected:Npn \hbox_set:Nw #1 { \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token } -\cs_new_protected_nopar:Npn \hbox_gset:Nw +\cs_new_protected:Npn \hbox_gset:Nw { \tex_global:D \hbox_set:Nw } \cs_generate_variant:Nn \hbox_set:Nw { c } \cs_generate_variant:Nn \hbox_gset:Nw { c } @@ -1218,8 +1254,8 @@ % \TestFiles{m3box003.lvt} % Put a vertical box directly into the input stream. % \begin{macrocode} -\cs_new_protected_nopar:Npn \vbox:n { \tex_vbox:D \scan_stop: } -\cs_new_protected_nopar:Npn \vbox_top:n { \tex_vtop:D \scan_stop: } +\cs_new_protected:Npn \vbox:n { \tex_vbox:D \scan_stop: } +\cs_new_protected:Npn \vbox_top:n { \tex_vtop:D \scan_stop: } % \end{macrocode} % \end{macro} % \end{macro} @@ -1242,7 +1278,7 @@ % Storing material in a vertical box with a natural height. % \begin{macrocode} \cs_new_protected:Npn \vbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_vbox:D {#2} } -\cs_new_protected_nopar:Npn \vbox_gset:Nn { \tex_global:D \vbox_set:Nn } +\cs_new_protected:Npn \vbox_gset:Nn { \tex_global:D \vbox_set:Nn } \cs_generate_variant:Nn \vbox_set:Nn { c } \cs_generate_variant:Nn \vbox_gset:Nn { c } % \end{macrocode} @@ -1257,7 +1293,7 @@ % \begin{macrocode} \cs_new_protected:Npn \vbox_set_top:Nn #1#2 { \tex_setbox:D #1 \tex_vtop:D {#2} } -\cs_new_protected_nopar:Npn \vbox_gset_top:Nn +\cs_new_protected:Npn \vbox_gset_top:Nn { \tex_global:D \vbox_set_top:Nn } \cs_generate_variant:Nn \vbox_set_top:Nn { c } \cs_generate_variant:Nn \vbox_gset_top:Nn { c } @@ -1272,7 +1308,7 @@ % \begin{macrocode} \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 { \tex_setbox:D #1 \tex_vbox:D to \dim_eval:w #2 \dim_eval_end: {#3} } -\cs_new_protected_nopar:Npn \vbox_gset_to_ht:Nnn +\cs_new_protected:Npn \vbox_gset_to_ht:Nnn { \tex_global:D \vbox_set_to_ht:Nnn } \cs_generate_variant:Nn \vbox_set_to_ht:Nnn { c } \cs_generate_variant:Nn \vbox_gset_to_ht:Nnn { c } @@ -1287,9 +1323,9 @@ % Storing material in a vertical box. This type is useful in % environment definitions. % \begin{macrocode} -\cs_new_nopar:Npn \vbox_set:Nw #1 +\cs_new:Npn \vbox_set:Nw #1 { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token } -\cs_new_protected_nopar:Npn \vbox_gset:Nw +\cs_new_protected:Npn \vbox_gset:Nw { \tex_global:D \vbox_set:Nw } \cs_generate_variant:Nn \vbox_set:Nw { c } \cs_generate_variant:Nn \vbox_gset:Nw { c } @@ -1336,7 +1372,7 @@ % \testfile* % Splitting a vertical box in two. % \begin{macrocode} -\cs_new_protected_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3 +\cs_new_protected: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: } % \end{macrocode} % \end{macro} @@ -1420,7 +1456,7 @@ % 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 +\cs_new_protected:Npn \box_rotate:Nn #1#2 { \hbox_set:Nn #1 { @@ -1442,7 +1478,7 @@ % 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 +\cs_new_protected: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 } @@ -1534,7 +1570,7 @@ % 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: +\cs_new_protected: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 } @@ -1552,7 +1588,7 @@ % 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 +\cs_new_protected: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} @@ -1563,7 +1599,7 @@ \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 +\cs_new_protected: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} @@ -1583,7 +1619,7 @@ % this by hand means a lot less calculating and avoids lots of % comparisons. % \begin{macrocode} -\cs_new_protected_nopar:Npn \box_rotate_quadrant_one: +\cs_new_protected:Npn \box_rotate_quadrant_one: { \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim \l_box_top_new_dim @@ -1594,7 +1630,7 @@ \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: +\cs_new_protected:Npn \box_rotate_quadrant_two: { \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim \l_box_top_new_dim @@ -1605,7 +1641,7 @@ \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: +\cs_new_protected:Npn \box_rotate_quadrant_three: { \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim \l_box_top_new_dim @@ -1616,7 +1652,7 @@ \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: +\cs_new_protected:Npn \box_rotate_quadrant_four: { \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim \l_box_top_new_dim @@ -1726,7 +1762,7 @@ % 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 +\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 { \hbox_set:Nn #1 { @@ -1747,7 +1783,7 @@ } } \cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } -\cs_new_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 +\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 { \hbox_set:Nn #1 { @@ -1781,7 +1817,7 @@ % 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 +\cs_new_protected:Npn \box_scale:Nnn #1#2#3 { \hbox_set:Nn #1 { @@ -1803,7 +1839,7 @@ } } \cs_generate_variant:Nn \box_scale:Nnn { c } -\cs_new_protected_nopar:Npn \box_scale_aux:Nnn #1#2#3 +\cs_new_protected:Npn \box_scale_aux:Nnn #1#2#3 { \fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp { @@ -1827,7 +1863,7 @@ % 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 +\cs_new_protected:Npn \box_resize_common:N #1 { \hbox_set:Nn \l_box_tmp_box { @@ -1862,7 +1898,100 @@ } } % \end{macrocode} -%\end{macro} +% \end{macro} +% +% \subsection{Viewing part of a box} +% +% \begin{macro}{\box_clip:N, \box_clip:c} +% A wrapper around the driver-dependent code. +% \begin{macrocode} +\cs_new_protected:Npn \box_clip:N #1 + { \hbox_set:Nn #1 { \driver_box_use_clip:N #1 } } +\cs_generate_variant:Nn \box_clip:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\box_trim:Nnnnn, \box_trim:cnnnn} +% Trimming from the left- and right-hand edges of the box is easy. The total +% width is set to remove from the right, and a skip will shift the material +% to remove from the left. +% \begin{macrocode} +\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5 + { + \box_set_wd:Nn #1 { \box_wd:N #1 - \dim_eval:n {#4} - \dim_eval:n {#2} } + \hbox_set:Nn #1 + { + \skip_horizontal:n { - \dim_eval:n {#2} } + \box_use:N #1 + } +% \end{macrocode} +% For the height and depth, there is a need to watch the baseline is +% respected. Material always has to stay on the correct side, so trimming +% has to check that there is enough material to trim. +% \begin{macrocode} + \dim_compare:nNnTF { \box_dp:N #1 } > {#3} + { \box_set_dp:Nn #1 { \box_dp:N #1 - \dim_eval:n {#3} } } + { + \hbox_set:Nn #1 + { + \box_move_down:nn { \dim_eval:n {#3} - \box_dp:N #1 } + { \box_use:N #1 } + } + \box_set_dp:Nn #1 \c_zero_dim + } + \dim_compare:nNnTF { \box_ht:N #1 } > {#5} + { \box_set_ht:Nn #1 { \box_ht:N #1 - \dim_eval:n {#5} } } + { + \hbox_set:Nn #1 + { + \box_move_up:nn { \dim_eval:n {#5} - \box_ht:N #1 } + { \box_use:N #1 } + } + \box_set_ht:Nn #1 \c_zero_dim + } + } +\cs_generate_variant:Nn \box_trim:Nnnnn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\box_viewport:Nnnnn, \box_viewport:cnnnn} +% The same general logic as for clipping, but with absolute dimensions. +% Thus again width is easy and height is harder. +% \begin{macrocode} +\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 + { + \box_set_wd:Nn #1 { \dim_eval:n {#4} - \dim_eval:n {#2} } + \hbox_set:Nn #1 + { + \skip_horizontal:n { - \dim_eval:n {#2} } + \box_use:N #1 + } + \dim_compare:nNnTF {#3} > \c_zero_dim + { + \hbox_set:Nn #1 { \box_move_down:nn {#3} { \box_use:N #1 } } + \box_set_dp:Nn #1 \c_zero_dim + } + { \box_set_dp:Nn #1 { - \dim_eval:n {#3} } } + \dim_compare:nNnTF {#5} > \c_zero_dim + { \box_set_ht:Nn #1 {#5} } + { + \hbox_set:Nn #1 + { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N #1 } } + \box_set_ht:Nn #1 \c_zero_dim + } + } +\cs_generate_variant:Nn \box_viewport:Nnnnn { c } +% \end{macrocode} +% \end{macro} +% +% \subsection{Deprecated functions} +% +% \begin{variable}{\l_last_box} +% Deprecated 2011-11-13, for removal by 2012-02-28. +% \begin{macrocode} +\cs_new_eq:NN \l_last_box \tex_lastbox:D +% \end{macrocode} +% \end{variable} % % \begin{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 197f62c3960..34bbe53d2fd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3coffins.dtx 2814 2011-09-12 12:56:08Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 2963 2011-11-15 22:06:41Z joseph $ {L3 Experimental coffin code layer} % %<*driver> @@ -118,7 +118,7 @@ % \begin{function}[added = 2011-09-10] % {\hcoffin_set:Nw, \hcoffin_set:cw, \hcoffin_set_end:} % \begin{syntax} -% \cs{hcoffin_set:Nw} \meta{coffin} \Arg{material} \cs{hcoffin_set_end:} +% \cs{hcoffin_set:Nw} \meta{coffin} \meta{material} \cs{hcoffin_set_end:} % \end{syntax} % Typesets the \meta{material} in horizontal mode, storing the result % in the \meta{coffin}. The standard poles for the \meta{coffin} are @@ -141,7 +141,7 @@ % \begin{function}[added = 2011-09-10] % {\vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_set_end:} % \begin{syntax} -% \cs{vcoffin_set:Nnw} \meta{coffin} \Arg{width} \Arg{material} \cs{vcoffin_set_end:} +% \cs{vcoffin_set:Nnw} \meta{coffin} \Arg{width} \meta{material} \cs{vcoffin_set_end:} % \end{syntax} % Typesets the \meta{material} in vertical mode constrained to the % given \meta{width} and stores the result in the \meta{coffin}. The @@ -280,6 +280,32 @@ % therefore analogous to carrying out an alignment where the % \enquote{parent} coffin is the current insertion point. % \end{function} +% +% \section{Measuring coffins} +% +% \begin{function}{\coffin_dp:N, \coffin_dp:c} +% \begin{syntax} +% \cs{coffin_dp:N} \meta{coffin} +% \end{syntax} +% Calculates the depth (below the baseline) of the \meta{coffin} +% in a form suitable for use in a \meta{dimension expression}. +% \end{function} +% +% \begin{function}{\coffin_ht:N, \coffin_ht:c} +% \begin{syntax} +% \cs{coffin_ht:N} \meta{coffin} +% \end{syntax} +% Calculates the height (above the baseline) of the \meta{coffin} +% in a form suitable for use in a \meta{dimension expression}. +% \end{function} +% +% \begin{function}{\coffin_wd:N, \coffin_wd:c} +% \begin{syntax} +% \cs{coffin_wd:N} \meta{coffin} +% \end{syntax} +% Calculates the width of the \meta{coffin} in a form +% suitable for use in a \meta{dimension expression}. +% \end{function} % % \section{Coffin diagnostics} % @@ -745,6 +771,25 @@ % \end{variable} % \end{variable} % \end{variable} +% +% \subsection{Measuring coffins} +% +% \begin{macro} +% { +% \coffin_dp:N, \coffin_dp:c, \coffin_ht:N, \coffin_ht:c, +% \coffin_wd:N, \coffin_wd:c +% } +% Coffins are just boxes when it comes to measurement. However, semantically +% a separate set of functions are required. +% \begin{macrocode} +\cs_new_eq:NN \coffin_dp:N \box_dp:N +\cs_new_eq:NN \coffin_dp:c \box_dp:c +\cs_new_eq:NN \coffin_ht:N \box_ht:N +\cs_new_eq:NN \coffin_ht:c \box_ht:c +\cs_new_eq:NN \coffin_wd:N \box_wd:N +\cs_new_eq:NN \coffin_wd:c \box_wd:c +% \end{macrocode} +% \end{macro} % % \subsection{Coffins: handle and pole management} % @@ -820,7 +865,7 @@ \cs_set_eq:NN \Width \l_coffin_Width_dim \dim_set:Nn \Height { \box_ht:N #1 } \dim_set:Nn \Depth { \box_dp:N #1 } - \dim_set:Nn \TotalHeight { \box_ht:N #1 - \box_dp:N #1 } + \dim_set:Nn \TotalHeight { \box_ht:N #1 + \box_dp:N #1 } \dim_set:Nn \Width { \box_wd:N #1 } } \cs_new_protected_nopar:Npn \coffin_end_user_dimensions: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 47b21713513..5159746f515 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3drivers.dtx 2862 2011-09-27 21:14:27Z joseph $ +\GetIdInfo$Id: l3drivers.dtx 2959 2011-11-14 21:47:18Z joseph $ {L3 Experimental drivers} % %<*driver> @@ -86,6 +86,18 @@ % 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 clipping} +% +% \begin{function}[added = 2011-11-11]{\driver_box_use_clip:N} +% \begin{syntax} +% \cs{driver_box_use_clip:N} \meta{box} +% \end{syntax} +% Inserts the content of the \meta{box} at the current insertion point +% such that any material outside of the bounding box will not be displayed +% by the driver. The material in the \meta{box} is still places in the +% output stream: the clipping takes place at a driver level. +% \end{function} % % \section{Box rotation and scaling} % @@ -193,78 +205,201 @@ % % % \end{macrocode} +% +% \subsection{Driver utility functions} +% +% \begin{macro}{\driver_graphic_state_save:} +% \begin{macro}{\driver_graphic_state_restore:} +% All of the drivers have a stack for saving the graphic state. These +% have slightly different interfaces. As \texttt{dvips} does not +% automatically save the current location, this is set up here. +% \begin{macrocode} +\cs_new_protected:Npn \driver_graphic_state_save: +%<*dvips> + { \tex_special:D { ps:gsave } } +% +%<*pdfmode> + { \pdftex_pdfsave:D } +% +%<*xdvipdfmx> + { \tex_special:D { pdf:bcontent } } +% +\cs_new_protected:Npn \driver_graphic_state_restore: +%<*dvips> + { \tex_special:D { ps:grestore } } +% +%<*pdfmode> + { \pdftex_pdfrestore:D } +% +%<*xdvipdfmx> + { \tex_special:D { pdf:econtent } } +% +% \end{macrocode} +% \end{macro} +% \end{macro} % -% \subsection{Box rotation and scaling} -% -% \begin{variable}{\l_driver_box_matrix_tl} -% A token list for the affine transformation matrix. +% \begin{macro}{\driver_pdf_literal:n, \driver_pdf_literal_direct:n} +% Both direct PDF mode and \texttt{xdvipdfmx} make use of direct PDF +% special insertion. These are slightly different in the two cases. +% The |direct| versions do not save the current matrix. % \begin{macrocode} +%<*pdfmode|xdvipdfmx> +\cs_new_protected:Npn \driver_pdf_literal:n #1 +%<*pdfmode> + { \pdftex_pdfliteral:D {#1} } +% +%<*xdvipdfmx> + { \tex_special:D { pdf:content~ #1 } } +% +\cs_new_protected:Npn \driver_pdf_literal_direct:n #1 %<*pdfmode> -\tl_new:N \l_driver_box_matrix_tl + { \pdftex_pdfliteral:D direct~{#1} } % +%<*xdvipdfmx> + { \tex_special:D { pdf:literal~direct~ #1 } } +% +% % \end{macrocode} -% \end{variable} +% \end{macro} +% +% \begin{macro}{\driver_ps_literal:n} +% The same concept for PostScript: these are \enquote{direct} by default, +% but by keeping the same name life should be a little clearer. +% \begin{macrocode} +%<*dvips> +\cs_new_protected:Npn \driver_ps_literal:n #1 + { \tex_special:D { ps: #1 } } +% +% \end{macrocode} +% \end{macro} +% +% \subsection{Box clipping} +% +% \begin{macro}{\driver_box_use_clip:N} +% The overall logic to clipping a box is the same in all cases. The general +% method is to save the current location, define a clipping path equivalent +% to the bounding box, then insert the content at the current position +% and in a zero width box. The \enquote{real} width is then made up using +% a horizontal skip before tidying up. There are other approaches that +% can be taken (for example using XForm objects), but the logic here shares +% as much code as possible and uses the same conversions (and so same +% rounding errors) in all three cases. +% \begin{macrocode} +\cs_new_protected:Npn \driver_box_use_clip:N #1 + { + \driver_graphic_state_save: +% \end{macrocode} +% The business end of the code sets up the clip box, using the higher-level +% rectangle operators rather than the lower level direct line drawing. This +% makes sense for a simple rectangular clip. There are a couple of approaches +% for \texttt{dvips}. The approach here is to save the current matrix, +% then translate to the current \TeX{} position and switch to big point +% measurement. The clip box can then be set up using the same conversion +% as for direct PDF output: notice that here the $y$-axis is upside down. +% The original matrix is then restored, so that \TeX{} inserts material +% in the correct place (there is an offset between the PostScript and +% \TeX{} current positions). +% \begin{macrocode} +%<*dvips> + \driver_ps_literal:n + { + /savedmatrix~matrix~currentmatrix~def~ + currentpoint~translate~ + Resolution~72~div~VResolution~72~div~scale + } + \driver_ps_literal:n + { + 0~ + -\dim_strip_bp:n { \box_dp:N #1 } ~neg~ + \dim_strip_bp:n { \box_wd:N #1 } ~ + \dim_strip_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~neg~ + rectclip + } + \driver_ps_literal:n { savedmatrix~setmatrix } +% +% \end{macrocode} +% The PDF box is easier to define as it is automatically in big points and +% as the driver deals with the relationship between the \TeX{} and graphics +% locations automatically. +% \begin{macrocode} +%<*pdfmode|xdvipdfmx> + \driver_pdf_literal_direct:n + { + 0 ~ + -\dim_strip_bp:n { \box_dp:N #1 } ~ + \dim_strip_bp:n { \box_wd:N #1 } ~ + \dim_strip_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~ + re~W~n + } +% +% \end{macrocode} +% Insert the material in a box of no width, restore the graphic state +% and then insert the necessary width. +% \begin{macrocode} + \hbox_overlap_right:n { \box_use:N #1 } + \driver_graphic_state_restore: + \skip_horizontal:n { \box_wd:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Box rotation and scaling} % % \begin{variable}{\l_driver_tmp_fp} % Needed for a safe sign inversion in PDF mode. % \begin{macrocode} -%<*pdfmode> +%<*pdfmode|xdvipdfmx> \fp_new:N \l_driver_tmp_fp -% +% % \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. +% The driver for \texttt{dvips} works with a simple rotation angle. +% In PDF mode, an affine matrix is used instead. The transformation for +% \texttt{xdvipdfmx} can be done either way: to have some code sharing, +% the choice here is to use an affine approach (at least some code is +% shared in this way). For the \texttt{dvips}, that odd-looking +% |currentpoint| at the beginning is used to put this data onto the +% stack for |neg exch neg exch translate| to pick up. % \begin{macrocode} -\cs_new_protected_nopar:Npn \driver_box_rotate_begin: +\cs_new_protected:Npn \driver_box_rotate_begin: { + \driver_graphic_state_save: %<*dvips> - \tex_special:D + \driver_ps_literal:n { - ps:~gsave~currentpoint~ - currentpoint~translate~ \fp_use:N \l_box_angle_fp \c_space_tl - neg~rotate~neg~exch~neg~exch~translate + currentpoint~ + currentpoint~translate~ + \fp_use:N \l_box_angle_fp \c_space_tl neg~rotate~ + neg~exch~neg~exch~translate } % -%<*pdfmode> +%<*pdfmode|xdvipdfmx> + \box_set_wd:Nn \l_box_tmp_box \c_zero_dim \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 +%<*pdfmode> + \pdftex_pdfsetmatrix:D +% +%<*xdvipdfmx> + \driver_pdf_literal_direct:n +% { \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 -% %<*xdvipdfmx> - \tex_special:D { x:gsave } - \tex_special:D { x:rotate~ \fp_use:N \l_box_angle_fp } + \c_space_tl 0~0~cm % + } +% } % \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 } } -% -%<*pdfmode> - { \pdftex_pdfrestore:D } -% -%<*xdvipdfmx> - { \tex_special:D { x:grestore } } -% +\cs_new_eq:NN \driver_box_rotate_end: \driver_graphic_state_restore: % \end{macrocode} % \end{macro} % @@ -272,61 +407,37 @@ % Scaling is not dissimilar to rotation, but the calculations are somewhat % less complex. % \begin{macrocode} -\cs_new_protected_nopar:Npn \driver_box_scale_begin: +\cs_new_protected:Npn \driver_box_scale_begin: { + \driver_graphic_state_save: %<*dvips> - \tex_special:D + \driver_ps_literal:n { - ps:~currentpoint~ + 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 + \fp_use:N \l_box_scale_y_fp \c_space_tl scale~ + neg~exch~neg~exch~translate } % +%<*pdfmode|xdvipdfmx> %<*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 } + \pdftex_pdfsetmatrix:D % %<*xdvipdfmx> - \tex_special:D { x:gsave } - \tex_special:D + \driver_pdf_literal_direct:n +% { - x:scale ~ \fp_use:N \l_box_scale_x_fp \c_space_tl + 0~0~ \fp_use:N \l_box_scale_y_fp - } -% - } -% \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 - } - } -% -%<*pdfmode> - { \pdftex_pdfrestore:D } -% %<*xdvipdfmx> - { \tex_special:D { x:grestore } } + \c_space_tl 0~0~cm % + } +% + } +\cs_new_eq:NN \driver_box_scale_end: \driver_graphic_state_restore: % \end{macrocode} % \end{macro} % @@ -354,24 +465,18 @@ % stack therefore needs a number. % \begin{macrocode} %<*pdfmode> -\int_new:N \l_driver_color_stack_int +\int_new:N \l_driver_color_stack_int % % \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: +\cs_new_protected:Npn \driver_color_ensure_current: { %<*dvips|xdvipdfmx> \tex_special:D { color~push~\l_driver_current_color_tl } @@ -382,12 +487,12 @@ % \group_insert_after:N \driver_color_reset: } -\cs_new_protected_nopar:Npn \driver_color_reset: +\cs_new_protected:Npn \driver_color_reset: %<*dvips|xdvipdfmx> { \tex_special:D { color~pop } } % %<*pdfmode> - { \pdftex_pdfcolorstack:D \l_driver_color_stack_int pop \scan_stop: } + { \pdftex_pdfcolorstack:D \l_driver_color_stack_int pop } % % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 8e1eb820959..2ecf43cd1b6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3int.dtx 2928 2011-10-22 12:32:44Z bruno $ {L3 Experimental integers} % %<*driver> @@ -169,7 +169,7 @@ % initially be equal to $0$. % \end{function} % -% \begin{function}{\int_const:Nn, \int_const:cn} +% \begin{function}[updated = 2011-10-22]{\int_const:Nn, \int_const:cn} % \begin{syntax} % \cs{int_const:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} @@ -215,7 +215,7 @@ % % \section{Setting and incrementing integers} % -% \begin{function}{\int_add:Nn, \int_add:cn} +% \begin{function}[updated = 2011-10-22]{\int_add:Nn, \int_add:cn} % \begin{syntax} % \cs{int_add:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} @@ -263,7 +263,7 @@ % (\emph{i.e.}~not limited by the current group level). % \end{function} % -% \begin{function}{\int_set:Nn, \int_set:cn} +% \begin{function}[updated = 2011-10-22]{\int_set:Nn, \int_set:cn} % \begin{syntax} % \cs{int_set:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} @@ -283,7 +283,7 @@ % to the current \TeX{} group level. % \end{function} % -% \begin{function}{\int_sub:Nn, \int_sub:cn} +% \begin{function}[updated = 2011-10-22]{\int_sub:Nn, \int_sub:cn} % \begin{syntax} % \cs{int_sub:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} @@ -301,7 +301,7 @@ % % \section{Using integers} % -% \begin{function}[EXP]{\int_use:N, \int_use:c} +% \begin{function}[updated = 2011-10-22, EXP]{\int_use:N, \int_use:c} % \begin{syntax} % \cs{int_use:N} \meta{integer} % \end{syntax} @@ -481,7 +481,7 @@ % Integers can be placed into the output stream with formatting. These % conversions apply to any integer expressions. % -% \begin{function}[EXP]{\int_to_arabic:n} +% \begin{function}[updated = 2011-10-22, EXP]{\int_to_arabic:n} % \begin{syntax} % \cs{int_to_arabic:n} \Arg{integer expression} % \end{syntax} @@ -584,7 +584,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[rEXP]{\int_to_roman:n, \int_to_Roman:n} +% \begin{function}[updated = 2011-10-22, rEXP]{\int_to_roman:n, \int_to_Roman:n} % \begin{syntax} % \cs{int_to_roman:n} \Arg{integer expression} % \end{syntax} @@ -1031,7 +1031,7 @@ % As stated, most constants can be defined as \tn{chardef} or % \tn{mathchardef} but that's engine dependent. % \begin{macrocode} -\cs_new_protected_nopar:Npn \int_const:Nn #1#2 +\cs_new_protected:Npn \int_const:Nn #1#2 { \int_compare:nNnTF {#2} > \c_minus_one { @@ -1099,9 +1099,9 @@ % \UnitTested % Adding and subtracting to and from a counter \ldots % \begin{macrocode} -\cs_new_protected_nopar:Npn \int_add:Nn #1#2 +\cs_new_protected:Npn \int_add:Nn #1#2 { \tex_advance:D #1 by \int_eval:w #2 \int_eval_end: } -\cs_new_nopar:Npn \int_sub:Nn #1#2 +\cs_new_protected:Npn \int_sub:Nn #1#2 { \tex_advance:D #1 by - \int_eval:w #2 \int_eval_end: } \cs_new_protected_nopar:Npn \int_gadd:Nn { \tex_global:D \int_add:Nn } @@ -1154,7 +1154,7 @@ % if they are not defined. Thus there is no need for the checking % code seen with token list variables. % \begin{macrocode} -\cs_new_protected_nopar:Npn \int_set:Nn #1#2 +\cs_new_protected:Npn \int_set:Nn #1#2 { #1 ~ \int_eval:w #2\int_eval_end: } \cs_new_protected_nopar:Npn \int_gset:Nn { \tex_global:D \int_set:Nn } \cs_generate_variant:Nn \int_set:Nn { c } @@ -1170,7 +1170,7 @@ % Here is how counters are accessed: % \begin{macrocode} \cs_new_eq:NN \int_use:N \tex_the:D -\cs_new_nopar:Npn \int_use:c #1 { \int_use:N \cs:w #1 \cs_end: } +\cs_new:Npn \int_use:c #1 { \int_use:N \cs:w #1 \cs_end: } % \end{macrocode} % \end{macro} % @@ -1458,7 +1458,7 @@ % \UnitTested % Nothing exciting here. % \begin{macrocode} -\cs_new_nopar:Npn \int_to_arabic:n #1 { \int_eval:n {#1} } +\cs_new:Npn \int_to_arabic:n #1 { \int_eval:n {#1} } % \end{macrocode} % \end{macro} % @@ -1700,7 +1700,7 @@ % everything expandable. The loop will be terminated by the conversion % of the |Q|. % \begin{macrocode} -\cs_new_nopar:Npn \int_to_roman:n #1 +\cs_new:Npn \int_to_roman:n #1 { \exp_after:wN \int_to_roman_aux:N \int_to_roman:w \int_eval:n {#1} Q @@ -1710,7 +1710,7 @@ \use:c { int_to_roman_ #1 :w } \int_to_roman_aux:N } -\cs_new_nopar:Npn \int_to_Roman:n #1 +\cs_new:Npn \int_to_Roman:n #1 { \exp_after:wN \int_to_Roman_aux:N \int_to_roman:w \int_eval:n {#1} Q diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 17dc2376d4b..e38406714c5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -35,7 +35,7 @@ % %<*package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3names.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3names.dtx 2944 2011-11-11 07:10:26Z joseph $ {L3 Experimental namespace for primitives} % %<*driver> @@ -567,16 +567,19 @@ \name_primitive:NN \pdfdecimaldigits \pdftex_pdfdecimaldigits:D \name_primitive:NN \pdfhorigin \pdftex_pdfhorigin:D \name_primitive:NN \pdfinfo \pdftex_pdfinfo:D + \name_primitive:NN \pdflastxform \pdftex_pdflastxform:D \name_primitive:NN \pdfliteral \pdftex_pdfliteral:D \name_primitive:NN \pdfminorversion \pdftex_pdfminorversion:D \name_primitive:NN \pdfobjcompresslevel \pdftex_pdfobjcompresslevel:D \name_primitive:NN \pdfoutput \pdftex_pdfoutput:D + \name_primitive:NN \pdfrefxform \pdftex_pdfrefxform:D \name_primitive:NN \pdfrestore \pdftex_pdfrestore:D \name_primitive:NN \pdfsave \pdftex_pdfsave:D \name_primitive:NN \pdfsetmatrix \pdftex_pdfsetmatrix:D \name_primitive:NN \pdfpkresolution \pdftex_pdfpkresolution:D \name_primitive:NN \pdftexrevision \pdftex_pdftextrevision:D \name_primitive:NN \pdfvorigin \pdftex_pdfvorigin:D + \name_primitive:NN \pdfxform \pdftex_pdfxform:D % \end{macrocode} % While these are not. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 9881cc3ef64..51cbb0a2671 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 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2915 2011-10-15 21:21:08Z bruno $ {L3 Experimental control structures} % %<*driver> @@ -743,6 +743,24 @@ % \emph{etc.}) % \end{function} % +% \begin{function}[EXP]{\if_predicate:w} +% \begin{syntax} +% "\if_predicate:w" "\else:" "\fi:" +% \end{syntax} +% This function takes a predicate function and +% branches according to the result. (In practice this function would also +% accept a single boolean variable in place of the but to make the +% coding clearer this should be done through "\if_bool:N".) +% \end{function} +% +% \begin{function}[EXP]{\if_bool:N} +% \begin{syntax} +% "\if_bool:N" "\else:" "\fi:" +% \end{syntax} +% This function takes a boolean variable and +% branches according to the result. +% \end{function} +% % \section{Experimental programmings functions} % % \begin{function}{\prg_quicksort:n} @@ -804,6 +822,19 @@ % % \end{macrocode} % +% \subsection{Primitive conditionals} +% +% \begin{macro}{\if_bool:N} +% \begin{macro}{\if_predicate:w} +% Those two primitive \TeX{} conditionals are synonyms. +% They should not be used outside the kernel code. +% \begin{macrocode} +\tex_let:D \if_bool:N \tex_ifodd:D +\tex_let:D \if_predicate:w \tex_ifodd:D +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Defining a set of conditional functions} % % \begin{macro} @@ -914,7 +945,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF } { - \if_bool:N #1 + \if_meaning:w \c_true_bool #1 \prg_return_true: \else: \prg_return_false: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 3ca229a89ca..dec6cbac2d1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3skip.dtx 2959 2011-11-14 21:47:18Z joseph $ {L3 Experimental dimensions and skips} % %<*driver> @@ -106,7 +106,7 @@ % % \section{Setting \texttt{dim} variables} % -% \begin{function}{\dim_add:Nn, \dim_add:cn} +% \begin{function}[updated = 2011-10-22]{\dim_add:Nn, \dim_add:cn} % \begin{syntax} % \cs{dim_add:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -122,7 +122,7 @@ % current content of the \meta{dimension}. This assignment is global. % \end{function} % -% \begin{function}{\dim_set:Nn, \dim_set:cn} +% \begin{function}[updated = 2011-10-22]{\dim_set:Nn, \dim_set:cn} % \begin{syntax} % \cs{dim_set:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -161,7 +161,7 @@ % \TeX{} group level. % \end{function} % -% \begin{function}{\dim_set_max:Nn, \dim_set_max:cn} +% \begin{function}[updated = 2011-10-22]{\dim_set_max:Nn, \dim_set_max:cn} % \begin{syntax} % \cs{dim_set_max:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -171,7 +171,7 @@ % \TeX{} group. % \end{function} % -% \begin{function}{\dim_gset_max:Nn, \dim_gset_max:cn} +% \begin{function}[updated = 2011-10-22]{\dim_gset_max:Nn, \dim_gset_max:cn} % \begin{syntax} % \cs{dim_gset_max:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -180,7 +180,7 @@ % larger of these two value. This assignment is global. % \end{function} % -% \begin{function}{\dim_set_min:Nn, \dim_set_min:cn} +% \begin{function}[updated = 2011-10-22]{\dim_set_min:Nn, \dim_set_min:cn} % \begin{syntax} % \cs{dim_set_min:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -190,7 +190,7 @@ % \TeX{} group. % \end{function} % -% \begin{function}{\dim_gset_min:Nn, \dim_gset_min:cn} +% \begin{function}[updated = 2011-10-22]{\dim_gset_min:Nn, \dim_gset_min:cn} % \begin{syntax} % \cs{dim_gset_min:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -199,7 +199,7 @@ % smaller of these two value. This assignment is global. % \end{function} % -% \begin{function}{\dim_sub:Nn, \dim_sub:cn} +% \begin{function}[updated = 2011-10-22]{\dim_sub:Nn, \dim_sub:cn} % \begin{syntax} % \cs{dim_sub:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} @@ -216,8 +216,16 @@ % \end{function} % % \section{Utilities for dimension calculations} +% +% \begin{function}[updated = 2011-10-22, EXP]{\dim_abs:n} +% \begin{syntax} +% \cs{dim_abs:n} \Arg{dimexpr} +% \end{syntax} +% Converts the \meta{dimexpr} to its absolute value, leaving the result +% in the input stream as an \meta{dimension denotation}. +% \end{function} % -% \begin{function}[EXP]{\dim_ratio:nn} +% \begin{function}[updated = 2011-10-22, EXP]{\dim_ratio:nn} % \begin{syntax} % \cs{dim_ratio:nn} \Arg{dimexpr1} \Arg{dimexpr2} % \end{syntax} @@ -381,7 +389,7 @@ % % \section{Using \texttt{dim} expressions and variables} % -% \begin{function}[EXP]{\dim_eval:n} +% \begin{function}[updated = 2011-10-22, EXP]{\dim_eval:n} % \begin{syntax} % \cs{dim_eval:n} \Arg{dimension expression} % \end{syntax} @@ -476,7 +484,7 @@ % % \section{Setting \texttt{skip} variables} % -% \begin{function}{\skip_add:Nn, \skip_add:cn} +% \begin{function}[updated = 2011-10-22]{\skip_add:Nn, \skip_add:cn} % \begin{syntax} % \cs{skip_add:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} @@ -492,7 +500,7 @@ % current content of the \meta{skip}. This assignment is global. % \end{function} % -% \begin{function}{\skip_set:Nn, \skip_set:cn} +% \begin{function}[updated = 2011-10-22]{\skip_set:Nn, \skip_set:cn} % \begin{syntax} % \cs{skip_set:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} @@ -532,7 +540,7 @@ % \TeX{} group level. % \end{function} % -% \begin{function}{\skip_sub:Nn, \skip_sub:cn} +% \begin{function}[updated = 2011-10-22]{\skip_sub:Nn, \skip_sub:cn} % \begin{syntax} % \cs{skip_sub:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} @@ -576,7 +584,7 @@ % % \section{Using \texttt{skip} expressions and variables} % -% \begin{function}[EXP]{\skip_eval:n} +% \begin{function}[updated = 2011-10-22, EXP]{\skip_eval:n} % \begin{syntax} % \cs{skip_eval:n} \Arg{skip expression} % \end{syntax} @@ -670,7 +678,7 @@ % % \section{Setting \texttt{muskip} variables} % -% \begin{function}{\muskip_add:Nn, \muskip_add:cn} +% \begin{function}[updated = 2011-10-22]{\muskip_add:Nn, \muskip_add:cn} % \begin{syntax} % \cs{muskip_add:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} @@ -686,7 +694,7 @@ % current content of the \meta{muskip}. This assignment is global. % \end{function} % -% \begin{function}{\muskip_set:Nn, \muskip_set:cn} +% \begin{function}[updated = 2011-10-22]{\muskip_set:Nn, \muskip_set:cn} % \begin{syntax} % \cs{muskip_set:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} @@ -732,7 +740,7 @@ % \TeX{} group level. % \end{function} % -% \begin{function}{\muskip_sub:Nn, \muskip_sub:cn} +% \begin{function}[updated = 2011-10-22]{\muskip_sub:Nn, \muskip_sub:cn} % \begin{syntax} % \cs{muskip_sub:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} @@ -750,7 +758,7 @@ % % \section{Using \texttt{muskip} expressions and variables} % -% \begin{function}[EXP]{\muskip_eval:n} +% \begin{function}[updated = 2011-10-22, EXP]{\muskip_eval:n} % \begin{syntax} % \cs{muskip_eval:n} \Arg{muskip expression} % \end{syntax} @@ -781,7 +789,8 @@ % % \section{Inserting skips into the output} % -% \begin{function}{\skip_horizontal:N, \skip_horizontal:c, \skip_horizontal:n} +% \begin{function}[updated = 2011-10-22] +% {\skip_horizontal:N, \skip_horizontal:c, \skip_horizontal:n} % \begin{syntax} % \cs{skip_horizontal:N} \meta{skip} % \cs{skip_horizontal:n} \Arg{skipexpr} @@ -792,7 +801,8 @@ % \end{texnote} % \end{function} % -% \begin{function}{\skip_vertical:N, \skip_vertical:c, \skip_vertical:n} +% \begin{function}[updated = 2011-10-22] +% {\skip_vertical:N, \skip_vertical:c, \skip_vertical:n} % \begin{syntax} % \cs{skip_vertical:N} \meta{skip} % \cs{skip_vertical:n} \Arg{skipexpr} @@ -846,7 +856,7 @@ % % \section{Experimental skip functions} % -% \begin{function}{\skip_split_finite_else_action:nnNN} +% \begin{function}[updated = 2011-10-22]{\skip_split_finite_else_action:nnNN} % \begin{syntax} % \cs{skip_split_finite_else_action:nnNN} \Arg{skipexpr} \Arg{action} % ~~\meta{dimen1} \meta{dimen2} @@ -859,6 +869,31 @@ % and place |#2| into the input stream: this is usually an error or % warning message of some sort. % \end{function} +% +% \section{Internal functions} +% +% \begin{function}[added = 2011-11-11, EXP] +% {\dim_strip_bp:n, \dim_strip_pt:n} +% \begin{syntax} +% \cs{dim_strip_bp:n} \Arg{dimension expression} +% \cs{dim_strip_pt:n} \Arg{dimension expression} +% \end{syntax} +% Evaluates the \meta{dimension expression}, expanding any +% dimensions and token list variables within the \meta{expression} +% to their content (without requiring \cs{dim_use:N}/\cs{tl_use:N}) +% and applying the standard mathematical rules. The magnitude of the +% result, expressed in big points (\texttt{bp}) or points (\texttt{pt}), +% will be left in the input stream with \emph{no units}. If the decimal +% part of the magnitude is zero, this will be omitted. +% +% If the \Arg{dimension expression} contains additional units, these will +% be ignored, so for example +% \begin{verbatim} +% \dim_strip_pt:n { 1 bp pt } +% \end{verbatim} +% will leave |1.00374| in the input stream (\emph{i.e.}~the magnitude of +% one \enquote{big point} when converted to points). +% \end{function} % % \end{documentation} % @@ -899,7 +934,7 @@ % Allocating \meta{dim} registers \ldots % \begin{macrocode} %<*package> -\cs_new_protected_nopar:Npn \dim_new:N #1 +\cs_new_protected:Npn \dim_new:N #1 { \chk_if_free_cs:N #1 \newdimen #1 @@ -913,8 +948,8 @@ % \begin{macro}{\dim_gzero:N, \dim_gzero:c} % Reset the register to zero. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_zero:N #1 { #1 \c_zero_dim } -\cs_new_protected_nopar:Npn \dim_gzero:N { \tex_global:D \dim_zero:N } +\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_dim } +\cs_new_protected:Npn \dim_gzero:N { \tex_global:D \dim_zero:N } \cs_generate_variant:Nn \dim_zero:N { c } \cs_generate_variant:Nn \dim_gzero:N { c } % \end{macrocode} @@ -927,9 +962,9 @@ % \begin{macro}{\dim_gset:Nn, \dim_gset:cn} % Setting dimensions is easy enough. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_set:Nn #1#2 +\cs_new_protected:Npn \dim_set:Nn #1#2 { #1 ~ \dim_eval:w #2 \dim_eval_end: } -\cs_new_protected_nopar:Npn \dim_gset:Nn { \tex_global:D \dim_set:Nn } +\cs_new_protected:Npn \dim_gset:Nn { \tex_global:D \dim_set:Nn } \cs_generate_variant:Nn \dim_set:Nn { c } \cs_generate_variant:Nn \dim_gset:Nn { c } % \end{macrocode} @@ -941,10 +976,10 @@ % {\dim_gset_eq:NN,\dim_gset_eq:cN, \dim_gset_eq:Nc,\dim_gset_eq:cc} % All straightforward. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_set_eq:NN #1#2 { #1 = #2 } +\cs_new_protected:Npn \dim_set_eq:NN #1#2 { #1 = #2 } \cs_generate_variant:Nn \dim_set_eq:NN { c } \cs_generate_variant:Nn \dim_set_eq:NN { Nc , cc } -\cs_new_protected_nopar:Npn \dim_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } +\cs_new_protected:Npn \dim_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \dim_gset_eq:NN { c } \cs_generate_variant:Nn \dim_gset_eq:NN { Nc , cc } % \end{macrocode} @@ -958,14 +993,14 @@ % Setting maximum and minimum values is simply a case of so build-in % comparison. This only applies to dimensions as skips are not ordered. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_set_max:Nn #1#2 +\cs_new_protected:Npn \dim_set_max:Nn #1#2 { \dim_compare:nNnT {#1} < {#2} { \dim_set:Nn #1 {#2} } } -\cs_new_protected_nopar:Npn \dim_gset_max:Nn #1#2 - { \dim_compare:nNnT {#1} < {#2} { \dim_gset:Nn #1 {#2} } } -\cs_new_protected_nopar:Npn \dim_set_min:Nn #1#2 +\cs_new_protected:Npn \dim_gset_max:Nn + { \tex_global:D \dim_set_max:Nn } +\cs_new_protected:Npn \dim_set_min:Nn #1#2 { \dim_compare:nNnT {#1} > {#2} { \dim_set:Nn #1 {#2} } } -\cs_new_protected_nopar:Npn \dim_gset_min:Nn #1#2 - { \dim_compare:nNnT {#1} > {#2} { \dim_gset:Nn #1 {#2} } } +\cs_new_protected:Npn \dim_gset_min:Nn + { \tex_global:D \dim_set_min:Nn } \cs_generate_variant:Nn \dim_set_max:Nn { c } \cs_generate_variant:Nn \dim_gset_max:Nn { c } \cs_generate_variant:Nn \dim_set_min:Nn { c } @@ -982,14 +1017,14 @@ % \begin{macro}{\dim_gsub:Nn, \dim_gsub:cn} % Using |by| here deals with the (incorrect) case |\dimen123|. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_add:Nn #1#2 +\cs_new_protected:Npn \dim_add:Nn #1#2 { \tex_advance:D #1 by \dim_eval:w #2 \dim_eval_end: } -\cs_new_protected_nopar:Npn \dim_gadd:Nn { \tex_global:D \dim_add:Nn } +\cs_new_protected:Npn \dim_gadd:Nn { \tex_global:D \dim_add:Nn } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } -\cs_new_protected_nopar:Npn \dim_sub:Nn #1#2 +\cs_new_protected:Npn \dim_sub:Nn #1#2 { \tex_advance:D #1 by - \dim_eval:w #2 \dim_eval_end: } -\cs_new_protected_nopar:Npn \dim_gsub:Nn { \tex_global:D \dim_sub:Nn } +\cs_new_protected:Npn \dim_gsub:Nn { \tex_global:D \dim_sub:Nn } \cs_generate_variant:Nn \dim_sub:Nn { c } \cs_generate_variant:Nn \dim_gsub:Nn { c } % \end{macrocode} @@ -999,6 +1034,24 @@ % \end{macro} % % \subsection{Utilities for dimension calculations} +% +% \begin{macro}{\dim_abs:n} +% Similar to the \cs{int_abs:n} function, but here an additional +% \meta{dimexpr} is needed as \TeX{} won't simply tidy up an additional +% |-| for us. +% \begin{macrocode} +\cs_new:Npn \dim_abs:n #1 + { + \dim_use:N + \dim_eval:w + \if_dim:w \dim_eval:w #1 < \c_zero_dim + - + \fi: + \dim_eval:w #1 \dim_eval_end: + \dim_eval_end: + } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\dim_ratio:nn} % \begin{macro}[aux]{\dim_ratio_aux:n} @@ -1007,9 +1060,9 @@ % expression. Using \cs{int_value:w} forces everything into |sp|, avoiding % any decimal parts. % \begin{macrocode} -\cs_new_nopar:Npn \dim_ratio:nn #1#2 +\cs_new:Npn \dim_ratio:nn #1#2 { \dim_ratio_aux:n {#1} / \dim_ratio_aux:n {#2} } -\cs_new_nopar:Npn \dim_ratio_aux:n #1 +\cs_new:Npn \dim_ratio_aux:n #1 { \int_value:w \dim_eval:w #1 \dim_eval_end: } % \end{macrocode} % \end{macro} @@ -1140,8 +1193,6 @@ % \end{macro} % \end{macro} % -% -% % \subsection{Dimension expression loops} % % \begin{macro}{\dim_while_do:nn} @@ -1231,10 +1282,44 @@ % \begin{macro}{\dim_eval:n} % Evaluating a dimension expression expandably. % \begin{macrocode} -\cs_new_nopar:Npn \dim_eval:n #1 +\cs_new:Npn \dim_eval:n #1 { \dim_use:N \dim_eval:w #1 \dim_eval_end: } % \end{macrocode} % \end{macro} +% +% \begin{macro}[EXP]{\dim_strip_bp:n} +% \begin{macrocode} +\cs_new:Npn \dim_strip_bp:n #1 + { \dim_strip_pt:n { 0.996 26 \dim_eval:w #1 \dim_eval_end: } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\dim_strip_pt:n} +% \begin{macro}[EXP, aux]{\dim_strip_pt:w} +% A function which comes up often enough to deserve a place in the kernel. +% The idea here is that the input is assumed to be in \texttt{pt}, but can +% be given in other units, while the output is the value of the dimension +% in \texttt{pt} but with no units given. This is used a lot by low-level +% manipulations. +% \begin{macrocode} +\cs_new:Npn \dim_strip_pt:n #1 + { + \exp_after:wN + \dim_strip_pt:w \dim_use:N \dim_eval:w #1 \dim_eval_end: \q_stop + } +\use:x + { + \cs_new:Npn \exp_not:N \dim_strip_pt:w + ##1 . ##2 \tl_to_str:n { pt } ##3 \exp_not:N \q_stop + { + ##1 + \exp_not:N \int_compare:nNnT {##2} > \c_zero + { . ##2 } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} % % \begin{macro}{\dim_use:N, \dim_use:c} % Accessing a \meta{dim}. @@ -1295,7 +1380,7 @@ % Allocation of a new internal registers. % \begin{macrocode} %<*package> -\cs_new_protected_nopar:Npn \skip_new:N #1 +\cs_new_protected:Npn \skip_new:N #1 { \chk_if_free_cs:N #1 \newskip #1 @@ -1309,8 +1394,8 @@ % \begin{macro}{\skip_gzero:N, \skip_gzero:c} % Reset the register to zero. % \begin{macrocode} -\cs_new_protected_nopar:Npn \skip_zero:N #1 { #1 \c_zero_skip } -\cs_new_protected_nopar:Npn \skip_gzero:N { \tex_global:D \skip_zero:N } +\cs_new_protected:Npn \skip_zero:N #1 { #1 \c_zero_skip } +\cs_new_protected:Npn \skip_gzero:N { \tex_global:D \skip_zero:N } \cs_generate_variant:Nn \skip_zero:N { c } \cs_generate_variant:Nn \skip_gzero:N { c } % \end{macrocode} @@ -1323,9 +1408,9 @@ % \begin{macro}{\skip_gset:Nn, \skip_gset:cn} % Much the same as for dimensions. % \begin{macrocode} -\cs_new_protected_nopar:Npn \skip_set:Nn #1#2 +\cs_new_protected:Npn \skip_set:Nn #1#2 { #1 ~ \etex_glueexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \skip_gset:Nn { \tex_global:D \skip_set:Nn } +\cs_new_protected:Npn \skip_gset:Nn { \tex_global:D \skip_set:Nn } \cs_generate_variant:Nn \skip_set:Nn { c } \cs_generate_variant:Nn \skip_gset:Nn { c } % \end{macrocode} @@ -1338,10 +1423,10 @@ % {\skip_gset_eq:NN,\skip_gset_eq:cN, \skip_gset_eq:Nc,\skip_gset_eq:cc} % All straightforward. % \begin{macrocode} -\cs_new_protected_nopar:Npn \skip_set_eq:NN #1#2 { #1 = #2 } +\cs_new_protected:Npn \skip_set_eq:NN #1#2 { #1 = #2 } \cs_generate_variant:Nn \skip_set_eq:NN { c } \cs_generate_variant:Nn \skip_set_eq:NN { Nc , cc } -\cs_new_protected_nopar:Npn \skip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } +\cs_new_protected:Npn \skip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \skip_gset_eq:NN { c } \cs_generate_variant:Nn \skip_gset_eq:NN { Nc , cc } % \end{macrocode} @@ -1354,14 +1439,14 @@ % \begin{macro}{\skip_gsub:Nn, \skip_gsub:cn} % Using |by| here deals with the (incorrect) case |\skip123|. % \begin{macrocode} -\cs_new_protected_nopar:Npn \skip_add:Nn #1#2 +\cs_new_protected:Npn \skip_add:Nn #1#2 { \tex_advance:D #1 by \etex_glueexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \skip_gadd:Nn { \tex_global:D \skip_add:Nn } +\cs_new_protected:Npn \skip_gadd:Nn { \tex_global:D \skip_add:Nn } \cs_generate_variant:Nn \skip_add:Nn { c } \cs_generate_variant:Nn \skip_gadd:Nn { c } -\cs_new_protected_nopar:Npn \skip_sub:Nn #1#2 +\cs_new_protected:Npn \skip_sub:Nn #1#2 { \tex_advance:D #1 by - \etex_glueexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \skip_gsub:Nn { \tex_global:D \skip_sub:Nn } +\cs_new_protected:Npn \skip_gsub:Nn { \tex_global:D \skip_sub:Nn } \cs_generate_variant:Nn \skip_sub:Nn { c } \cs_generate_variant:Nn \skip_gsub:Nn { c } % \end{macrocode} @@ -1416,7 +1501,7 @@ % \begin{macro}{\skip_eval:n} % Evaluating a skip expression expandably. % \begin{macrocode} -\cs_new_nopar:Npn \skip_eval:n #1 +\cs_new:Npn \skip_eval:n #1 { \skip_use:N \etex_glueexpr:D #1 \scan_stop: } % \end{macrocode} % \end{macro} @@ -1436,10 +1521,10 @@ % Inserting skips. % \begin{macrocode} \cs_new_eq:NN \skip_horizontal:N \tex_hskip:D -\cs_new_nopar:Npn \skip_horizontal:n #1 +\cs_new:Npn \skip_horizontal:n #1 { \skip_horizontal:N \etex_glueexpr:D #1 \scan_stop: } \cs_new_eq:NN \skip_vertical:N \tex_vskip:D -\cs_new_nopar:Npn \skip_vertical:n #1 +\cs_new:Npn \skip_vertical:n #1 { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: } \cs_generate_variant:Nn \skip_horizontal:N { c } \cs_generate_variant:Nn \skip_vertical:N { c } @@ -1491,7 +1576,7 @@ % And then we add muskips. % \begin{macrocode} %<*package> -\cs_new_protected_nopar:Npn \muskip_new:N #1 +\cs_new_protected:Npn \muskip_new:N #1 { \chk_if_free_cs:N #1 \newmuskip #1 @@ -1505,9 +1590,9 @@ % \begin{macro}{\muskip_gzero:N, \muskip_gzero:c} % Reset the register to zero. % \begin{macrocode} -\cs_new_protected_nopar:Npn \muskip_zero:N #1 +\cs_new_protected:Npn \muskip_zero:N #1 { #1 \c_zero_muskip } -\cs_new_protected_nopar:Npn \muskip_gzero:N { \tex_global:D \muskip_zero:N } +\cs_new_protected:Npn \muskip_gzero:N { \tex_global:D \muskip_zero:N } \cs_generate_variant:Nn \muskip_zero:N { c } \cs_generate_variant:Nn \muskip_gzero:N { c } % \end{macrocode} @@ -1520,9 +1605,9 @@ % \begin{macro}{\muskip_gset:Nn, \muskip_gset:cn} % This should be pretty familiar. % \begin{macrocode} -\cs_new_protected_nopar:Npn \muskip_set:Nn #1#2 +\cs_new_protected:Npn \muskip_set:Nn #1#2 { #1 ~ \etex_muexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \muskip_gset:Nn { \tex_global:D \muskip_set:Nn } +\cs_new_protected:Npn \muskip_gset:Nn { \tex_global:D \muskip_set:Nn } \cs_generate_variant:Nn \muskip_set:Nn { c } \cs_generate_variant:Nn \muskip_gset:Nn { c } % \end{macrocode} @@ -1541,10 +1626,10 @@ % } % All straightforward. % \begin{macrocode} -\cs_new_protected_nopar:Npn \muskip_set_eq:NN #1#2 { #1 = #2 } +\cs_new_protected:Npn \muskip_set_eq:NN #1#2 { #1 = #2 } \cs_generate_variant:Nn \muskip_set_eq:NN { c } \cs_generate_variant:Nn \muskip_set_eq:NN { Nc , cc } -\cs_new_protected_nopar:Npn \muskip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } +\cs_new_protected:Npn \muskip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \muskip_gset_eq:NN { c } \cs_generate_variant:Nn \muskip_gset_eq:NN { Nc , cc } % \end{macrocode} @@ -1557,14 +1642,14 @@ % \begin{macro}{\muskip_gsub:Nn, \muskip_gsub:cn} % Using |by| here deals with the (incorrect) case |\muskip123|. % \begin{macrocode} -\cs_new_protected_nopar:Npn \muskip_add:Nn #1#2 +\cs_new_protected:Npn \muskip_add:Nn #1#2 { \tex_advance:D #1 by \etex_muexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \muskip_gadd:Nn { \tex_global:D \muskip_add:Nn } +\cs_new_protected:Npn \muskip_gadd:Nn { \tex_global:D \muskip_add:Nn } \cs_generate_variant:Nn \muskip_add:Nn { c } \cs_generate_variant:Nn \muskip_gadd:Nn { c } -\cs_new_protected_nopar:Npn \muskip_sub:Nn #1#2 +\cs_new_protected:Npn \muskip_sub:Nn #1#2 { \tex_advance:D #1 by - \etex_muexpr:D #2 \scan_stop: } -\cs_new_protected_nopar:Npn \muskip_gsub:Nn { \tex_global:D \muskip_sub:Nn } +\cs_new_protected:Npn \muskip_gsub:Nn { \tex_global:D \muskip_sub:Nn } \cs_generate_variant:Nn \muskip_sub:Nn { c } \cs_generate_variant:Nn \muskip_gsub:Nn { c } % \end{macrocode} @@ -1578,7 +1663,7 @@ % \begin{macro}{\muskip_eval:n} % Evaluating a muskip expression expandably. % \begin{macrocode} -\cs_new_nopar:Npn \muskip_eval:n #1 +\cs_new:Npn \muskip_eval:n #1 { \muskip_use:N \etex_muexpr:D #1 \scan_stop: } % \end{macrocode} % \end{macro} @@ -1611,7 +1696,7 @@ % |#2| which is probably an error message. % Assignments are global. % \begin{macrocode} -\cs_new_nopar:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 +\cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 { \skip_if_infinite_glue:nTF {#1} { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 4601ed05408..59ca4930274 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 2831 2011-09-16 03:47:54Z bruno $ +\GetIdInfo$Id: l3tl.dtx 2929 2011-10-22 13:00:20Z bruno $ {L3 Experimental token lists} % %<*driver> @@ -68,7 +68,7 @@ % \begin{documentation} % % \TeX{} works with tokens, and \LaTeX3 therefore provides a number of -% functions to deal with token lists. Token lists may be present direct in +% functions to deal with token lists. Token lists may be present directly in % the argument to a function: % \begin{verbatim} % \foo:n { a collection of \tokens } @@ -1379,13 +1379,12 @@ \exp_args:NNNo \group_end: #1 #2 \l_tl_rescan_tl } -\cs_new_nopar:Npx \tl_rescan_aux:w +\use:x { - \cs_set_protected:Npn \exp_not:N \tl_rescan_aux:w ##1 + \cs_new_protected:Npn \exp_not:N \tl_rescan_aux:w ##1 \c_tl_rescan_marker_tl { \tl_set:Nn \exp_not:N \l_tl_rescan_tl {##1} } } -\tl_rescan_aux:w \cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno } \cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno } @@ -2238,15 +2237,14 @@ % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_group:n #1 { p , T , F , TF } { - \if_predicate:w + \if_catcode:w * \exp_after:wN \use_none:n \exp_after:wN { \exp_after:wN { \token_to_str:N #1 ? } - \c_false_bool } - \c_true_bool + * \prg_return_false: \else: \prg_return_true: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 44ff767fa04..a3737fd0c74 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 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3token.dtx 2931 2011-10-22 13:48:28Z bruno $ {L3 Experimental token manipulation} % %<*driver> @@ -364,7 +364,7 @@ % are also available to the programmer for other uses. % \end{variable} % \ExplSyntaxOn -% \cs_set_eq:NN \c_alignment_token @ +% \cs_set_eq:NN \c_alignment_token & % \cs_set_eq:NN \c_parameter_token # % \ExplSyntaxOff % @@ -1215,7 +1215,7 @@ % \begin{macrocode} \group_begin: \char_set_catcode_active:N \* - \cs_new_nopar:Npn \c_catcode_active_tl { \exp_not:N * } + \tl_const:Nn \c_catcode_active_tl { \exp_not:N * } \group_end: % \end{macrocode} % \end{variable} -- cgit v1.2.3