diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3box.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3box.dtx | 541 |
1 files changed, 252 insertions, 289 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3box.dtx b/Master/texmf-dist/source/latex/expl3/l3box.dtx index c697225b8b3..bf619435d63 100644 --- a/Master/texmf-dist/source/latex/expl3/l3box.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3box.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3box.dtx Copyright (C) 2005-2007 LaTeX3 project +%% File: l3box.dtx Copyright (C) 2005-2009 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 @@ -17,7 +17,7 @@ %% %% The development version of the bundle can be found at %% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3box.dtx 718 2007-12-16 22:59:58Z morten $ +\GetIdInfo$Id: l3box.dtx 1375 2009-06-01 12:28:52Z joseph $ {L3 Experimental Box module} %\iffalse %<*driver> @@ -44,9 +44,9 @@ \ProvidesFile{\filename.\filenameext} [\filedate\space v\fileversion\space\filedescription] %\iffalse -\documentclass{l3doc} +\documentclass[full]{l3doc} \begin{document} -\DocInput{\filename.\filenameext} +\DocInput{l3box.dtx} \end{document} %</driver> % \fi @@ -60,20 +60,19 @@ % \date{\filedate} % \maketitle % -% \section{Boxes} -% +% \begin{documentation} % % There are three kinds of box operations: horizontal mode denoted % with prefix |\hbox_|, vertical mode with prefix |\vbox_|, and the % generic operations working in both modes with prefix |\box_|. % % -% \subsection{Generic functions} +% \section{Generic functions} % % \begin{function}{% % \box_new:N | % \box_new:c | -% \box_new_l:N +%^^A \box_new_l:N % } % \begin{syntax} % "\box_new:N" <box> @@ -103,18 +102,34 @@ % \end{texnote} % \end{function} % +% \begin{function}{\box_if_horizontal_p:N | +% \box_if_horizontal_p:c | +% \box_if_horizontal:N / (TF) | +% \box_if_horizontal:c / (TF) } +% \begin{syntax} +% "\box_if_horizontal:NTF" <box> \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if <box> is an horizontal box and executes <code> accordingly. +% \end{function} +% +% \begin{function}{\box_if_vertical_p:N | +% \box_if_vertical_p:c | +% \box_if_vertical:N / (TF) | +% \box_if_vertical:c / (TF) } +% \begin{syntax} +% "\box_if_vertical:NTF" <box> \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if <box> is a vertical box and executes <code> accordingly. +% \end{function} +% % \begin{function}{% % \box_if_empty_p:N | % \box_if_empty_p:c | -% \box_if_empty:NTF | -% \box_if_empty:cTF | -% \box_if_empty:NT | -% \box_if_empty:cT | -% \box_if_empty:NF | -% \box_if_empty:cF | +% \box_if_empty:N / (TF) | +% \box_if_empty:c / (TF) | % } % \begin{syntax} -% "\box_if_empty:NTF" <box> "{"\m{true code}"}" "{"\m{false code}"}" +% "\box_if_empty:NTF" <box> \Arg{true code} \Arg{false code} % \end{syntax} % Tests if <box> is empty (void) and executes "code" according to the % test outcome. @@ -160,8 +175,8 @@ % \begin{syntax} % "\box_set_to_last:N" <box> % \end{syntax} -% Sets <box> equal to the previous box |\R_last_box| and removes -% |\R_last_box| from the current list (unless in outer vertical +% Sets <box> equal to the previous box |\l_last_box| and removes +% |\l_last_box| from the current list (unless in outer vertical % or math mode). % \end{function} % @@ -172,7 +187,7 @@ % \box_move_down:nn | % } % \begin{syntax} -% "\box_move_left:nn" "{"<dimen>"}" "{"<box function>"}" +% "\box_move_left:nn" \Arg{dimen} \Arg{box function} % \end{syntax} % Moves <box function> <dimen> in the direction specified. <box % function> is either an operation on a box such as "\box_use:N" or a @@ -258,23 +273,25 @@ % % % \begin{variable}{% -% \R_last_box | +% \l_last_box | % } % \begin{syntax} % \end{syntax} -% "\R_last_box" is a read-only box register. You can set other -% boxes to this box, which will then be removed from the current -% list. +% "\l_last_box" is more or less a read-only box register managed by the +% engine. It denotes the last box on the current list if there is one, +% otherwise it is void. You can set other +% boxes to this box, with the result that the last box on the current list is +% removed at the same time (so it is with variable with side-effects). % \end{variable} % % -% \subsection{Horizontal mode} +% \section{Horizontal mode} % % \begin{function}{% % \hbox:n | % } % \begin{syntax} -% "\hbox:n" "{"<contents>"}" +% "\hbox:n" \Arg{contents} % \end{syntax} % Places a "hbox" of natural size. % \end{function} @@ -286,7 +303,7 @@ % \hbox_gset:cn | % } % \begin{syntax} -% "\hbox_set:Nn" <box> "{"\m{contents}"}" +% "\hbox_set:Nn" <box> \Arg{contents} % \end{syntax} % Sets <box> to be a vertical mode box containing \m{contents}. It has % it's natural size. "\hbox_gset:Nn" does it globally. @@ -300,7 +317,7 @@ % \hbox_gset_to_wd:cnn | % } % \begin{syntax} -% "\hbox_set_to_wd:Nnn" <box> "{"\m{dimen}"}" "{"\m{contents}"}" +% "\hbox_set_to_wd:Nnn" <box> \Arg{dimen} \Arg{contents} % \end{syntax} % Sets <box> to contain \m{contents} and have width <dimen>. % "\hbox_gset_to_wd:Nn" does it globally. @@ -309,11 +326,14 @@ % % \begin{function}{% % \hbox_to_wd:nn | +% \hbox_to_zero:n | % } % \begin{syntax} -% "\hbox_to_wd:nn" "{"<dimen>"}" <contents> +% "\hbox_to_wd:nn" \Arg{dimen} <contents> +% "\hbox_to_zero:n" <contents> % \end{syntax} -% Places a <box> of width <dimen> containing <contents>. +% Places a <box> of width <dimen> containing <contents>. "\hbox_to_zero:n" +% is a shorthand for a width of zero. % \end{function} % % @@ -336,7 +356,9 @@ % % \begin{function}{% % \hbox_unpack:N | +% \hbox_unpack:c | % \hbox_unpack_clear:N | +% \hbox_unpack_clear:c | % } % \begin{syntax} % "\hbox_unpack:N" <box> @@ -352,7 +374,17 @@ % % % -% \subsection{Vertical mode} +% \section{Vertical mode} +% +% \begin{function}{% +% \vbox:n | +% } +% \begin{syntax} +% "\vbox:n" \Arg{contents} +% \end{syntax} +% Places a "vbox" of natural size with baseline equal to the baseline +% of the last line in the box. +% \end{function} % % \begin{function}{% % \vbox_set:Nn | @@ -361,10 +393,10 @@ % \vbox_gset:cn | % } % \begin{syntax} -% "\vbox_set:Nn" <box> "{"\m{contents}"}" +% "\vbox_set:Nn" <box> \Arg{contents} % \end{syntax} % Sets <box> to be a vertical mode box containing \m{contents}. It has -% it's natural size. "\vbox_gset:Nn" does it globally. +% its natural size. "\vbox_gset:Nn" does it globally. % \end{function} % % @@ -376,7 +408,7 @@ % \vbox_gset_to_ht:ccn | % } % \begin{syntax} -% "\vbox_set_to_ht:Nnn" <box> "{"\m{dimen}"}" "{"\m{contents}"}" +% "\vbox_set_to_ht:Nnn" <box> \Arg{dimen} \Arg{contents} % \end{syntax} % Sets <box> to contain \m{contents} and have total height <dimen>. % "\vbox_gset_to_ht:Nn" does it globally. @@ -401,7 +433,7 @@ % \vbox_set_split_to_ht:NNn | % } % \begin{syntax} -% "\vbox_set_split_to_ht:NNn" <box1> <box2> "{"<dimen>"}" +% "\vbox_set_split_to_ht:NNn" <box1> <box2> \Arg{dimen} % \end{syntax} % Sets <box1> to contain the top <dimen> part of <box2>. % \begin{texnote} @@ -410,21 +442,11 @@ % \end{function} % % \begin{function}{% -% \vbox:n | -% } -% \begin{syntax} -% "\vbox:n" "{"<contents>"}" -% \end{syntax} -% Places a "vbox" of natural size with baseline equal to the baseline -% of the last line in the box. -% \end{function} -% -% \begin{function}{% % \vbox_to_ht:nn | % \vbox_to_zero:n | % } % \begin{syntax} -% "\vbox_to_ht:nn" "{"<dimen>"}" <contents> \\ +% "\vbox_to_ht:nn" \Arg{dimen} <contents> \\ % "\vbox_to_zero:n" <contents> % \end{syntax} % Places a <box> of size <dimen> containing <contents>. @@ -433,7 +455,9 @@ % % \begin{function}{% % \vbox_unpack:N | +% \vbox_unpack:c | % \vbox_unpack_clear:N | +% \vbox_unpack_clear:c | % } % \begin{syntax} % "\vbox_unpack:N" <box> @@ -446,19 +470,22 @@ % \end{function} % % -% \StopEventually{} +% \end{documentation} % +% \begin{implementation} % % -% \subsection{The Implementation} +% +% \section{\pkg{l3box} implementation} % % % Announce and ensure that the required packages are loaded. % \begin{macrocode} -%<package>\ProvidesExplPackage -%<package> {\filename}{\filedate}{\fileversion}{\filedescription} -%<package&!check>\RequirePackage{l3prg,l3token}\par -%<package&check>\RequirePackage{l3chk}\par +%<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +%</package> %<*initex|package> % \end{macrocode} % @@ -466,11 +493,10 @@ % comment it very extensively. % % -% \subsubsection{Generic boxes} +% \subsection{Generic boxes} % -% \begin{macro}{\box_new:N} -% \begin{macro}{\box_new_l:N} -% \begin{macro}{\box_new:c} +% \begin{macro}{\box_new:N,\box_new:c} +%^^A \begin{macro}{\box_new_l:N} % Defining a new \m{box} register. % \begin{macrocode} %<*initex> @@ -480,19 +506,26 @@ % shouldn't be allocated\dots % \begin{macrocode} \seq_put_right:Nn \g_box_allocation_seq {255} -\def_new:Npn \box_new:N #1 {\alloc_reg:NnNN g {box} \tex_mathchardef:D #1} -\def_new:Npn \box_new_l:N #1 {\alloc_reg:NnNN l {box} \tex_mathchardef:D #1} +\cs_new_nopar:Npn \box_new:N #1 {\alloc_reg:NnNN g {box} \tex_mathchardef:D #1} +\cs_new_nopar:Npn \box_new_l:N #1 {\alloc_reg:NnNN l {box} \tex_mathchardef:D #1} %</initex> % \end{macrocode} % When we run on top of \LaTeX, we just use its allocation % mechanism. % \begin{macrocode} -%<package>\let_new:NN \box_new:N \newbox -\def_new:Npn \box_new:c {\exp_args:Nc \box_new:N} +%<*package> +\cs_new:Npn \box_new:N #1 { + \chk_if_free_cs:N #1 + \newbox #1 +} +%</package> +% \end{macrocode} +% +% \begin{macrocode} +\cs_generate_variant:Nn \box_new:N {c} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} +%^^A \end{macro} % % \begin{macro}{\if_hbox:N} % \begin{macro}{\if_vbox:N} @@ -500,97 +533,97 @@ % The primitives for testing if a \m{box} is empty/void or which % type of box it is. % \begin{macrocode} -\let_new:NN \if_hbox:N \tex_ifhbox:D -\let_new:NN \if_vbox:N \tex_ifvbox:D -\let_new:NN \if_box_empty:N \tex_ifvoid:D +\cs_new_eq:NN \if_hbox:N \tex_ifhbox:D +\cs_new_eq:NN \if_vbox:N \tex_ifvbox:D +\cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % +% +% \begin{macro}{\box_if_horizontal_p:N,\box_if_horizontal_p:c} +% \begin{macro}{\box_if_vertical_p:N,\box_if_vertical_p:c} +% \begin{macro}[TF]{\box_if_horizontal:N,\box_if_horizontal:c} +% \begin{macro}[TF]{\box_if_vertical:N,\box_if_vertical:c} +% \begin{macrocode} +\prg_new_conditional:Nnn \box_if_horizontal:N {p,TF,T,F} { + \tex_ifhbox:D #1 \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_new_conditional:Nnn \box_if_vertical:N {p,TF,T,F} { + \tex_ifvbox:D #1 \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_generate_variant:Nn \box_if_horizontal_p:N {c} +\cs_generate_variant:Nn \box_if_horizontal:NTF {c} +\cs_generate_variant:Nn \box_if_horizontal:NT {c} +\cs_generate_variant:Nn \box_if_horizontal:NF {c} +\cs_generate_variant:Nn \box_if_vertical_p:N {c} +\cs_generate_variant:Nn \box_if_vertical:NTF {c} +\cs_generate_variant:Nn \box_if_vertical:NT {c} +\cs_generate_variant:Nn \box_if_vertical:NF {c} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\box_if_empty_p:N} % \begin{macro}{\box_if_empty_p:c} -% \begin{macro}{\box_if_empty:NTF} -% \begin{macro}{\box_if_empty:cTF} -% \begin{macro}{\box_if_empty:NT} -% \begin{macro}{\box_if_empty:cT} -% \begin{macro}{\box_if_empty:NF} -% \begin{macro}{\box_if_empty:cF} +% \begin{macro}[TF]{\box_if_empty:N} +% \begin{macro}[TF]{\box_if_empty:c} % Testing if a \m{box} is empty/void. % \begin{macrocode} -\def_new:Npn \box_if_empty_p:N #1{ - \if_box_empty:N #1 \c_true \else: \c_false \fi:} -\def_new:Npn \box_if_empty_p:c {\exp_args:Nc \box_if_empty_p:N} -\def_test_function_new:npn {box_if_empty:N}#1{\if_box_empty:N #1} -\def_new:Npn \box_if_empty:cTF {\exp_args:Nc \box_if_empty:NTF} -\def_new:Npn \box_if_empty:cT {\exp_args:Nc \box_if_empty:NT} -\def_new:Npn \box_if_empty:cF {\exp_args:Nc \box_if_empty:NF} +\prg_new_conditional:Nnn \box_if_empty:N {p,TF,T,F} { + \tex_ifvoid:D #1 \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_generate_variant:Nn \box_if_empty_p:N {c} +\cs_generate_variant:Nn \box_if_empty:NTF {c} +\cs_generate_variant:Nn \box_if_empty:NT {c} +\cs_generate_variant:Nn \box_if_empty:NF {c} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % -% \begin{macro}{\box_set_eq:NN} -% \begin{macro}{\box_set_eq:cN} -% \begin{macro}{\box_set_eq:Nc} -% \begin{macro}{\box_set_eq:cc} +% \begin{macro}{\box_set_eq:NN,\box_set_eq:cN, +% \box_set_eq:Nc,\box_set_eq:cc} % Assigning the contents of a box to be another box. % This clears the second box globally (that's how \TeX{} does it). % \begin{macrocode} -\def_new:Npn \box_set_eq:NN #1#2 {\tex_setbox:D #1 \tex_box:D #2} -\def_new:Npn \box_set_eq:cN {\exp_args:Nc \box_set_eq:NN} -\def_new:Npn \box_set_eq:Nc {\exp_args:NNc \box_set_eq:NN} -\def_new:Npn \box_set_eq:cc {\exp_args:Ncc \box_set_eq:NN} +\cs_new_nopar:Npn \box_set_eq:NN #1#2 {\tex_setbox:D #1 \tex_box:D #2} +\cs_generate_variant:Nn \box_set_eq:NN {cN,Nc,cc} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\box_gset_eq:NN} -% \begin{macro}{\box_gset_eq:cN} -% \begin{macro}{\box_gset_eq:Nc} -% \begin{macro}{\box_gset_eq:cc} +% \begin{macro}{\box_gset_eq:NN,\box_gset_eq:cN, +% \box_gset_eq:Nc,\box_gset_eq:cc} % Global version of the above. % \begin{macrocode} -\def_new:Npn \box_gset_eq:NN {\pref_global:D\box_set_eq:NN} -\def_new:Npn \box_gset_eq:cN {\exp_args:Nc \box_gset_eq:NN} -\def_new:Npn \box_gset_eq:Nc {\exp_args:NNc \box_gset_eq:NN} -\def_new:Npn \box_gset_eq:cc {\exp_args:Ncc \box_gset_eq:NN} +\cs_new_nopar:Npn \box_gset_eq:NN {\pref_global:D\box_set_eq:NN} +\cs_generate_variant:Nn \box_gset_eq:NN {cN,Nc,cc} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\R_last_box} +% \begin{macro}{\l_last_box} % A different name for this read-only primitive. % \begin{macrocode} -\let_new:NN \R_last_box \tex_lastbox:D +\cs_new_eq:NN \l_last_box \tex_lastbox:D % \end{macrocode} % \end{macro} % -% \begin{macro}{\box_set_to_last:N} -% \begin{macro}{\box_set_to_last:c} -% \begin{macro}{\box_gset_to_last:N} -% \begin{macro}{\box_gset_to_last:c} +% \begin{macro}{\box_set_to_last:N,\box_set_to_last:c} +% \begin{macro}{\box_gset_to_last:N,\box_gset_to_last:c} % Set a box to the previous box. % \begin{macrocode} -\def_new:Npn \box_set_to_last:N #1{\tex_setbox:D#1\R_last_box} -\def_new:Npn \box_set_to_last:c {\exp_args:Nc \box_set_to_last:N} -\def_new:Npn \box_gset_to_last:N {\pref_global:D \box_set_to_last:N} -\def_new:Npn \box_gset_to_last:c {\exp_args:Nc \box_gset_to_last:N} +\cs_new_nopar:Npn \box_set_to_last:N #1{\tex_setbox:D#1\l_last_box} +\cs_generate_variant:Nn \box_set_to_last:N {c} +\cs_new_nopar:Npn \box_gset_to_last:N {\pref_global:D \box_set_to_last:N} +\cs_generate_variant:Nn \box_gset_to_last:N {c} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\box_move_left:nn} % \begin{macro}{\box_move_right:nn} @@ -598,89 +631,73 @@ % \begin{macro}{\box_move_down:nn} % Move box material in different directions. % \begin{macrocode} -\def_long_new:Npn \box_move_left:nn #1#2{\tex_moveleft:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_right:nn #1#2{\tex_moveright:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_up:nn #1#2{\tex_raise:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_down:nn #1#2{\tex_lower:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_left:nn #1#2{\tex_moveleft:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_right:nn #1#2{\tex_moveright:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_up:nn #1#2{\tex_raise:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_down:nn #1#2{\tex_lower:D\dim_eval:n{#1}{#2}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\box_clear:N} -% \begin{macro}{\box_clear:c} -% \begin{macro}{\box_gclear:N} -% \begin{macro}{\box_gclear:c} +% \begin{macro}{\box_clear:N,\box_clear:c} +% \begin{macro}{\box_gclear:N,\box_gclear:c} % Clear a \m{box} register. % \begin{macrocode} -\def_new:Npn \box_clear:N #1{\box_set_eq:NN #1 \c_empty_box } -\def_new:Npn \box_clear:c {\exp_args:Nc \box_clear:N } -\def_new:Npn \box_gclear:N {\pref_global:D\box_clear:N} -\def_new:Npn \box_gclear:c {\exp_args:Nc \box_gclear:c } +\cs_new_nopar:Npn \box_clear:N #1{\box_set_eq:NN #1 \c_empty_box } +\cs_generate_variant:Nn \box_clear:N {c} +\cs_new_nopar:Npn \box_gclear:N {\pref_global:D\box_clear:N} +\cs_generate_variant:Nn \box_gclear:N {c} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % -% \begin{macro}{\box_ht:N} -% \begin{macro}{\box_ht:c} -% \begin{macro}{\box_dp:N} -% \begin{macro}{\box_dp:c} -% \begin{macro}{\box_wd:n} -% \begin{macro}{\box_wd:c} +% \begin{macro}{\box_ht:N,\box_ht:c} +% \begin{macro}{\box_dp:N,\box_dp:c} +% \begin{macro}{\box_wd:N,\box_wd:c} % Accessing the height, depth, and width of a \m{box} register. % \begin{macrocode} -\let_new:NN \box_ht:N \tex_ht:D -\def_new:Npn \box_ht:c {\exp_args:Nc \box_ht:N} -\let_new:NN \box_dp:N \tex_dp:D -\def_new:Npn \box_dp:c {\exp_args:Nc \box_dp:N} -\let_new:NN \box_wd:N \tex_wd:D -\def_new:Npn \box_wd:c {\exp_args:Nc \box_wd:N} +\cs_new_eq:NN \box_ht:N \tex_ht:D +\cs_new_eq:NN \box_dp:N \tex_dp:D +\cs_new_eq:NN \box_wd:N \tex_wd:D +\cs_generate_variant:Nn \box_ht:N {c} +\cs_generate_variant:Nn \box_dp:N {c} +\cs_generate_variant:Nn \box_wd:N {c} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\box_use_clear:N} -% \begin{macro}{\box_use_clear:c} -% \begin{macro}{\box_use:N} -% \begin{macro}{\box_use:c} -% Using a \m{box}. This is just \TeX{} primitives with meaningful +% \begin{macro}{\box_use_clear:N,\box_use_clear:c} +% \begin{macro}{\box_use:N,\box_use:c} +% Using a \m{box}. These are just \TeX{} primitives with meaningful % names. % \begin{macrocode} -\let_new:NN \box_use_clear:N \tex_box:D -\def_new:Npn \box_use_clear:c {\exp_args:Nc \box_use_clear:N} -\let_new:NN \box_use:N \tex_copy:D -\def_new:Npn \box_use:c {\exp_args:Nc \box_use:N} +\cs_new_eq:NN \box_use_clear:N \tex_box:D +\cs_generate_variant:Nn \box_use_clear:N {c} +\cs_new_eq:NN \box_use:N \tex_copy:D +\cs_generate_variant:Nn \box_use:N {c} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\box_show:N} -% \begin{macro}{\box_show:c} +% \begin{macro}{\box_show:N,\box_show:c} % Show the contents of a box and write it into the log file. % \begin{macrocode} -\let:NN \box_show:N \tex_showbox:D -\def_new:Npn \box_show:c {\exp_args:Nc \box_show:N} +\cs_set_eq:NN \box_show:N \tex_showbox:D +\cs_generate_variant:Nn \box_show:N {c} % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\c_empty_box} % \begin{macro}{\l_tmpa_box} % \begin{macro}{\l_tmpb_box} % We allocate some \m{box} registers here (and borrow a few from \LaTeX). % \begin{macrocode} -%<package>\let:NN \c_empty_box \voidb@x -%<package>\let_new:NN \l_tmpa_box \@tempboxa +%<package>\cs_set_eq:NN \c_empty_box \voidb@x +%<package>\cs_new_eq:NN \l_tmpa_box \@tempboxa %<initex>\box_new:N \c_empty_box %<initex>\box_new:N \l_tmpa_box \box_new:N \l_tmpb_box @@ -690,66 +707,56 @@ % \end{macro} % % -% \subsubsection{Vertical boxes} +% \subsection{Vertical boxes} % % % \begin{macro}{\vbox:n} % Put a vertical box directly into the input stream. % \begin{macrocode} -\def_new:Npn \vbox:n {\tex_vbox:D \scan_stop:} +\cs_new_nopar:Npn \vbox:n {\tex_vbox:D \scan_stop:} % \end{macrocode} % \end{macro} % -% \begin{macro}{\vbox_set:Nn} -% \begin{macro}{\vbox_set:cn} -% \begin{macro}{\vbox_gset:Nn} -% \begin{macro}{\vbox_gset:cn} +% \begin{macro}{\vbox_set:Nn,\vbox_set:cn} +% \begin{macro}{\vbox_gset:Nn,\vbox_gset:cn} % Storing material in a vertical box with a natural height. % \begin{macrocode} -\def_long_new:Npn \vbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_vbox:D {#2}} -\def_new:Npn \vbox_set:cn {\exp_args:Nc \vbox_set:Nn} -\def_new:Npn \vbox_gset:Nn {\pref_global:D \vbox_set:Nn} -\def_new:Npn \vbox_gset:cn {\exp_args:Nc \vbox_gset:Nn} +\cs_new:Npn \vbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_vbox:D {#2}} +\cs_generate_variant:Nn \vbox_set:Nn {cn} +\cs_new_nopar:Npn \vbox_gset:Nn {\pref_global:D \vbox_set:Nn} +\cs_generate_variant:Nn \vbox_gset:Nn {cn} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\vbox_set_to_ht:Nnn} -% \begin{macro}{\vbox_set_to_ht:cnn} -% \begin{macro}{\vbox_gset_to_ht:Nnn} -% \begin{macro}{\vbox_gset_to_ht:cnn} -% \begin{macro}{\vbox_gset_to_ht:ccn} +% \begin{macro}{\vbox_set_to_ht:Nnn,\vbox_set_to_ht:cnn} +% \begin{macro}{\vbox_gset_to_ht:Nnn,\vbox_gset_to_ht:cnn,\vbox_gset_to_ht:ccn} % Storing material in a vertical box with a specified height. % \begin{macrocode} -\def_long_new:Npn \vbox_set_to_ht:Nnn #1#2#3 { - \tex_setbox:D #1 \tex_vbox:D to #2 {#3}} -\def_new:Npn \vbox_set_to_ht:cnn{\exp_args:Nc \vbox_set_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:Nnn {\pref_global:D \vbox_set_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:cnn{\exp_args:Nc \vbox_gset_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:ccn {\exp_args:Ncc \vbox_gset_to_ht:Nnn} +\cs_new:Npn \vbox_set_to_ht:Nnn #1#2#3 { + \tex_setbox:D #1 \tex_vbox:D to #2 {#3} +} +\cs_generate_variant:Nn \vbox_set_to_ht:Nnn {cnn} +\cs_new_nopar:Npn \vbox_gset_to_ht:Nnn { \pref_global:D \vbox_set_to_ht:Nnn } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn {cnn,ccn} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % % \begin{macro}{\vbox_set_inline_begin:N} % \begin{macro}{\vbox_set_inline_end:} % \begin{macro}{\vbox_gset_inline_begin:N} -% \begin{macro}{\vbox_set_inline_end:} +% \begin{macro}{\vbox_gset_inline_end:} % Storing material in a vertical box. This type is useful in % environment definitions. % \begin{macrocode} -\def_new:Npn \vbox_set_inline_begin:N #1 { +\cs_new_nopar:Npn \vbox_set_inline_begin:N #1 { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token } -\let_new:NN \vbox_set_inline_end: \c_group_end_token -\def_new:Npn \vbox_gset_inline_begin:N { +\cs_new_eq:NN \vbox_set_inline_end: \c_group_end_token +\cs_new_nopar:Npn \vbox_gset_inline_begin:N { \pref_global:D \vbox_set_inline_begin:N } -\let_new:NN \vbox_gset_inline_end: \c_group_end_token +\cs_new_eq:NN \vbox_gset_inline_end: \c_group_end_token % \end{macrocode} % \end{macro} % \end{macro} @@ -761,8 +768,8 @@ % \begin{macro}{\vbox_to_zero:n} % Put a vertical box directly into the input stream. % \begin{macrocode} -\def_long_new:Npn \vbox_to_ht:nn #1#2{\tex_vbox:D to \dim_eval:n{#1}{#2}} -\def_long_new:Npn \vbox_to_zero:n #1 {\tex_vbox:D to \c_zero_dim {#1}} +\cs_new:Npn \vbox_to_ht:nn #1#2{\tex_vbox:D to \dim_eval:n{#1}{#2}} +\cs_new:Npn \vbox_to_zero:n #1 {\tex_vbox:D to \c_zero_dim {#1}} % \end{macrocode} % \end{macro} % \end{macro} @@ -770,130 +777,111 @@ % \begin{macro}{\vbox_set_split_to_ht:NNn} % Splitting a vertical box in two. % \begin{macrocode} -\def_new:Npn \vbox_set_split_to_ht:NNn #1#2#3{ +\cs_new_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3{ \tex_setbox:D #1 \tex_vsplit:D #2 to #3 } % \end{macrocode} % \end{macro} % -% \begin{macro}{\vbox_unpack:N} -% \begin{macro}{\vbox_unpack:c} -% \begin{macro}{\vbox_unpack_clear:N} -% \begin{macro}{\vbox_unpack_clear:c} +% \begin{macro}{\vbox_unpack:N,\vbox_unpack:c} +% \begin{macro}{\vbox_unpack_clear:N,\vbox_unpack_clear:c} % Unpacking a box and if requested also clear it. % \begin{macrocode} -\let_new:NN \vbox_unpack:N \tex_unvcopy:D -\def_new:Npn \vbox_unpack:c {\exp_args:Nc \vbox_unpack:N} -\let_new:NN \vbox_unpack_clear:N \tex_unvbox:D -\def_new:Npn \vbox_unpack_clear:c {\exp_args:Nc \vbox_unpack_clear:N} +\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D +\cs_generate_variant:Nn \vbox_unpack:N {c} +\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D +\cs_generate_variant:Nn \vbox_unpack_clear:N {c} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % % % % % -% \subsubsection{Horizontal boxes} +% \subsection{Horizontal boxes} % % % \begin{macro}{\hbox:n} % Put a horizontal box directly into the input stream. % \begin{macrocode} -\def_new:Npn \hbox:n {\tex_hbox:D \scan_stop:} +\cs_new_nopar:Npn \hbox:n {\tex_hbox:D \scan_stop:} % \end{macrocode} % \end{macro} % -% \begin{macro}{\hbox_set:Nn} -% \begin{macro}{\hbox_set:cn} -% \begin{macro}{\hbox_gset:Nn} -% \begin{macro}{\hbox_gset:cn} +% \begin{macro}{\hbox_set:Nn,\hbox_set:cn} +% \begin{macro}{\hbox_gset:Nn,\hbox_gset:cn} % Assigning the contents of a box to be another box. % This clears the second box globally (that's how \TeX{} does it). % \begin{macrocode} -\def_long_new:Npn \hbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_hbox:D {#2}} -\def_new:Npn \hbox_set:cn {\exp_args:Nc \hbox_set:Nn} -\def_new:Npn \hbox_gset:Nn {\pref_global:D \hbox_set:Nn} -\def_new:Npn \hbox_gset:cn {\exp_args:Nc \hbox_gset:Nn} +\cs_new:Npn \hbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_hbox:D {#2}} +\cs_generate_variant:Nn \hbox_set:Nn {cn} +\cs_new_nopar:Npn \hbox_gset:Nn {\pref_global:D \hbox_set:Nn} +\cs_generate_variant:Nn \hbox_gset:Nn {cn} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\hbox_set_to_wd:Nnn} -% \begin{macro}{\hbox_set_to_wd:cnn} -% \begin{macro}{\hbox_gset_to_wd:Nnn} -% \begin{macro}{\hbox_gset_to_wd:cnn} +% \begin{macro}{\hbox_set_to_wd:Nnn,\hbox_set_to_wd:cnn} +% \begin{macro}{\hbox_gset_to_wd:Nnn,\hbox_gset_to_wd:cnn} % Storing material in a horizontal box with a specified width. % \begin{macrocode} -\def_long_new:Npn \hbox_set_to_wd:Nnn #1#2#3 { - \tex_setbox:D #1 \tex_hbox:D to \dim_eval:n{#2} {#3}} -\def_new:Npn \hbox_set_to_wd:cnn{\exp_args:Nc \hbox_set_to_wd:Nnn } -\def_new:Npn \hbox_gset_to_wd:Nnn {\pref_global:D \hbox_set_to_wd:Nnn } -\def_new:Npn \hbox_gset_to_wd:cnn{\exp_args:Nc \hbox_gset_to_wd:Nnn } +\cs_new:Npn \hbox_set_to_wd:Nnn #1#2#3 { + \tex_setbox:D #1 \tex_hbox:D to \dim_eval:n{#2} {#3} +} +\cs_generate_variant:Nn \hbox_set_to_wd:Nnn {cnn} +\cs_new_nopar:Npn \hbox_gset_to_wd:Nnn {\pref_global:D \hbox_set_to_wd:Nnn } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn {cnn} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % -% \begin{macro}{\hbox_set_inline_begin:N} -% \begin{macro}{\hbox_set_inline_begin:c} -% \begin{macro}{\hbox_set_inline_end:} -% \begin{macro}{\hbox_gset_inline_begin:N} -% \begin{macro}{\hbox_gset_inline_begin:c} +% \begin{macro}{\hbox_set_inline_begin:N,\hbox_set_inline_begin:c} % \begin{macro}{\hbox_set_inline_end:} +% \begin{macro}{\hbox_gset_inline_begin:N,\hbox_gset_inline_begin:c} +% \begin{macro}{\hbox_gset_inline_end:} % Storing material in a horizontal box. This type is useful in % environment definitions. % \begin{macrocode} -\def_new:Npn \hbox_set_inline_begin:N #1 { - \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token } -\def:Npn \hbox_set_inline_begin:c {\exp_args:Nc - \hbox_set_inline_begin:N} -\let_new:NN \hbox_set_inline_end: \c_group_end_token -\def_new:Npn \hbox_gset_inline_begin:N { - \pref_global:D \hbox_set_inline_begin:N } -\def:Npn \hbox_gset_inline_begin:c {\exp_args:Nc - \hbox_gset_inline_begin:N } -\let_new:NN \hbox_gset_inline_end: \c_group_end_token +\cs_new_nopar:Npn \hbox_set_inline_begin:N #1 { + \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token +} +\cs_generate_variant:Nn \hbox_set_inline_begin:N {c} +\cs_new_eq:NN \hbox_set_inline_end: \c_group_end_token +\cs_new_nopar:Npn \hbox_gset_inline_begin:N { + \pref_global:D \hbox_set_inline_begin:N +} +\cs_generate_variant:Nn \hbox_gset_inline_begin:N {c} +\cs_new_eq:NN \hbox_gset_inline_end: \c_group_end_token % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\hbox_to_wd:nn} % \begin{macro}{\hbox_to_zero:n} % Put a horizontal box directly into the input stream. % \begin{macrocode} -\def_long_new:Npn \hbox_to_wd:nn #1#2 {\tex_hbox:D to #1 {#2}} -\def_long_new:Npn \hbox_to_zero:n #1 {\tex_hbox:D to \c_zero_skip {#1}} +\cs_new:Npn \hbox_to_wd:nn #1#2 {\tex_hbox:D to #1 {#2}} +\cs_new:Npn \hbox_to_zero:n #1 {\tex_hbox:D to \c_zero_skip {#1}} % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\hbox_unpack:N} -% \begin{macro}{\hbox_unpack:c} -% \begin{macro}{\hbox_unpack_clear:N} -% \begin{macro}{\hbox_unpack_clear:c} +% \begin{macro}{\hbox_unpack:N,\hbox_unpack:c} +% \begin{macro}{\hbox_unpack_clear:N,\hbox_unpack_clear:c} % Unpacking a box and if requested also clear it. % \begin{macrocode} -\let_new:NN \hbox_unpack:N \tex_unhcopy:D -\def_new:Npn \hbox_unpack:c {\exp_args:Nc \hbox_unpack:N} -\let_new:NN \hbox_unpack_clear:N \tex_unhbox:D -\def_new:Npn \hbox_unpack_clear:c {\exp_args:Nc \hbox_unpack_clear:N} +\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D +\cs_generate_variant:Nn \hbox_unpack:N {c} +\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D +\cs_generate_variant:Nn \hbox_unpack_clear:N {c} % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % % @@ -910,40 +898,15 @@ % % \begin{macrocode} %</initex|package> +% \end{macrocode} +% +% \begin{macrocode} %<*showmemory> \showMemUsage %</showmemory> % \end{macrocode} % -% \endinput -% -% $Log$ -% Revision 1.10 2006/03/20 18:26:34 braams -% Updated the copyright notice (2006) and demoted all implementation -% sections to subsections and so on to clean up the toc for source3.tex -% -% Revision 1.9 2006/01/19 22:30:30 morten -% Added functions for accessing \tex_lastbox:D and moving box material -% in the four directions. -% -% Revision 1.8 2005/12/27 16:04:12 morten -% Changed RCS information retrieval -% -% Revision 1.7 2005/10/27 23:11:12 morten -% Moved \if_hbox:N, \if_vbox:N and _if_box_empty:N here -% -% Revision 1.6 2005/04/25 16:15:17 morten -% Fixed \bgroup/\egroup and made it run under initex -% -% Revision 1.5 2005/04/06 22:35:33 braams -% Now we have register allocation fitted -% -% Revision 1.4 2005/03/26 21:08:12 morten -% Fix \c_zero -> \c_zero_skip -% -% Revision 1.3 2005/03/16 22:36:46 braams -% Added the tweaks necessary to be able to load with initex -% -% Revision 1.2 2005/03/11 21:31:07 braams -% Fixed the use of RCS information; added \StopEventually +% \end{implementation} +% \PrintIndex % +% \endinput |