summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3skip.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3skip.dtx496
1 files changed, 290 insertions, 206 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx
index 9bb1fa1eadc..b83319e74b3 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx
@@ -36,8 +36,8 @@
%
%<*driver|package>
\RequirePackage{l3names}
-\GetIdInfo$Id: l3skip.dtx 3499 2012-03-05 16:08:55Z bruno $
- {L3 Experimental dimensions and skips}
+\GetIdInfo$Id: l3skip.dtx 3986 2012-07-15 19:23:51Z joseph $
+ {L3 Dimensions and skips}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -150,10 +150,10 @@
% \dim_gset_eq:NN, \dim_gset_eq:cN, \dim_gset_eq:Nc, \dim_gset_eq:cc
% }
% \begin{syntax}
-% \cs{dim_set_eq:NN} \meta{dimension1} \meta{dimension2}
+% \cs{dim_set_eq:NN} \meta{dimension_1} \meta{dimension_2}
% \end{syntax}
-% Sets the content of \meta{dimension1} equal to that of
-% \meta{dimension2}.
+% Sets the content of \meta{dimension_1} equal to that of
+% \meta{dimension_2}.
% \end{function}
%
% \begin{function}[updated = 2012-02-06]
@@ -220,7 +220,7 @@
%
% \begin{function}[EXP,pTF]{\dim_compare:nNn}
% \begin{syntax}
-% \cs{dim_compare_p:nNn} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2} \\
+% \cs{@@_compare_p:nNn} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2} \\
% \cs{dim_compare:nNnTF}
% ~~\Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2}
% ~~\Arg{true code} \Arg{false code}
@@ -239,9 +239,9 @@
%
% \begin{function}[EXP,pTF]{\dim_compare:n}
% \begin{syntax}
-% \cs{dim_compare_p:n} \{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \} \\
+% \cs{@@_compare_p:n} \{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \} \\
% \cs{dim_compare:nTF}
-% ~~\{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \}
+% ~~\{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \}
% ~~\Arg{true code} \Arg{false code}
% \end{syntax}
% This function first evaluates each of the \meta{dimension expressions}
@@ -259,6 +259,37 @@
% \end{center}
% \end{function}
%
+% \begin{function}[added = 2012-06-03, EXP]{\dim_case:nnn}
+% \begin{syntax}
+% \cs{dim_case:nnn} \Arg{test dimension expression} \\
+% ~~|{| \\
+% ~~~~\Arg{dimexpr case_1} \Arg{code case_1} \\
+% ~~~~\Arg{dimexpr case_2} \Arg{code case_2} \\
+% ~~~~\ldots \\
+% ~~~~\Arg{dimexpr case_n} \Arg{code case_n} \\
+% ~~|}| \\
+% ~~\Arg{else code}
+% \end{syntax}
+% This function evaluates the \meta{test dimension expression} and
+% compares this in turn to each of the
+% \meta{dimension expression cases}. If the two are equal then the
+% associated \meta{code} is left in the input stream. If none of
+% the tests are \texttt{true} then the \texttt{else code} will be
+% left in the input stream. For example
+% \begin{verbatim}
+% \dim_set:Nn \l_tmpa_dim { 5 pt }
+% \dim_case:nnn
+% { 2 \l_tmpa_dim }
+% {
+% { 5 pt } { Small }
+% { 4 pt + 6 pt } { Medium }
+% { - 10 pt } { Negative }
+% }
+% { No idea! }
+% \end{verbatim}
+% will leave \enquote{\texttt{Medium}} in the input stream.
+% \end{function}
+%
% \section{Dimension expression loops}
%
% \begin{function}[rEXP]{\dim_do_while:nNnn}
@@ -311,7 +342,7 @@
%
% \begin{function}[rEXP]{\dim_do_while:nn}
% \begin{syntax}
-% \cs{dim_do_while:nn} \{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \} \Arg{code}
+% \cs{dim_do_while:nn} \{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \} \Arg{code}
% \end{syntax}
% Evaluates the relationship between the two \meta{dimension expressions}
% as described for \cs{dim_compare:nTF}, and then places the
@@ -323,7 +354,7 @@
%
% \begin{function}[rEXP]{\dim_do_until:nn}
% \begin{syntax}
-% \cs{dim_do_until:nn} \{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \} \Arg{code}
+% \cs{dim_do_until:nn} \{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \} \Arg{code}
% \end{syntax}
% Evaluates the relationship between the two \meta{dimension expressions}
% as described for \cs{dim_compare:nTF}, and then places the
@@ -335,7 +366,7 @@
%
% \begin{function}[rEXP]{\dim_until_do:nn}
% \begin{syntax}
-% \cs{dim_until_do:nn} \{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \} \Arg{code}
+% \cs{dim_until_do:nn} \{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \} \Arg{code}
% \end{syntax}
% Places the \meta{code} in the input stream for \TeX{} to process, and
% then evaluates the relationship between the two
@@ -347,7 +378,7 @@
%
% \begin{function}[rEXP]{\dim_while_do:nn}
% \begin{syntax}
-% \cs{dim_while_do:nn} \{ \meta{dimexpr1} \meta{relation} \meta{dimexpr2} \} \Arg{code}
+% \cs{dim_while_do:nn} \{ \meta{dimexpr_1} \meta{relation} \meta{dimexpr_2} \} \Arg{code}
% \end{syntax}
% Places the \meta{code} in the input stream for \TeX{} to process, and
% then evaluates the relationship between the two
@@ -398,7 +429,7 @@
% Displays the value of the \meta{dimension} on the terminal.
% \end{function}
%
-% \begin{function}[added = 2011-11-22]{\dim_show:n}
+% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\dim_show:n}
% \begin{syntax}
% \cs{dim_show:n} \meta{dimension expression}
% \end{syntax}
@@ -419,7 +450,7 @@
%
% \section{Scratch dimensions}
%
-% \begin{variable}{\l_tmpa_dim, \l_tmpb_dim, \l_tmpc_dim}
+% \begin{variable}{\l_tmpa_dim, \l_tmpb_dim}
% Scratch dimension for local assignment. These are never used by
% the kernel code, and so are safe for use with any \LaTeX3-defined
% function. However, they may be overwritten by other non-kernel
@@ -507,9 +538,9 @@
% \skip_gset_eq:NN, \skip_gset_eq:cN, \skip_gset_eq:Nc, \skip_gset_eq:cc
% }
% \begin{syntax}
-% \cs{skip_set_eq:NN} \meta{skip1} \meta{skip2}
+% \cs{skip_set_eq:NN} \meta{skip_1} \meta{skip_2}
% \end{syntax}
-% Sets the content of \meta{skip1} equal to that of \meta{skip2}.
+% Sets the content of \meta{skip_1} equal to that of \meta{skip_2}.
% \end{function}
%
% \begin{function}[updated = 2011-10-22]
@@ -527,7 +558,7 @@
% \begin{syntax}
% \cs{skip_if_eq_p:nn} \Arg{skipexpr_1} \Arg{skipexpr_2}
% \cs{dim_compare:nTF}
-% ~~\Arg{skip expr1} \Arg{skip expr2}
+% ~~\Arg{skipexpr_1} \Arg{skipexpr_2}
% ~~\Arg{true code} \Arg{false code}
% \end{syntax}
% This function first evaluates each of the
@@ -537,16 +568,6 @@
% for the test to be true.
% \end{function}
%
-% \begin{function}[EXP, pTF, updated = 2012-03-05]{\skip_if_infinite_glue:n}
-% \begin{syntax}
-% \cs{skip_if_infinite_glue_p:n} \Arg{skipexpr}
-% \cs{skip_if_infinite_glue:nTF} \Arg{skipexpr} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Evaluates the \meta{skip expression} as described for \cs{skip_eval:n},
-% and then tests if this contains an infinite stretch or shrink
-% component (or both).
-% \end{function}
-%
% \begin{function}[EXP, pTF, added = 2012-03-05]{\skip_if_finite:n}
% \begin{syntax}
% \cs{skip_if_finite_p:n} \Arg{skipexpr}
@@ -596,7 +617,7 @@
% Displays the value of the \meta{skip} on the terminal.
% \end{function}
%
-% \begin{function}[added = 2011-11-22]{\skip_show:n}
+% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\skip_show:n}
% \begin{syntax}
% \cs{skip_show:n} \meta{skip expression}
% \end{syntax}
@@ -617,7 +638,7 @@
%
% \section{Scratch skips}
%
-% \begin{variable}{\l_tmpa_skip, \l_tmpb_skip, \l_tmpc_skip}
+% \begin{variable}{\l_tmpa_skip, \l_tmpb_skip}
% Scratch skip for local assignment. These are never used by
% the kernel code, and so are safe for use with any \LaTeX3-defined
% function. However, they may be overwritten by other non-kernel
@@ -631,6 +652,32 @@
% code and so should only be used for short-term storage.
% \end{variable}
%
+% \section{Inserting skips into the output}
+%
+% \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}
+% \end{syntax}
+% Inserts a horizontal \meta{skip} into the current list.
+% \begin{texnote}
+% \cs{skip_horizontal:N} is the \TeX{} primitive \tn{hskip} renamed.
+% \end{texnote}
+% \end{function}
+%
+% \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}
+% \end{syntax}
+% Inserts a vertical \meta{skip} into the current list.
+% \begin{texnote}
+% \cs{skip_vertical:N} is the \TeX{} primitive \tn{vskip} renamed.
+% \end{texnote}
+% \end{function}
+%
% \section{Creating and initialising \texttt{muskip} variables}
%
% \begin{function}{\muskip_new:N, \muskip_new:c}
@@ -711,10 +758,10 @@
% \muskip_gset_eq:Nc, \muskip_gset_eq:cc
% }
% \begin{syntax}
-% \cs{muskip_set_eq:NN} \meta{muskip1} \meta{muskip2}
+% \cs{muskip_set_eq:NN} \meta{muskip_1} \meta{muskip_2}
% \end{syntax}
-% Sets the content of \meta{muskip1} equal to that of
-% \meta{muskip2}.
+% Sets the content of \meta{muskip_1} equal to that of
+% \meta{muskip_2}.
% \end{function}
%
% \begin{function}[updated = 2011-10-22]
@@ -757,32 +804,6 @@
% \end{texnote}
% \end{function}
%
-% \section{Inserting skips into the output}
-%
-% \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}
-% \end{syntax}
-% Inserts a horizontal \meta{skip} into the current list.
-% \begin{texnote}
-% \cs{skip_horizontal:N} is the \TeX{} primitive \tn{hskip} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \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}
-% \end{syntax}
-% Inserts a vertical \meta{skip} into the current list.
-% \begin{texnote}
-% \cs{skip_vertical:N} is the \TeX{} primitive \tn{vskip} renamed.
-% \end{texnote}
-% \end{function}
-%
% \section{Viewing \texttt{muskip} variables}
%
% \begin{function}{\muskip_show:N, \muskip_show:c}
@@ -792,7 +813,7 @@
% Displays the value of the \meta{muskip} on the terminal.
% \end{function}
%
-% \begin{function}[added = 2011-11-22]{\muskip_show:n}
+% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\muskip_show:n}
% \begin{syntax}
% \cs{muskip_show:n} \meta{muskip expression}
% \end{syntax}
@@ -800,11 +821,37 @@
% on the terminal.
% \end{function}
%
-% \section{Internal functions}
+% \section{Constant muskips}
+%
+% \begin{variable}{\c_max_muskip}
+% The maximum value that can be stored as a muskip.
+% \end{variable}
+%
+% \begin{variable}{\c_zero_muskip}
+% A zero length as a muskip.
+% \end{variable}
+%
+% \section{Scratch muskips}
+%
+% \begin{variable}{\l_tmpa_muskip, \l_tmpb_muskip}
+% Scratch muskip for local assignment. These are never used by
+% the kernel code, and so are safe for use with any \LaTeX3-defined
+% function. However, they may be overwritten by other non-kernel
+% code and so should only be used for short-term storage.
+% \end{variable}
+%
+% \begin{variable}{\g_tmpa_muskip, \g_tmpb_muskip}
+% Scratch muskip for global assignment. These are never used by
+% the kernel code, and so are safe for use with any \LaTeX3-defined
+% function. However, they may be overwritten by other non-kernel
+% code and so should only be used for short-term storage.
+% \end{variable}
+%
+% \section{Primitive conditional}
%
% \begin{function}{\if_dim:w}
% \begin{syntax}
-% \cs{if_dim:w} \meta{dimen1} \meta{relation} \meta{dimen1}
+% \cs{if_dim:w} \meta{dimen_1} \meta{relation} \meta{dimen_2}
% ~~\meta{true code}
% \cs{else:}
% ~~\meta{false}
@@ -817,44 +864,28 @@
% \end{texnote}
% \end{function}
%
-% \begin{function}[EXP]{\dim_eval:w, \dim_eval_end:}
+% \section{Internal functions}
+%
+% \begin{function}[EXP]{\__dim_eval:w, \__dim_eval_end:}
% \begin{syntax}
-% \cs{dim_eval:w} \meta{dimexpr} \cs{dim_eval_end:}
+% \cs{__dim_eval:w} \meta{dimexpr} \cs{__dim_eval_end:}
% \end{syntax}
% Evaluates \meta{dimension expression} as described for \cs{dim_eval:n}.
% The evaluation stops when an unexpandable token which is not a valid
-% part of a dimension is read or when \cs{dim_eval_end:} is
+% part of a dimension is read or when \cs{__dim_eval_end:} is
% reached. The latter is gobbled by the scanner mechanism:
-% \cs{dim_eval_end:} itself is unexpandable but used correctly
+% \cs{__dim_eval_end:} itself is unexpandable but used correctly
% the entire construct is expandable.
% \begin{texnote}
% This is the \eTeX{} primitive \tn{dimexpr}.
% \end{texnote}
% \end{function}
%
-% \section{Experimental skip functions}
-%
-% \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}
-% \end{syntax}
-% Checks if the \meta{skipexpr} contains finite glue. If it does then it
-% assigns
-% \meta{dimen1} the stretch component and \meta{dimen2} the shrink
-% component. If
-% it contains infinite glue set \meta{dimen1} and \meta{dimen2} to $0$\,pt
-% 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}
+% {\__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}
+% \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}
@@ -867,7 +898,7 @@
% If the \Arg{dimension expression} contains additional units, these will
% be ignored, so for example
% \begin{verbatim}
-% \dim_strip_pt:n { 1 bp pt }
+% \__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).
@@ -884,23 +915,27 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=dim>
+% \end{macrocode}
+%
+% \begin{macrocode}
%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
+\__expl_package_check:
%</package>
% \end{macrocode}
%
% \subsection{Length primitives renamed}
%
% \begin{macro}{\if_dim:w}
-% \begin{macro}{\dim_eval:w}
-% \begin{macro}{\dim_eval_end:}
+% \begin{macro}{\@@_eval:w}
+% \begin{macro}{\@@_eval_end:}
% Primitives renamed.
% \begin{macrocode}
\cs_new_eq:NN \if_dim:w \tex_ifdim:D
-\cs_new_eq:NN \dim_eval:w \etex_dimexpr:D
-\cs_new_eq:NN \dim_eval_end: \tex_relax:D
+\cs_new_eq:NN \@@_eval:w \etex_dimexpr:D
+\cs_new_eq:NN \@@_eval_end: \tex_relax:D
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -914,7 +949,7 @@
%<*package>
\cs_new_protected:Npn \dim_new:N #1
{
- \chk_if_free_cs:N #1
+ \__chk_if_free_cs:N #1
\newdimen #1
}
%</package>
@@ -981,7 +1016,7 @@
% Setting dimensions is easy enough.
% \begin{macrocode}
\cs_new_protected:Npn \dim_set:Nn #1#2
- { #1 ~ \dim_eval:w #2 \dim_eval_end: }
+ { #1 ~ \@@_eval:w #2 \@@_eval_end: }
\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 }
@@ -1008,19 +1043,19 @@
% \begin{macro}{\dim_set_min:Nn, \dim_set_min:cn}
% \begin{macro}{\dim_gset_max:Nn, \dim_gset_max:cn}
% \begin{macro}{\dim_gset_min:Nn, \dim_gset_min:cn}
-% \begin{macro}[aux]{\dim_set_max_aux:NNNn}
+% \begin{macro}[aux]{\@@_set_max:NNNn}
% 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
- { \dim_set_max_aux:NNNn < \dim_set:Nn }
+ { \@@_set_max:NNNn < \dim_set:Nn }
\cs_new_protected_nopar:Npn \dim_gset_max:Nn
- { \dim_set_max_aux:NNNn < \dim_gset:Nn }
+ { \@@_set_max:NNNn < \dim_gset:Nn }
\cs_new_protected_nopar:Npn \dim_set_min:Nn
- { \dim_set_max_aux:NNNn > \dim_set:Nn }
+ { \@@_set_max:NNNn > \dim_set:Nn }
\cs_new_protected_nopar:Npn \dim_gset_min:Nn
- { \dim_set_max_aux:NNNn > \dim_gset:Nn }
-\cs_new_protected:Npn \dim_set_max_aux:NNNn #1#2#3#4
+ { \@@_set_max:NNNn > \dim_gset:Nn }
+\cs_new_protected:Npn \@@_set_max:NNNn #1#2#3#4
{ \dim_compare:nNnT {#3} #1 {#4} { #2 #3 {#4} } }
\cs_generate_variant:Nn \dim_set_max:Nn { c }
\cs_generate_variant:Nn \dim_gset_max:Nn { c }
@@ -1040,12 +1075,12 @@
% Using |by| here deals with the (incorrect) case |\dimen123|.
% \begin{macrocode}
\cs_new_protected:Npn \dim_add:Nn #1#2
- { \tex_advance:D #1 by \dim_eval:w #2 \dim_eval_end: }
+ { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: }
\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:Npn \dim_sub:Nn #1#2
- { \tex_advance:D #1 by - \dim_eval:w #2 \dim_eval_end: }
+ { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: }
\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 }
@@ -1065,57 +1100,55 @@
\cs_new:Npn \dim_abs:n #1
{
\dim_use:N
- \dim_eval:w
- \if_dim:w \dim_eval:w #1 < \c_zero_dim
+ \@@_eval:w
+ \if_dim:w \@@_eval:w #1 < \c_zero_dim
-
\fi:
- \dim_eval:w #1 \dim_eval_end:
- \dim_eval_end:
+ \@@_eval:w #1 \@@_eval_end:
+ \@@_eval_end:
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dim_ratio:nn}
-% \begin{macro}[aux]{\dim_ratio_aux:n}
+% \begin{macro}[aux]{\@@_ratio:n}
% With dimension expressions, something like |10 pt * ( 5 pt / 10 pt )| will
% not work. Instead, the ratio part needs to be converted to an integer
-% expression. Using \cs{int_value:w} forces everything into |sp|, avoiding
+% expression. Using \cs{__int_value:w} forces everything into |sp|, avoiding
% any decimal parts.
% \begin{macrocode}
\cs_new:Npn \dim_ratio:nn #1#2
- { \dim_ratio_aux:n {#1} / \dim_ratio_aux:n {#2} }
-\cs_new:Npn \dim_ratio_aux:n #1
- { \int_value:w \dim_eval:w #1 \dim_eval_end: }
+ { \@@_ratio:n {#1} / \@@_ratio:n {#2} }
+\cs_new:Npn \@@_ratio:n #1
+ { \__int_value:w \@@_eval:w #1 \@@_eval_end: }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Dimension expression conditionals}
%
-% \begin{macro}{\dim_compare_p:nNn}
-% \begin{macro}[TF]{\dim_compare:nNn}
+% \begin{macro}[pTF, EXP]{\dim_compare:nNn}
% Simple comparison.
% \begin{macrocode}
\prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF }
{
- \if_dim:w \dim_eval:w #1 #2 \dim_eval:w #3 \dim_eval_end:
+ \if_dim:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end:
\prg_return_true: \else: \prg_return_false: \fi:
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[pTF, EXP]{\dim_compare:n}
-% \begin{macro}[aux, EXP]{\dim_compare_aux:w, \dim_compare_aux:NNw}
+% \begin{macro}[aux, EXP]{\@@_compare_aux:w, \@@_compare_aux:NNw}
% \begin{macro}[aux, EXP]
% {
-% \dim_compare_=:NNw,
-% \dim_compare_<:NNw,
-% \dim_compare_>:NNw,
-% \dim_compare_==:NNw,
-% \dim_compare_!=:NNw,
-% \dim_compare_<=:NNw,
-% \dim_compare_>=:NNw
+% \@@_compare_=:NNw,
+% \@@_compare_<:NNw,
+% \@@_compare_>:NNw,
+% \@@_compare_==:NNw,
+% \@@_compare_!=:NNw,
+% \@@_compare_<=:NNw,
+% \@@_compare_>=:NNw
% }
% This code is adapted from the \cs{int_compare:nTF} function. First
% evaluate the left-hand side. Then access the relation symbol by
@@ -1124,40 +1157,65 @@
% \begin{macrocode}
\prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF }
{
- \exp_after:wN \dim_compare_aux:w \dim_use:N \dim_eval:w #1
- \kernel_compare_error: \dim_eval_end:
+ \exp_after:wN \@@_compare_aux:w \dim_use:N \@@_eval:w #1
+ \__prg_compare_error: \@@_eval_end:
\prg_return_true:
\else:
\prg_return_false:
\fi:
}
\exp_args:Nno \use:nn
- { \cs_new:Npn \dim_compare_aux:w #1 }
+ { \cs_new:Npn \@@_compare_aux:w #1 }
{ \tl_to_str:n { pt } }
- #2 \kernel_compare_error:
+ #2 \__prg_compare_error:
{
- \exp_after:wN \dim_compare_aux:NNw #2 ?? \q_mark
+ \exp_after:wN \@@_compare_aux:NNw #2 ?? \q_mark
#1 pt #2
}
-\cs_new:Npn \dim_compare_aux:NNw #1#2#3 \q_mark
+\cs_new:Npn \@@_compare_aux:NNw #1#2#3 \q_mark
{
- \use:c { dim_compare_ #1 \if_meaning:w = #2 = \fi: :NNw }
- \kernel_compare_error:Nw #1
+ \use:c { @@_compare_ #1 \if_meaning:w = #2 = \fi: :NNw }
+ \__prg_compare_error:Nw #1
}
-\cs_new:cpn { dim_compare_=:NNw } #1#2#3 =
- { \if_dim:w #3 = \dim_eval:w }
-\cs_new:cpn { dim_compare_<:NNw } #1#2#3 <
- { \if_dim:w #3 < \dim_eval:w }
-\cs_new:cpn { dim_compare_>:NNw } #1#2#3 >
- { \if_dim:w #3 > \dim_eval:w }
-\cs_new:cpn { dim_compare_==:NNw } #1#2#3 ==
- { \if_dim:w #3 = \dim_eval:w }
-\cs_new:cpn { dim_compare_!=:NNw } #1#2#3 !=
- { \reverse_if:N \if_dim:w #3 = \dim_eval:w }
-\cs_new:cpn { dim_compare_<=:NNw } #1#2#3 <=
- { \reverse_if:N \if_dim:w #3 > \dim_eval:w }
-\cs_new:cpn { dim_compare_>=:NNw } #1#2#3 >=
- { \reverse_if:N \if_dim:w #3 < \dim_eval:w }
+\cs_new:cpn { @@_compare_=:NNw } #1#2#3 =
+ { \if_dim:w #3 = \@@_eval:w }
+\cs_new:cpn { @@_compare_<:NNw } #1#2#3 <
+ { \if_dim:w #3 < \@@_eval:w }
+\cs_new:cpn { @@_compare_>:NNw } #1#2#3 >
+ { \if_dim:w #3 > \@@_eval:w }
+\cs_new:cpn { @@_compare_==:NNw } #1#2#3 ==
+ { \if_dim:w #3 = \@@_eval:w }
+\cs_new:cpn { @@_compare_!=:NNw } #1#2#3 !=
+ { \reverse_if:N \if_dim:w #3 = \@@_eval:w }
+\cs_new:cpn { @@_compare_<=:NNw } #1#2#3 <=
+ { \reverse_if:N \if_dim:w #3 > \@@_eval:w }
+\cs_new:cpn { @@_compare_>=:NNw } #1#2#3 >=
+ { \reverse_if:N \if_dim:w #3 < \@@_eval:w }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\dim_case:nnn}
+% \begin{macro}[aux, EXP]{\@@_case_aux:nnn}
+% \begin{macro}[aux, EXP]{\@@_case_aux:nw,\@@_case_end:nw}
+% The dimension function is the same as the \texttt{int} version, so there
+% is not much to say here.
+% \begin{macrocode}
+\cs_new:Npn \dim_case:nnn #1
+ {
+ \tex_romannumeral:D
+ \exp_args:Nf \@@_case_aux:nnn { \dim_eval:n {#1} }
+ }
+\cs_new:Npn \@@_case_aux:nnn #1#2#3
+ { \@@_case_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop }
+\cs_new:Npn \@@_case_aux:nw #1#2#3
+ {
+ \dim_compare:nNnTF {#1} = {#2}
+ { \@@_case_end:nw {#3} }
+ { \@@_case_aux:nw {#1} }
+ }
+\cs_new_eq:NN \@@_case_end:nw \__prg_case_end:nw
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1253,33 +1311,33 @@
% Evaluating a dimension expression expandably.
% \begin{macrocode}
\cs_new:Npn \dim_eval:n #1
- { \dim_use:N \dim_eval:w #1 \dim_eval_end: }
+ { \dim_use:N \@@_eval:w #1 \@@_eval_end: }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\dim_strip_bp:n}
+% \begin{macro}[EXP, int]{\@@_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: } }
+\cs_new:Npn \@@_strip_bp:n #1
+ { \@@_strip_pt:n { 0.996 26 \@@_eval:w #1 \@@_eval_end: } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\dim_strip_pt:n}
-% \begin{macro}[EXP, aux]{\dim_strip_pt:w}
+% \begin{macro}[EXP]{\@@_strip_pt:n}
+% \begin{macro}[EXP, aux]{\@@_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
+\cs_new:Npn \@@_strip_pt:n #1
{
\exp_after:wN
- \dim_strip_pt:w \dim_use:N \dim_eval:w #1 \dim_eval_end: \q_stop
+ \@@_strip_pt:w \dim_use:N \@@_eval:w #1 \@@_eval_end: \q_stop
}
\use:x
{
- \cs_new:Npn \exp_not:N \dim_strip_pt:w
+ \cs_new:Npn \exp_not:N \@@_strip_pt:w
##1 . ##2 \tl_to_str:n { pt } ##3 \exp_not:N \q_stop
{
##1
@@ -1304,16 +1362,18 @@
% \begin{macro}{\dim_show:N, \dim_show:c}
% Diagnostics.
% \begin{macrocode}
-\cs_new_eq:NN \dim_show:N \kernel_register_show:N
+\cs_new_eq:NN \dim_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \dim_show:N { c }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dim_show:n}
-% Diagnostics.
+% Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show
+% dimension expressions: this gives a more unified output, since the
+% closing brace is read by the dimension expression in all cases.
% \begin{macrocode}
\cs_new_protected:Npn \dim_show:n #1
- { \tex_showthe:D \dim_eval:w #1 \dim_eval_end: }
+ { \etex_showtokens:D \exp_after:wN { \dim_use:N \@@_eval:w #1 } }
% \end{macrocode}
% \end{macro}
%
@@ -1338,14 +1398,13 @@
%
% \subsection{Scratch dimensions}
%
-% \begin{variable}{\l_tmpa_dim, \l_tmpb_dim, \l_tmpc_dim}
+% \begin{variable}{\l_tmpa_dim, \l_tmpb_dim}
% \begin{variable}{\g_tmpa_dim, \g_tmpb_dim}
-% We provide three local and two global scratch registers, maybe we
+% We provide two local and two global scratch registers, maybe we
% need more or less.
% \begin{macrocode}
\dim_new:N \l_tmpa_dim
\dim_new:N \l_tmpb_dim
-\dim_new:N \l_tmpc_dim
\dim_new:N \g_tmpa_dim
\dim_new:N \g_tmpb_dim
% \end{macrocode}
@@ -1360,7 +1419,7 @@
%<*package>
\cs_new_protected:Npn \skip_new:N #1
{
- \chk_if_free_cs:N #1
+ \__chk_if_free_cs:N #1
\newskip #1
}
%</package>
@@ -1493,7 +1552,7 @@
% \end{macro}
%
% \begin{macro}[EXP,pTF]{\skip_if_finite:n}
-% \begin{macro}[EXP,aux]{\skip_if_finite_aux:wwNw}
+% \begin{macro}[EXP,aux]{\__skip_if_finite:wwNw}
% With \eTeX{}, we have an easy access to the order of infinities of
% the stretch and shrink components of a skip. However, to access
% both, we either need to evaluate the expression twice, or evaluate
@@ -1502,29 +1561,21 @@
% it is quicker to make it search for the string \texttt{fil} which
% characterizes infinite glue.
% \begin{macrocode}
-\cs_set_protected:Npn \cs_tmp:w #1
+\cs_set_protected:Npn \__cs_tmp:w #1
{
\prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF }
{
- \exp_after:wN \skip_if_finite_aux:wwNw
+ \exp_after:wN \__skip_if_finite:wwNw
\skip_use:N \etex_glueexpr:D ##1 ; \prg_return_false:
#1 ; \prg_return_true: \q_stop
}
- \cs_new:Npn \skip_if_finite_aux:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3}
+ \cs_new:Npn \__skip_if_finite:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3}
}
-\exp_args:No \cs_tmp:w { \tl_to_str:n { fil } }
+\exp_args:No \__cs_tmp:w { \tl_to_str:n { fil } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP, pTF]{\skip_if_infinite_glue:n}
-% Reverse of \cs{skip_if_finite:nTF}.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF }
- { \skip_if_finite:nTF {#1} \prg_return_false: \prg_return_true: }
-% \end{macrocode}
-% \end{macro}
-%
% \subsection{Using \texttt{skip} expressions and variables}
%
% \begin{macro}{\skip_eval:n}
@@ -1566,16 +1617,18 @@
% \begin{macro}{\skip_show:N, \skip_show:c}
% Diagnostics.
% \begin{macrocode}
-\cs_new_eq:NN \skip_show:N \kernel_register_show:N
+\cs_new_eq:NN \skip_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \skip_show:N { c }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\skip_show:n}
-% Diagnostics.
+% Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show
+% skip expressions: this gives a more unified output, since the
+% closing brace is read by the skip expression in all cases.
% \begin{macrocode}
\cs_new_protected:Npn \skip_show:n #1
- { \tex_showthe:D \etex_glueexpr:D #1 \scan_stop: }
+ { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_glueexpr:D #1 } }
% \end{macrocode}
% \end{macro}
%
@@ -1593,14 +1646,13 @@
%
% \subsection{Scratch skips}
%
-% \begin{variable}{\l_tmpa_skip, \l_tmpb_skip, \l_tmpc_skip}
+% \begin{variable}{\l_tmpa_skip, \l_tmpb_skip}
% \begin{variable}{\g_tmpa_skip, \g_tmpb_skip}
-% We provide three local and two global scratch registers, maybe we
+% We provide two local and two global scratch registers, maybe we
% need more or less.
% \begin{macrocode}
\skip_new:N \l_tmpa_skip
\skip_new:N \l_tmpb_skip
-\skip_new:N \l_tmpc_skip
\skip_new:N \g_tmpa_skip
\skip_new:N \g_tmpb_skip
% \end{macrocode}
@@ -1615,7 +1667,7 @@
%<*package>
\cs_new_protected:Npn \muskip_new:N #1
{
- \chk_if_free_cs:N #1
+ \__chk_if_free_cs:N #1
\newmuskip #1
}
%</package>
@@ -1761,44 +1813,76 @@
% \begin{macro}{\muskip_show:N, \muskip_show:c}
% Diagnostics.
% \begin{macrocode}
-\cs_new_eq:NN \muskip_show:N \kernel_register_show:N
+\cs_new_eq:NN \muskip_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \muskip_show:N { c }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muskip_show:n}
-% Diagnostics.
+% Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show
+% muskip expressions: this gives a more unified output, since the
+% closing brace is read by the muskip expression in all cases.
% \begin{macrocode}
\cs_new_protected:Npn \muskip_show:n #1
- { \tex_showthe:D \etex_muexpr:D #1 \scan_stop: }
+ { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_muexpr:D #1 } }
% \end{macrocode}
% \end{macro}
%
-% \subsection{Experimental skip functions}
+% \subsection{Constant muskips}
%
-% \begin{macro}{\skip_split_finite_else_action:nnNN}
-% This macro is useful when performing error checking in certain
-% circumstances. If the \meta{skip} register holds finite glue it sets
-% |#3| and |#4| to the stretch and shrink component, resp. If it holds
-% infinite glue set |#3| and |#4| to zero and issue the special action
-% |#2| which is probably an error message.
-% Assignments are local.
+% \begin{macro}{\c_zero_muskip}
+% \begin{macro}{\c_max_muskip}
+% Constant muskips given by their value.
% \begin{macrocode}
-\cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4
- {
- \skip_if_finite:nTF {#1}
- {
- #3 = \etex_gluestretch:D #1 \scan_stop:
- #4 = \etex_glueshrink:D #1 \scan_stop:
- }
- {
- #3 = \c_zero_skip
- #4 = \c_zero_skip
- #2
- }
- }
+\muskip_const:Nn \c_zero_muskip { 0 mu }
+\muskip_const:Nn \c_max_muskip { 16383.99999 mu }
% \end{macrocode}
-% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Scratch muskips}
+%
+% \begin{variable}{\l_tmpa_muskip, \l_tmpb_muskip}
+% \begin{variable}{\g_tmpa_muskip, \g_tmpb_muskip}
+% We provide two local and two global scratch registers, maybe we
+% need more or less.
+% \begin{macrocode}
+\muskip_new:N \l_tmpa_muskip
+\muskip_new:N \l_tmpb_muskip
+\muskip_new:N \g_tmpa_muskip
+\muskip_new:N \g_tmpb_muskip
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+%
+% \subsection{Deprecated functions}
+%
+% Deprecated on 2012-05-10, for removal by 2012-08-31.
+%
+% \begin{macro}[EXP, pTF]{\skip_if_infinite_glue:n}
+% Reverse of \cs{skip_if_finite:nTF}.
+% \begin{macrocode}
+\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF }
+ { \skip_if_finite:nTF {#1} \prg_return_false: \prg_return_true: }
+% \end{macrocode}
+% \end{macro}
+%
+% Deprecated 2012-06-03 for removal after 2012-12-31.
+%
+% \begin{macro}[EXP]{\prg_case_dim:nnn}
+% Moved here, was in \pkg{l3prg} but load order means we define it here
+% now.
+% \begin{macrocode}
+\cs_new_eq:NN \prg_case_dim:nnn \dim_case:nnn
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\dim_eval:w, \dim_eval_end:}
+% \begin{macrocode}
+\cs_new_eq:NN \dim_eval:w \__dim_eval:w
+\cs_new_eq:NN \dim_eval_end: \__dim_eval_end:
+% \end{macrocode}
+% \end{macro}
%
% \begin{macrocode}
%</initex|package>