diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3skip.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3skip.dtx | 96 |
1 files changed, 54 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3skip.dtx b/Master/texmf-dist/source/latex/expl3/l3skip.dtx index c42de0485e7..75e1982a573 100644 --- a/Master/texmf-dist/source/latex/expl3/l3skip.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3skip.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3skip.dtx Copyright (C) 2005-2010 Frank Mittelbach, LaTeX3 project +%% File: l3skip.dtx Copyright (C) 2005-2011 Frank Mittelbach, 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 @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3skip.dtx 2088 2010-11-23 20:27:27Z joseph $ +\GetIdInfo$Id: l3skip.dtx 2121 2011-01-07 08:46:09Z joseph $ {L3 Experimental skip registers} %\iffalse %<*driver> @@ -215,21 +215,21 @@ % % % -% \begin{function}{% -% \skip_eval:n / (EXP) | -% } -% \begin{syntax} -% "\skip_eval:n" \Arg{skip expr} -% \end{syntax} -% Evaluates the value of <skip expr> so that -% "\skip_eval:n {5pt plus 3fil + 3pt minus 1fil}" puts -% "8.0pt plus 3.0fil minus 1.0fil" back into the input stream. -% Expandable. -% \begin{texnote} -% This is the \eTeX{} primitive \tn{glueexpr} turned into a function -% taking an argument. -% \end{texnote} -% \end{function} +%\begin{function}{ +% \skip_eval:n / (EXP) | +%} +% \begin{syntax} +% \cs{skip_eval:n} \Arg{skip expression} +% \end{syntax} +% Evaluates the \meta{skip expression}, expanding any skips +% and token list variables within the \meta{expression} +% to their content (without requiring \cs{skip_use:N}/\cs{tl_use:N}) +% and applying the standard mathematical rules. The result of the +% calculation is left in the input stream as a \meta{glue denotation} +% after two expansions. This will be expressed in points (\texttt{pt}), +% and will require suitable termination if used in a \TeX-style +% assignment as it is \emph{not} an \meta{internal glue}. +%\end{function} % % % \subsection{Formatting a skip register value} @@ -429,20 +429,22 @@ % \end{function} % % -% \begin{function}{% -% \dim_eval:n | -% } -% \begin{syntax} -% "\dim_eval:n" \Arg{dim expr} -% \end{syntax} -% Evaluates the value of a dimension expression so that -% "\dim_eval:n {5pt+3pt}" puts "8pt" back into the input stream. -% Expandable. -% \begin{texnote} -% This is the \eTeX{} primitive \tn{dimexpr} turned into a function -% taking an argument. -% \end{texnote} -% \end{function} +%\begin{function}{ +% \dim_eval:n / (EXP) | +%} +% \begin{syntax} +% \cs{dim_eval: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 result of the +% calculation is left in the input stream as a +% \meta{dimension denotation} after two expansions. This will be +% expressed in points (\texttt{pt}), and will require suitable +% termination if used in a \TeX-style assignment as it is \emph{not} +% an \meta{internal dimension}. +%\end{function} % % \begin{function}{% % \if_dim:w | @@ -450,7 +452,7 @@ % \begin{syntax} % "\if_dim:w" <dimen1> <rel> <dimen2> <true> "\else:" <false> "\fi:" % \end{syntax} -% Compare two dimensions. It is recommended to use "\dim_eval:n" to +% Compare two dimensions. It is recommended to use "\dim_eval:w" to % correctly evaluate and terminate these numbers. <rel> is one of % "<", "=" or ">" with catcode 12. % \begin{texnote} @@ -665,7 +667,7 @@ % uniform at the moment to get a better overview. % \begin{macrocode} \cs_new_protected_nopar:Npn \skip_set:Nn #1#2 { - #1\skip_eval:n{#2} + #1 \etex_glueexpr:D #2 \scan_stop: %<*check> \chk_local_or_pref_global:N #1 %</check> @@ -735,7 +737,7 @@ % We need to say |by| in case the first argment is a register % accessed by its number, e.g., |\skip23|. % \begin{macrocode} - \tex_advance:D#1 by \skip_eval:n{#2} + \tex_advance:D#1 by \etex_glueexpr:D #2 \scan_stop: %<*check> \chk_local_or_pref_global:N #1 %</check> @@ -745,7 +747,7 @@ % % \begin{macrocode} \cs_new_protected_nopar:Npn \skip_sub:Nn #1#2{ - \tex_advance:D#1-\skip_eval:n{#2} + \tex_advance:D #1 -\etex_glueexpr:D #2 \scan_stop: %<*check> \chk_local_or_pref_global:N #1 %</check> @@ -793,10 +795,14 @@ % \end{macrocode} % % \begin{macrocode} -\cs_new_nopar:Npn \skip_horizontal:n #1 { \skip_horizontal:N \skip_eval:n{#1} } +\cs_new_nopar: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_generate_variant:Nn \skip_vertical:N {c} -\cs_new_nopar:Npn \skip_vertical:n #1 { \skip_vertical:N \skip_eval:n{#1} } +\cs_new_nopar:Npn \skip_vertical:n #1 { + \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: +} % \end{macrocode} % \end{macro} % \end{macro} @@ -828,7 +834,9 @@ % \begin{macro}{\skip_eval:n} % Evaluating a calc expression. % \begin{macrocode} -\cs_new_protected_nopar:Npn \skip_eval:n #1 { \etex_glueexpr:D #1 \scan_stop: } +\cs_new_protected_nopar:Npn \skip_eval:n #1 { + \tex_the:D \etex_glueexpr:D #1 \scan_stop: +} % \end{macrocode} % \end{macro} % @@ -947,7 +955,9 @@ % We add |\dim_eval:n| in order to allow simple arithmetic % and a space just for those using |\dimen1| or alike. See OR! % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_set:Nn #1#2 { #1~ \dim_eval:n{#2} } +\cs_new_protected_nopar:Npn \dim_set:Nn #1#2 { + #1~ \etex_dimexpr:D #2 \scan_stop: +} \cs_generate_variant:Nn \dim_set:Nn {cn,Nc} % \end{macrocode} % @@ -1026,7 +1036,7 @@ % We need to say |by| in case the first argment is a register % accessed by its number, e.g., |\dimen23|. % \begin{macrocode} - \tex_advance:D#1 by \dim_eval:n{#2}\scan_stop: + \tex_advance:D#1 by \etex_dimexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \dim_add:Nn {cn,Nc} % \end{macrocode} @@ -1117,7 +1127,9 @@ % \begin{macro}{\dim_eval:n} % Evaluating a calc expression. % \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_eval:n #1 { \etex_dimexpr:D #1 \scan_stop: } +\cs_new_protected_nopar:Npn \dim_eval:n #1 { + \tex_the:D \etex_dimexpr:D #1 \scan_stop: +} % \end{macrocode} % \end{macro} % @@ -1136,7 +1148,7 @@ % \begin{macro}[TF]{\dim_compare:nNn} % \begin{macrocode} \prg_new_conditional:Nnn \dim_compare:nNn {p,TF,T,F} { - \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} + \if_dim:w \etex_dimexpr:D #1 #2 \etex_dimexpr:D #3 \scan_stop: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} |