diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-28 22:07:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-28 22:07:57 +0000 |
commit | 58716ee4be6eb8b578e9e7097971079d0e9d0b6a (patch) | |
tree | 04ad920aed8f772a75bad93e9ec399c067f44001 /Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx | |
parent | 0e9654fedc389811d7b81b1d05f8a4a986caec1c (diff) |
l3 (28jan19)
git-svn-id: svn://tug.org/texlive/trunk@49853 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx | 497 |
1 files changed, 356 insertions, 141 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 83fbbc8f593..38f13a49dcb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -1,6 +1,8 @@ % \iffalse meta-comment % -%% File: l3coffins.dtx Copyright (C) 2010-2019 The LaTeX3 Project +%% File: l3coffins.dtx +% +% Copyright (C) 2010-2019 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -41,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-01-13} +% \date{Released 2019-01-28} % % \maketitle % @@ -62,21 +64,29 @@ % initially empty. % \end{function} % -% \begin{function}[added = 2011-08-17]{\coffin_clear:N, \coffin_clear:c} +% \begin{function}[added = 2011-08-17, updated = 2019-01-21] +% { +% \coffin_clear:N, \coffin_clear:c, +% \coffin_gclear:N, \coffin_gclear:c +% } % \begin{syntax} % \cs{coffin_clear:N} \meta{coffin} % \end{syntax} -% Clears the content of the \meta{coffin} within the current \TeX{} -% group level. +% Clears the content of the \meta{coffin}. % \end{function} % -% \begin{function}[added = 2011-08-17] -% {\coffin_set_eq:NN, \coffin_set_eq:Nc, \coffin_set_eq:cN, \coffin_set_eq:cc} +% \begin{function}[added = 2011-08-17, updated = 2019-01-21] +% { +% \coffin_set_eq:NN, \coffin_set_eq:Nc, +% \coffin_set_eq:cN, \coffin_set_eq:cc +% \coffin_gset_eq:NN, \coffin_gset_eq:Nc, +% \coffin_gset_eq:cN, \coffin_gset_eq:cc +% } % \begin{syntax} % \cs{coffin_set_eq:NN} \meta{coffin_1} \meta{coffin_2} % \end{syntax} % Sets both the content and poles of \meta{coffin_1} equal to those -% of \meta{coffin_2} within the current \TeX\ group level. +% of \meta{coffin_2}. % \end{function} % % \begin{function}[EXP, pTF, added = 2012-06-20] @@ -94,7 +104,10 @@ % current \TeX\ group level. % % \begin{function}[added = 2011-08-17, updated = 2011-09-03] -% {\hcoffin_set:Nn, \hcoffin_set:cn} +% { +% \hcoffin_set:Nn, \hcoffin_set:cn, +% \hcoffin_gset:Nn, \hcoffin_gset:cn +% } % \begin{syntax} % \cs{hcoffin_set:Nn} \meta{coffin} \Arg{material} % \end{syntax} @@ -103,8 +116,11 @@ % then set up based on the size of the typeset material. % \end{function} % -% \begin{function}[added = 2011-09-10] -% {\hcoffin_set:Nw, \hcoffin_set:cw, \hcoffin_set_end:} +% \begin{function}[added = 2011-09-10, updated = 2019-01-21] +% { +% \hcoffin_set:Nw, \hcoffin_set:cw, \hcoffin_set_end:, +% \hcoffin_gset:Nw, \hcoffin_gset:cw, \hcoffin_gset_end: +% } % \begin{syntax} % \cs{hcoffin_set:Nw} \meta{coffin} \meta{material} \cs{hcoffin_set_end:} % \end{syntax} @@ -115,8 +131,11 @@ % environment in a coffin. % \end{function} % -% \begin{function}[added = 2011-08-17, updated = 2012-05-22] -% {\vcoffin_set:Nnn, \vcoffin_set:cnn} +% \begin{function}[added = 2011-08-17, updated = 2019-01-21] +% { +% \vcoffin_set:Nnn, \vcoffin_set:cnn, +% \vcoffin_gset:Nnn, \vcoffin_gset:cnn +% } % \begin{syntax} % \cs{vcoffin_set:Nnn} \meta{coffin} \Arg{width} \Arg{material} % \end{syntax} @@ -126,8 +145,11 @@ % size of the typeset material. % \end{function} % -% \begin{function}[added = 2011-09-10, updated = 2012-05-22] -% {\vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_set_end:} +% \begin{function}[added = 2011-09-10, updated = 2019-01-21] +% { +% \vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_set_end:, +% \vcoffin_gset:Nnw, \vcoffin_gset:cnw, \vcoffin_gset_end: +% } % \begin{syntax} % \cs{vcoffin_set:Nnw} \meta{coffin} \Arg{width} \meta{material} \cs{vcoffin_set_end:} % \end{syntax} @@ -139,8 +161,11 @@ % environment in a coffin. % \end{function} % -% \begin{function}[added = 2012-07-20] -% {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn} +% \begin{function}[added = 2012-07-20, updated = 2019-01-21] +% { +% \coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn, +% \coffin_gset_horizontal_pole:Nnn, \coffin_gset_horizontal_pole:cnn +% } % \begin{syntax} % \cs{coffin_set_horizontal_pole:Nnn} \meta{coffin} % ~~\Arg{pole} \Arg{offset} @@ -151,8 +176,11 @@ % \meta{offset} should be given as a dimension expression. % \end{function} % -% \begin{function}[added = 2012-07-20] -% {\coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn} +% \begin{function}[added = 2012-07-20, updated = 2019-01-21] +% { +% \coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn, +% \coffin_gset_vertical_pole:Nnn, \coffin_gset_vertical_pole:cnn +% } % \begin{syntax} % \cs{coffin_set_vertical_pole:Nnn} \meta{coffin} \Arg{pole} \Arg{offset} % \end{syntax} @@ -164,10 +192,12 @@ % % \section{Joining and using coffins} % -% \begin{function} +% \begin{function}[updated = 2019-01-22] % { % \coffin_attach:NnnNnnnn, \coffin_attach:cnnNnnnn, -% \coffin_attach:Nnncnnnn, \coffin_attach:cnncnnnn +% \coffin_attach:Nnncnnnn, \coffin_attach:cnncnnnn, +% \coffin_gattach:NnnNnnnn, \coffin_gattach:cnnNnnnn, +% \coffin_gattach:Nnncnnnn, \coffin_gattach:cnncnnnn % } % \begin{syntax} % \cs{coffin_attach:NnnNnnnn} @@ -188,10 +218,12 @@ % expressions. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2019-01-22] % { % \coffin_join:NnnNnnnn, \coffin_join:cnnNnnnn, -% \coffin_join:Nnncnnnn, \coffin_join:cnncnnnn +% \coffin_join:Nnncnnnn, \coffin_join:cnncnnnn, +% \coffin_gjoin:NnnNnnnn, \coffin_gjoin:cnnNnnnn, +% \coffin_gjoin:Nnncnnnn, \coffin_gjoin:cnncnnnn % } % \begin{syntax} % \cs{coffin_join:NnnNnnnn} @@ -324,6 +356,13 @@ % code and so should only be used for short-term storage. % \end{variable} % +% \begin{variable}[added = 2019-01-24]{\g_tmpa_coffin, \g_tmpb_coffin} +% Scratch coffins 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} +% % \end{documentation} % % \begin{implementation} @@ -468,7 +507,7 @@ { \cs_if_exist:NTF #1 { - \cs_if_exist:cTF { l_@@_poles_ \@@_to_value:N #1 _prop } + \cs_if_exist:cTF { coffin ~ \@@_to_value:N #1 ~ poles } { \prg_return_true: } { \prg_return_false: } } @@ -496,7 +535,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_clear:N, \coffin_clear:c} +% \begin{macro} +% { +% \coffin_clear:N, \coffin_clear:c, +% \coffin_gclear:N, \coffin_gclear:c +% } % Clearing coffins means emptying the box and resetting all of the % structures. % \begin{macrocode} @@ -509,28 +552,33 @@ } } \cs_generate_variant:Nn \coffin_clear:N { c } +\cs_new_protected:Npn \coffin_gclear:N #1 + { + \@@_if_exist:NT #1 + { + \box_gclear:N #1 + \@@_greset_structure:N #1 + } + } +\cs_generate_variant:Nn \coffin_gclear:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\coffin_new:N, \coffin_new:c} % Creating a new coffin means making the underlying box and adding the -% data structures. These are created globally, as there is a need to -% avoid any strange effects if the coffin is created inside a group. -% This means that the usual rule about \cs[no-index]{l_\ldots} -% variables has to be broken. The \cs{debug_suspend:} and -% \cs{debug_resume:} functions prevent these checks. They also -% prevent \cs{prop_clear_new:c} from writing useless information to +% data structures. The \cs{debug_suspend:} and \cs{debug_resume:} functions +% prevent \cs{prop_gclear_new:c} from writing useless information to % the log file. % \begin{macrocode} \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 \debug_suspend: - \prop_clear_new:c { l_@@_corners_ \@@_to_value:N #1 _prop } - \prop_clear_new:c { l_@@_poles_ \@@_to_value:N #1 _prop } - \prop_gset_eq:cN { l_@@_corners_ \@@_to_value:N #1 _prop } + \prop_gclear_new:c { coffin ~ \@@_to_value:N #1 ~ corners } + \prop_gclear_new:c { coffin ~ \@@_to_value:N #1 ~ poles } + \prop_gset_eq:cN { coffin ~ \@@_to_value:N #1 ~ corners } \c_@@_corners_prop - \prop_gset_eq:cN { l_@@_poles_ \@@_to_value:N #1 _prop } + \prop_gset_eq:cN { coffin ~ \@@_to_value:N #1 ~ poles } \c_@@_poles_prop \debug_resume: } @@ -538,7 +586,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\hcoffin_set:Nn, \hcoffin_set:cn} +% \begin{macro} +% { +% \hcoffin_set:Nn, \hcoffin_set:cn, +% \hcoffin_gset:Nn, \hcoffin_gset:cn +% } % Horizontal coffins are relatively easy: set the appropriate box, % reset the structures then update the handle positions. % \begin{macrocode} @@ -551,16 +603,32 @@ \color_ensure_current: #2 } - \@@_reset_structure:N #1 - \@@_update_poles:N #1 - \@@_update_corners:N #1 + \@@_update:N #1 } } \cs_generate_variant:Nn \hcoffin_set:Nn { c } +\cs_new_protected:Npn \hcoffin_gset:Nn #1#2 + { + \@@_if_exist:NT #1 + { + \hbox_gset:Nn #1 + { + \color_ensure_current: + #2 + } + \@@_gupdate:N #1 + } + } +\cs_generate_variant:Nn \hcoffin_gset:Nn { c } % \end{macrocode} % \end{macro} % -% \begin{macro}{\vcoffin_set:Nnn, \vcoffin_set:cnn} +% \begin{macro} +% { +% \vcoffin_set:Nnn, \vcoffin_set:cnn, +% \vcoffin_gset:Nnn, \vcoffin_gset:cnn +% } +% \begin{macro}{\@@_set_vertical:NnnNN} % Setting vertical coffins is more complex. First, the material is % typeset with a given width. The default handles and poles are set as % for a horizontal coffin, before finding the top baseline using a @@ -571,9 +639,21 @@ % \begin{macrocode} \cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3 { + \@@_set_vertical:NnnNN #1 {#2} {#3} + \vbox_set:Nn \@@_update:N + } +\cs_generate_variant:Nn \vcoffin_set:Nnn { c } +\cs_new_protected:Npn \vcoffin_gset:Nnn #1#2#3 + { + \@@_set_vertical:NnnNN #1 {#2} {#3} + \vbox_gset:Nn \@@_gupdate:N + } +\cs_generate_variant:Nn \vcoffin_gset:Nnn { c } +\cs_new_protected:Npn \@@_set_vertical:NnnNN #1#2#3#4#5 + { \@@_if_exist:NT #1 { - \vbox_set:Nn #1 + #4 #1 { \dim_set:Nn \tex_hsize:D {#2} %<*package> @@ -582,9 +662,7 @@ %</package> #3 } - \@@_reset_structure:N #1 - \@@_update_poles:N #1 - \@@_update_corners:N #1 + #5 #1 \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } \@@_set_pole:Nnx #1 { T } { @@ -599,12 +677,13 @@ \box_clear:N \l_@@_internal_box } } -\cs_generate_variant:Nn \vcoffin_set:Nnn { c } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\hcoffin_set:Nw, \hcoffin_set:cw} -% \begin{macro}{\hcoffin_set_end:} +% \begin{macro} +% {\hcoffin_set:Nw, \hcoffin_set:cw, \hcoffin_gset:Nw, \hcoffin_gset:cw} +% \begin{macro}{\hcoffin_set_end:, \hcoffin_gset_end:} % These are the \enquote{begin}/\enquote{end} versions of the above: % watch the grouping! % \begin{macrocode} @@ -616,38 +695,64 @@ \cs_set_protected:Npn \hcoffin_set_end: { \hbox_set_end: - \@@_reset_structure:N #1 - \@@_update_poles:N #1 - \@@_update_corners:N #1 + \@@_update:N #1 } } } -\cs_new_protected:Npn \hcoffin_set_end: { } \cs_generate_variant:Nn \hcoffin_set:Nw { c } +\cs_new_protected:Npn \hcoffin_gset:Nw #1 + { + \@@_if_exist:NT #1 + { + \hbox_gset:Nw #1 \color_ensure_current: + \cs_set_protected:Npn \hcoffin_gset_end: + { + \hbox_gset_end: + \@@_gupdate:N #1 + } + } + } +\cs_generate_variant:Nn \hcoffin_gset:Nw { c } +\cs_new_protected:Npn \hcoffin_set_end: { } +\cs_new_protected:Npn \hcoffin_gset_end: { } % \end{macrocode} +% \end{macro} +% \end{macro} % -% \end{macro}\end{macro} -% -% \begin{macro}{\vcoffin_set:Nnw, \vcoffin_set:cnw} -% \begin{macro}{\vcoffin_set_end:} +% \begin{macro} +% {\vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_gset:Nnw, \vcoffin_gset:cnw} +% \begin{macro}{\@@_set_vertical:NnNNNNw} +% \begin{macro}{\vcoffin_set_end:, \vcoffin_gset_end:} % The same for vertical coffins. % \begin{macrocode} \cs_new_protected:Npn \vcoffin_set:Nnw #1#2 { + \@@_set_vertical:NnNNNNw #1 {#2} \vbox_set:Nw + \vcoffin_set_end: + \vbox_set_end: \@@_update:N + } +\cs_generate_variant:Nn \vcoffin_set:Nnw { c } +\cs_new_protected:Npn \vcoffin_gset:Nnw #1#2 + { + \@@_set_vertical:NnNNNNw #1 {#2} \vbox_gset:Nw + \vcoffin_gset_end: + \vbox_gset_end: \@@_gupdate:N + } +\cs_generate_variant:Nn \vcoffin_gset:Nnw { c } +\cs_new_protected:Npn \@@_set_vertical:NnNNNNw #1#2#3#4#5#6 + { \@@_if_exist:NT #1 { - \vbox_set:Nw #1 + #3 #1 \dim_set:Nn \tex_hsize:D {#2} %<*package> \dim_set_eq:NN \linewidth \tex_hsize:D \dim_set_eq:NN \columnwidth \tex_hsize:D %</package> - \cs_set_protected:Npn \vcoffin_set_end: + \cs_set_protected:Npn #4 { - \vbox_set_end: - \@@_reset_structure:N #1 - \@@_update_poles:N #1 - \@@_update_corners:N #1 + #5 + #6 #1 \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } \@@_set_pole:Nnx #1 { T } { @@ -664,15 +769,16 @@ } } \cs_new_protected:Npn \vcoffin_set_end: { } -\cs_generate_variant:Nn \vcoffin_set:Nnw { c } +\cs_new_protected:Npn \vcoffin_gset_end: { } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro} % { % \coffin_set_eq:NN, \coffin_set_eq:Nc, -% \coffin_set_eq:cN, \coffin_set_eq:cc +% \coffin_gset_eq:cN, \coffin_gset_eq:cc % } % Setting two coffins equal is just a wrapper around other functions. % \begin{macrocode} @@ -681,10 +787,25 @@ \@@_if_exist:NT #1 { \box_set_eq:NN #1 #2 - \@@_set_eq_structure:NN #1 #2 + \prop_set_eq:cc { coffin ~ \@@_to_value:N #1 ~ corners } + { coffin ~ \@@_to_value:N #2 ~ corners } + \prop_set_eq:cc { coffin ~ \@@_to_value:N #1 ~ poles } + { coffin ~ \@@_to_value:N #2 ~ poles } } } \cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc } +\cs_new_protected:Npn \coffin_gset_eq:NN #1#2 + { + \@@_if_exist:NT #1 + { + \box_gset_eq:NN #1 #2 + \prop_gset_eq:cc { coffin ~ \@@_to_value:N #1 ~ corners } + { coffin ~ \@@_to_value:N #2 ~ corners } + \prop_gset_eq:cc { coffin ~ \@@_to_value:N #1 ~ poles } + { coffin ~ \@@_to_value:N #2 ~ poles } + } + } +\cs_generate_variant:Nn \coffin_gset_eq:NN { c , Nc , cc } % \end{macrocode} % \end{macro} % @@ -698,7 +819,6 @@ % yet. % \begin{macrocode} \coffin_new:N \c_empty_coffin -\tex_setbox:D \c_empty_coffin = \tex_hbox:D { } \coffin_new:N \l_@@_aligned_coffin \coffin_new:N \l_@@_aligned_internal_coffin % \end{macrocode} @@ -706,11 +826,14 @@ % \end{variable} % \end{variable} % -% \begin{variable}{\l_tmpa_coffin, \l_tmpb_coffin} +% \begin{variable} +% {\l_tmpa_coffin, \l_tmpb_coffin, \g_tmpa_coffin, \g_tmpb_coffin} % The usual scratch space. % \begin{macrocode} \coffin_new:N \l_tmpa_coffin \coffin_new:N \l_tmpb_coffin +\coffin_new:N \g_tmpa_coffin +\coffin_new:N \g_tmpb_coffin % \end{macrocode} % \end{variable} % @@ -742,7 +865,7 @@ \cs_new_protected:Npn \@@_get_pole:NnN #1#2#3 { \prop_get:cnNF - { l_@@_poles_ \@@_to_value:N #1 _prop } {#2} #3 + { coffin ~ \@@_to_value:N #1 ~ poles } {#2} #3 { \__kernel_msg_error:nnxx { kernel } { unknown-coffin-pole } { \exp_not:n {#2} } { \token_to_str:N #1 } @@ -752,43 +875,38 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_reset_structure:N} +% \begin{macro}{\@@_reset_structure:N, \@@_greset_structure:N} % Resetting the structure is a simple copy job. % \begin{macrocode} \cs_new_protected:Npn \@@_reset_structure:N #1 { - \prop_set_eq:cN { l_@@_corners_ \@@_to_value:N #1 _prop } + \prop_set_eq:cN { coffin ~ \@@_to_value:N #1 ~ corners } \c_@@_corners_prop - \prop_set_eq:cN { l_@@_poles_ \@@_to_value:N #1 _prop } + \prop_set_eq:cN { coffin ~ \@@_to_value:N #1 ~ poles } \c_@@_poles_prop } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_set_eq_structure:NN, \@@_gset_eq_structure:NN} -% Setting coffin structures equal simply means copying the property -% list. -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_eq_structure:NN #1#2 +\cs_new_protected:Npn \@@_greset_structure:N #1 { - \prop_set_eq:cc { l_@@_corners_ \@@_to_value:N #1 _prop } - { l_@@_corners_ \@@_to_value:N #2 _prop } - \prop_set_eq:cc { l_@@_poles_ \@@_to_value:N #1 _prop } - { l_@@_poles_ \@@_to_value:N #2 _prop } - } -\cs_new_protected:Npn \@@_gset_eq_structure:NN #1#2 - { - \prop_gset_eq:cc { l_@@_corners_ \@@_to_value:N #1 _prop } - { l_@@_corners_ \@@_to_value:N #2 _prop } - \prop_gset_eq:cc { l_@@_poles_ \@@_to_value:N #1 _prop } - { l_@@_poles_ \@@_to_value:N #2 _prop } + \prop_gset_eq:cN { coffin ~ \@@_to_value:N #1 ~ corners } + \c_@@_corners_prop + \prop_gset_eq:cN { coffin ~ \@@_to_value:N #1 ~ poles } + \c_@@_poles_prop } % \end{macrocode} % \end{macro} % % \begin{macro} -% {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn} -% \begin{macro}{\coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn} +% { +% \coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn, +% \coffin_gset_horizontal_pole:Nnn, \coffin_gset_horizontal_pole:cnn +% } +% \begin{macro}{\@@_set_horizontal_pole:NnnN} +% \begin{macro} +% { +% \coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn, +% \coffin_gset_vertical_pole:Nnn, \coffin_gset_vertical_pole:cnn +% } +% \begin{macro}{\@@_set_vertical_pole:NnnN} % \begin{macro}{\@@_set_pole:Nnn, \@@_set_pole:Nnx} % Setting the pole of a coffin at the user/designer level requires a % bit more care. The idea here is to provide a reasonable interface to @@ -796,10 +914,17 @@ % three-argument version is used internally to do a direct setting. % \begin{macrocode} \cs_new_protected:Npn \coffin_set_horizontal_pole:Nnn #1#2#3 + { \@@_set_horizontal_pole:NnnN #1 {#2} {#3} \prop_put:cnx } +\cs_generate_variant:Nn \coffin_set_horizontal_pole:Nnn { c } +\cs_new_protected:Npn \coffin_gset_horizontal_pole:Nnn #1#2#3 + { \@@_set_horizontal_pole:NnnN #1 {#2} {#3} \prop_gput:cnx } +\cs_generate_variant:Nn \coffin_gset_horizontal_pole:Nnn { c } +\cs_new_protected:Npn \@@_set_horizontal_pole:NnnN #1#2#3#4 { \@@_if_exist:NT #1 { - \@@_set_pole:Nnx #1 {#2} + #4 { coffin ~ \@@_to_value:N #1 ~ poles } + {#2} { { 0pt } { \dim_eval:n {#3} } { 1000pt } { 0pt } @@ -807,10 +932,17 @@ } } \cs_new_protected:Npn \coffin_set_vertical_pole:Nnn #1#2#3 + { \@@_set_vertical_pole:NnnN #1 {#2} {#3} \prop_put:cnx } +\cs_generate_variant:Nn \coffin_set_vertical_pole:Nnn { c } +\cs_new_protected:Npn \coffin_gset_vertical_pole:Nnn #1#2#3 + { \@@_set_vertical_pole:NnnN #1 {#2} {#3} \prop_gput:cnx } + \cs_generate_variant:Nn \coffin_gset_vertical_pole:Nnn { c } +\cs_new_protected:Npn \@@_set_vertical_pole:NnnN #1#2#3#4 { \@@_if_exist:NT #1 { - \@@_set_pole:Nnx #1 {#2} + #4 { coffin ~ \@@_to_value:N #1 ~ poles } + {#2} { { \dim_eval:n {#3} } { 0pt } { 0pt } { 1000pt } @@ -819,47 +951,81 @@ } \cs_new_protected:Npn \@@_set_pole:Nnn #1#2#3 { - \prop_put:cnn { l_@@_poles_ \@@_to_value:N #1 _prop } + \prop_put:cnn { coffin ~ \@@_to_value:N #1 ~ poles } {#2} {#3} } -\cs_generate_variant:Nn \coffin_set_horizontal_pole:Nnn { c } -\cs_generate_variant:Nn \coffin_set_vertical_pole:Nnn { c } \cs_generate_variant:Nn \@@_set_pole:Nnn { Nnx } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_update:N, \@@_gupdate:N} +% Simple shortcuts. +% \begin{macrocode} +\cs_new_protected:Npn \@@_update:N #1 + { + \@@_reset_structure:N #1 + \@@_update_corners:N #1 + \@@_update_poles:N #1 + } +\cs_new_protected:Npn \@@_gupdate:N #1 + { + \@@_greset_structure:N #1 + \@@_gupdate_corners:N #1 + \@@_gupdate_poles:N #1 + } +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\@@_update_corners:N} +% \begin{macro}{\@@_update_corners:N, \@@_gupdate_corners:N} +% \begin{macro}{\@@_update_corners:NN} +% \begin{macro}{\@@_update_corners:NNN} % Updating the corners of a coffin is straight-forward as at this stage % there can be no rotation. So the corners of the content are just those % of the underlying \TeX{} box. % \begin{macrocode} \cs_new_protected:Npn \@@_update_corners:N #1 + { \@@_update_corners:NN #1 \prop_put:Nnx } +\cs_new_protected:Npn \@@_gupdate_corners:N #1 + { \@@_update_corners:NN #1 \prop_gput:Nnx } +\cs_new_protected:Npn \@@_update_corners:NN #1#2 + { + \exp_args:Nc \@@_update_corners:NNN + { coffin ~ \@@_to_value:N #1 ~ corners } + #1 #2 + } +\cs_new_protected:Npn \@@_update_corners:NNN #1#2#3 { - \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } + #3 #1 { tl } - { { 0pt } { \dim_eval:n { \box_ht:N #1 } } } - \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } + { { 0pt } { \dim_eval:n { \box_ht:N #2 } } } + #3 #1 { tr } { - { \dim_eval:n { \box_wd:N #1 } } - { \dim_eval:n { \box_ht:N #1 } } + { \dim_eval:n { \box_wd:N #2 } } + { \dim_eval:n { \box_ht:N #2 } } } - \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } + #3 #1 { bl } - { { 0pt } { \dim_eval:n { -\box_dp:N #1 } } } - \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } + { { 0pt } { \dim_eval:n { -\box_dp:N #2 } } } + #3 #1 { br } { - { \dim_eval:n { \box_wd:N #1 } } - { \dim_eval:n { -\box_dp:N #1 } } + { \dim_eval:n { \box_wd:N #2 } } + { \dim_eval:n { -\box_dp:N #2 } } } } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}{\@@_update_poles:N} +% \begin{macro}{\@@_update_poles:N, \@@_gupdate_poles:N} +% \begin{macro}{\@@_update_poles:NN} +% \begin{macro}{\@@_update_poles:NNN} % This function is called when a coffin is set, and updates the poles to % reflect the nature of size of the box. Thus this function only alters % poles where the default position is dependent on the size of the box. @@ -867,41 +1033,53 @@ % coffins. % \begin{macrocode} \cs_new_protected:Npn \@@_update_poles:N #1 + { \@@_update_poles:NN #1 \prop_put:Nnx } +\cs_new_protected:Npn \@@_gupdate_poles:N #1 + { \@@_update_poles:NN #1 \prop_gput:Nnx } +\cs_new_protected:Npn \@@_update_poles:NN #1#2 + { + \exp_args:Nc \@@_update_poles:NNN + { coffin ~ \@@_to_value:N #1 ~ poles } + #1 #2 + } +\cs_new_protected:Npn \@@_update_poles:NNN #1#2#3 { - \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } { hc } + #3 #1 { hc } { - { \dim_eval:n { 0.5 \box_wd:N #1 } } + { \dim_eval:n { 0.5 \box_wd:N #2 } } { 0pt } { 0pt } { 1000pt } } - \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } { r } + #3 #1 { r } { - { \dim_eval:n { \box_wd:N #1 } } + { \dim_eval:n { \box_wd:N #2 } } { 0pt } { 0pt } { 1000pt } } - \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } { vc } + #3 #1 { vc } { { 0pt } - { \dim_eval:n { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } } + { \dim_eval:n { ( \box_ht:N #2 - \box_dp:N #2 ) / 2 } } { 1000pt } { 0pt } } - \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } { t } + #3 #1 { t } { { 0pt } - { \dim_eval:n { \box_ht:N #1 } } + { \dim_eval:n { \box_ht:N #2 } } { 1000pt } { 0pt } } - \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } { b } + #3 #1 { b } { { 0pt } - { \dim_eval:n { -\box_dp:N #1 } } + { \dim_eval:n { -\box_dp:N #2 } } { 1000pt } { 0pt } } } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Coffins: calculation of pole intersections} % @@ -1107,8 +1285,11 @@ % \begin{macro} % { % \coffin_join:NnnNnnnn, \coffin_join:cnnNnnnn, -% \coffin_join:Nnncnnnn , \coffin_join:cnncnnnn +% \coffin_join:Nnncnnnn, \coffin_join:cnncnnnn, +% \coffin_gjoin:NnnNnnnn, \coffin_gjoin:cnnNnnnn, +% \coffin_gjoin:Nnncnnnn, \coffin_gjoin:cnncnnnn % } +% \begin{macro}{\@@_join:NnnNnnnnN} % This command joins two coffins, using a horizontal and vertical pole % from each coffin and making an offset between the two. The result % is stored as the as a third coffin, which has all of its handles @@ -1117,6 +1298,18 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8 { + \@@_join:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} + \coffin_set_eq:NN + } +\cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } +\cs_new_protected:Npn \coffin_gjoin:NnnNnnnn #1#2#3#4#5#6#7#8 + { + \@@_join:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} + \coffin_gset_eq:NN + } +\cs_generate_variant:Nn \coffin_gjoin:NnnNnnnn { c , Nnnc , cnnc } +\cs_new_protected:Npn \@@_join:NnnNnnnnN #1#2#3#4#5#6#7#8#9 + { \@@_align:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin % \end{macrocode} @@ -1144,9 +1337,8 @@ \@@_reset_structure:N \l_@@_aligned_coffin \prop_clear:c { - l_@@_corners_ - \@@_to_value:N \l_@@_aligned_coffin - _prop + coffin ~ \@@_to_value:N \l_@@_aligned_coffin + \c_space_tl corners } \@@_update_poles:N \l_@@_aligned_coffin % \end{macrocode} @@ -1170,18 +1362,21 @@ { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } } \@@_update_vertical_poles:NNN #1 #4 \l_@@_aligned_coffin - \coffin_set_eq:NN #1 \l_@@_aligned_coffin + #9 #1 \l_@@_aligned_coffin } -\cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro} % { % \coffin_attach:NnnNnnnn, \coffin_attach:cnnNnnnn, -% \coffin_attach:Nnncnnnn, \coffin_attach:cnncnnnn +% \coffin_attach:Nnncnnnn, \coffin_attach:cnncnnnn, +% \coffin_gattach:NnnNnnnn, \coffin_gattach:cnnNnnnn, +% \coffin_gattach:Nnncnnnn, \coffin_gattach:cnncnnnn % } -% \begin{macro}{\coffin_attach_mark:NnnNnnnn} +% \begin{macro}{\@@_attach:NnnNnnnnN} +% \begin{macro}{\@@_attach_mark:NnnNnnnn} % A more simple version of the above, as it simply uses the size of the % first coffin for the new one. This means that the work here is rather % simplified compared to the above code. The function used when marking @@ -1190,6 +1385,18 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8 { + \@@_attach:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} + \coffin_set_eq:NN + } +\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { c , Nnnc , cnnc } +\cs_new_protected:Npn \coffin_gattach:NnnNnnnn #1#2#3#4#5#6#7#8 + { + \@@_gattach:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} + \coffin_gset_eq:NN + } +\cs_generate_variant:Nn \coffin_gattach:NnnNnnnn { c , Nnnc , cnnc } +\cs_new_protected:Npn \@@_attach:NnnNnnnnN #1#2#3#4#5#6#7#8#9 + { \@@_align:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin \box_set_ht:Nn \l_@@_aligned_coffin { \box_ht:N #1 } @@ -1198,10 +1405,10 @@ \@@_reset_structure:N \l_@@_aligned_coffin \prop_set_eq:cc { - l_@@_corners_ - \@@_to_value:N \l_@@_aligned_coffin _prop + coffin ~ \@@_to_value:N \l_@@_aligned_coffin + \c_space_tl corners } - { l_@@_corners_ \@@_to_value:N #1 _prop } + { coffin ~ \@@_to_value:N #1 ~ corners } \@@_update_poles:N \l_@@_aligned_coffin \@@_offset_poles:Nnn #1 { 0pt } { 0pt } \@@_offset_poles:Nnn #4 @@ -1209,7 +1416,7 @@ \@@_update_vertical_poles:NNN #1 #4 \l_@@_aligned_coffin \coffin_set_eq:NN #1 \l_@@_aligned_coffin } -\cs_new_protected:Npn \coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 +\cs_new_protected:Npn \@@_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 { \@@_align:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin @@ -1218,10 +1425,10 @@ \box_set_wd:Nn \l_@@_aligned_coffin { \box_wd:N #1 } \box_set_eq:NN #1 \l_@@_aligned_coffin } -\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { c , Nnnc , cnnc } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_align:NnnNnnnnN} % The internal function aligns the two coffins into a third one, but @@ -1270,7 +1477,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_offset_poles:Nnn #1#2#3 { - \prop_map_inline:cn { l_@@_poles_ \@@_to_value:N #1 _prop } + \prop_map_inline:cn { coffin ~ \@@_to_value:N #1 ~ poles } { \@@_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } } \cs_new_protected:Npn \@@_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 @@ -1299,15 +1506,15 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_offset_corners:Nnn #1#2#3 { - \prop_map_inline:cn { l_@@_corners_ \@@_to_value:N #1 _prop } + \prop_map_inline:cn { coffin ~ \@@_to_value:N #1 ~ corners } { \@@_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } } \cs_new_protected:Npn \@@_offset_corner:Nnnnn #1#2#3#4#5#6 { \prop_put:cnx { - l_@@_corners_ - \@@_to_value:N \l_@@_aligned_coffin _prop + coffin ~ \@@_to_value:N \l_@@_aligned_coffin + \c_space_tl corners } { #1 - #2 } { @@ -1367,6 +1574,14 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\c_@@_empty_coffin} +% An empty-but-horizontal coffin. +% \begin{macrocode} +\coffin_new:N \c_@@_empty_coffin +\tex_setbox:D \c_@@_empty_coffin = \tex_hbox:D { } +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\coffin_typeset:Nnnnn, \coffin_typeset:cnnnn} % Typesetting a coffin means aligning it with the current position, % which is done using a coffin with no content at all. As well as aligning to @@ -1375,7 +1590,7 @@ \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { \mode_leave_vertical: - \@@_align:NnnNnnnnN \c_empty_coffin { H } { l } + \@@_align:NnnNnnnnN \c_@@_empty_coffin { H } { l } #1 {#2} {#3} {#4} {#5} \l_@@_aligned_coffin \box_use_drop:N \l_@@_aligned_coffin } @@ -1506,7 +1721,7 @@ \rule { 1pt } { 1pt } %</package> } - \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} + \@@_attach_mark:NnnNnnnn #1 {#2} {#3} \l_@@_display_pole_coffin { hc } { vc } { 0pt } { 0pt } \hcoffin_set:Nn \l_@@_display_coord_coffin { @@ -1527,7 +1742,7 @@ { #3 #2 } \l_@@_internal_tl \quark_if_no_value:NTF \l_@@_internal_tl { - \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} + \@@_attach_mark:NnnNnnnn #1 {#2} {#3} \l_@@_display_coord_coffin { l } { vc } { 1pt } { 0pt } } @@ -1543,7 +1758,7 @@ } \cs_new_protected:Npn \@@_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 { - \coffin_attach_mark:NnnNnnnn #5 {#6} {#7} + \@@_attach_mark:NnnNnnnn #5 {#6} {#7} \l_@@_display_coord_coffin {#1} {#2} { #3 \l_@@_display_offset_dim } { #4 \l_@@_display_offset_dim } @@ -1576,7 +1791,7 @@ %</package> } \prop_set_eq:Nc \l_@@_display_poles_prop - { l_@@_poles_ \@@_to_value:N #1 _prop } + { coffin ~ \@@_to_value:N #1 ~ poles } \@@_get_pole:NnN #1 { H } \l_@@_pole_a_tl \@@_get_pole:NnN #1 { T } \l_@@_pole_b_tl \tl_if_eq:NNT \l_@@_pole_a_tl \l_@@_pole_b_tl @@ -1720,7 +1935,7 @@ } { \prop_map_function:cN - { l_@@_poles_ \@@_to_value:N #2 _prop } + { coffin ~ \@@_to_value:N #2 ~ poles } \msg_show_item_unbraced:nn } { } |