diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
commit | 134349701bddf7cbbacf6030c6b9f9838aff96fa (patch) | |
tree | ec1140c46e1c0347a671a6fa3cf8af5a79e95f93 /Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx | |
parent | f7855c12c18bb97b7b9e49ab685ee558d8c0b47b (diff) |
l3kernel 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27108 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 | 1587 |
1 files changed, 563 insertions, 1024 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 54575bde8ce..b4242b6d8ed 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -36,8 +36,8 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3coffins.dtx 3482 2012-03-03 18:48:06Z bruno $ - {L3 Experimental coffin code layer} +\GetIdInfo$Id: l3coffins.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Coffin code layer} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -94,10 +94,19 @@ % \begin{function}[added = 2011-08-17] % {\coffin_set_eq:NN, \coffin_set_eq:Nc, \coffin_set_eq:cN, \coffin_set_eq:cc} % \begin{syntax} -% \cs{coffin_set_eq:NN} \meta{coffin1} \meta{coffin2} +% \cs{coffin_set_eq:NN} \meta{coffin_1} \meta{coffin_2} % \end{syntax} -% Sets both the content and poles of \meta{coffin1} equal to those -% of \meta{coffin2} within the current \TeX\ group level. +% Sets both the content and poles of \meta{coffin_1} equal to those +% of \meta{coffin_2} within the current \TeX\ group level. +% \end{function} +% +% \begin{function}[EXP, pTF, added = 2012-06-20] +% {\coffin_if_exist:N, \coffin_if_exist:c} +% \begin{syntax} +% \cs{coffin_if_exist_p:N} \meta{box} +% \cs{coffin_if_exist:NTF} \meta{box} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{coffin} is currently defined. % \end{function} % % \section{Setting coffin content and poles} @@ -127,7 +136,7 @@ % environment in a coffin. % \end{function} % -% \begin{function}[added = 2011-08-17, updated = 2011-09-03] +% \begin{function}[added = 2011-08-17, updated = 2012-05-22] % {\vcoffin_set:Nnn, \vcoffin_set:cnn} % \begin{syntax} % \cs{vcoffin_set:Nnn} \meta{coffin} \Arg{width} \Arg{material} @@ -138,7 +147,7 @@ % size of the typeset material. % \end{function} % -% \begin{function}[added = 2011-09-10] +% \begin{function}[added = 2011-09-10, updated = 2012-05-22] % {\vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_set_end:} % \begin{syntax} % \cs{vcoffin_set:Nnw} \meta{coffin} \Arg{width} \meta{material} \cs{vcoffin_set_end:} @@ -180,42 +189,6 @@ % the \meta{coffin}. % \end{function} % -% \section{Coffin transformations} -% -% \begin{function}[added = 2011-09-02]{\coffin_resize:Nnn, \coffin_resize:cnn} -% \begin{syntax} -% \cs{coffin_resize:Nnn} \meta{coffin} \Arg{width} \Arg{total-height} -% \end{syntax} -% Resized the \meta{coffin} to \meta{width} and \meta{total-height}, -% both of which should be given as dimension expressions. These may -% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and -% \cs{Width}, which will evaluate to the appropriate dimensions of -% the \meta{coffin}. -% -% \textbf{This function is experimental.} -% \end{function} -% -% \begin{function}[added = 2011-09-02]{\coffin_rotate:Nn, \coffin_rotate:cn} -% \begin{syntax} -% \cs{coffin_rotate:Nn} \meta{coffin} \Arg{angle} -% \end{syntax} -% Rotates the \meta{coffin} by the given \meta{angle} (given in -% degrees counter-clockwise). This process will rotate both the -% coffin content and poles. Multiple rotations will not result in -% the bounding box of the coffin growing unnecessarily. -% \end{function} -% -% \begin{function}[added = 2011-09-02]{\coffin_scale:Nnn, \coffin_scale:cnn} -% \begin{syntax} -% \cs{coffin_scale:Nnn} \meta{coffin} \Arg{x-scale} \Arg{y-scale} -% \end{syntax} -% Scales the \meta{coffin} by a factors \meta{x-scale} and -% \meta{y-scale} in the horizontal and vertical directions, -% respectively. The two scale factors should be given as real numbers. -% -% \textbf{This function is experimental.} -% \end{function} -% % \section{Joining and using coffins} % % \begin{function} @@ -225,19 +198,19 @@ % } % \begin{syntax} % \cs{coffin_attach:NnnNnnnn} -% ~~\meta{coffin1} \Arg{coffin1-pole1} \Arg{coffin1-pole2} -% ~~\meta{coffin2} \Arg{coffin2-pole1} \Arg{coffin2-pole2} +% ~~\meta{coffin_1} \Arg{coffin_1-pole_1} \Arg{coffin_1-pole_2} +% ~~\meta{coffin_2} \Arg{coffin_2-pole_1} \Arg{coffin_2-pole_2} % ~~\Arg{x-offset} \Arg{y-offset} % \end{syntax} % This function attaches <coffin_2> to <coffin_1> such that the bounding box -% of \meta{coffin1} is not altered, \emph{i.e.}~\meta{coffin2} can +% of \meta{coffin_1} is not altered, \emph{i.e.}~\meta{coffin_2} can % protrude outside of the bounding box of the coffin. The alignment -% is carried out by first calculating \meta{handle1}, the -% point of intersection of \meta{coffin1-pole1} and -% \meta{coffin1-pole2}, and \meta{handle2}, the point of intersection -% of \meta{coffin2-pole1} and \meta{coffin2-pole2}. \meta{coffin2} is -% then attached to \meta{coffin1} such that the relationship between -% \meta{handle1} and \meta{handle2} is described by the \meta{x-offset} +% is carried out by first calculating \meta{handle_1}, the +% point of intersection of \meta{coffin_1-pole_1} and +% \meta{coffin_1-pole_2}, and \meta{handle_2}, the point of intersection +% of \meta{coffin_2-pole_1} and \meta{coffin_2-pole_2}. \meta{coffin_2} is +% then attached to \meta{coffin_1} such that the relationship between +% \meta{handle_1} and \meta{handle_2} is described by the \meta{x-offset} % and \meta{y-offset}. The two offsets should be given as dimension % expressions. % \end{function} @@ -249,19 +222,19 @@ % } % \begin{syntax} % \cs{coffin_join:NnnNnnnn} -% ~~\meta{coffin1} \Arg{coffin1-pole1} \Arg{coffin1-pole2} -% ~~\meta{coffin2} \Arg{coffin2-pole1} \Arg{coffin2-pole2} +% ~~\meta{coffin_1} \Arg{coffin_1-pole_1} \Arg{coffin_1-pole_2} +% ~~\meta{coffin_2} \Arg{coffin_2-pole_1} \Arg{coffin_2-pole_2} % ~~\Arg{x-offset} \Arg{y-offset} % \end{syntax} % This function joins <coffin_2> to <coffin_1> such that the bounding box -% of \meta{coffin1} may expand. The new bounding +% of \meta{coffin_1} may expand. The new bounding % box will cover the area containing the bounding boxes of the two % original coffins. The alignment is carried out by first calculating -% \meta{handle1}, the point of intersection of \meta{coffin1-pole1} and -% \meta{coffin1-pole2}, and \meta{handle2}, the point of intersection -% of \meta{coffin2-pole1} and \meta{coffin2-pole2}. \meta{coffin2} is -% then attached to \meta{coffin1} such that the relationship between -% \meta{handle1} and \meta{handle2} is described by the \meta{x-offset} +% \meta{handle_1}, the point of intersection of \meta{coffin_1-pole_1} and +% \meta{coffin_1-pole_2}, and \meta{handle_2}, the point of intersection +% of \meta{coffin_2-pole_1} and \meta{coffin_2-pole_2}. \meta{coffin_2} is +% then attached to \meta{coffin_1} such that the relationship between +% \meta{handle_1} and \meta{handle_2} is described by the \meta{x-offset} % and \meta{y-offset}. The two offsets should be given as dimension % expressions. % \end{function} @@ -272,7 +245,7 @@ % ~~\Arg{x-offset} \Arg{y-offset} % \end{syntax} % Typesetting is carried out by first calculating \meta{handle}, the -% point of intersection of \meta{pole1} and \meta{pole2}. The coffin +% point of intersection of \meta{pole_1} and \meta{pole_2}. The coffin % is then typeset such that the relationship between the current % reference point in the document and the \meta{handle} is described % by the \meta{x-offset} and \meta{y-offset}. The two offsets should @@ -310,7 +283,7 @@ % \section{Coffin diagnostics} % % \begin{function}[updated = 2011-09-02] -% {\coffin_display_handles:cn, \coffin_display_handles:cn} +% {\coffin_display_handles:Nn, \coffin_display_handles:cn} % \begin{syntax} % \cs{coffin_display_handles:Nn} \meta{coffin} \Arg{colour} % \end{syntax} @@ -329,8 +302,8 @@ % \cs{coffin_mark_handle:Nnnn} \meta{coffin} \Arg{pole_1} \Arg{pole_2} \Arg{colour} % \end{syntax} % This function first calculates the \meta{handle} for the -% \meta{coffin} as defined by the intersection of \meta{pole1} and -% \meta{pole2}. It then marks the position of the \meta{handle} +% \meta{coffin} as defined by the intersection of \meta{pole_1} and +% \meta{pole_2}. It then marks the position of the \meta{handle} % on the \meta{coffin}. The \meta{handle} will be labelled as part of % this process: the location of the \meta{handle} and the label are % both printed in the \meta{colour} specified. @@ -353,6 +326,19 @@ % the later, rather than the absolute values, which determines the % direction of the pole. % \end{function} +% +% \subsection{Constants and variables} +% +% \begin{variable}{\c_empty_coffin} +% A permanently empty coffin. +% \end{variable} +% +% \begin{variable}[added = 2012-06-19]{\l_tmpa_coffin, \l_tmpb_coffin} +% Scratch coffins 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} % % \end{documentation} % @@ -363,183 +349,148 @@ % \begin{macrocode} %<*initex|package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=coffin> +% \end{macrocode} % % \begin{macrocode} %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: %</package> % \end{macrocode} % % \subsection{Coffins: data structures and general variables} % -% \begin{variable}{\l_coffin_internal_box} -% \begin{variable}{\l_coffin_internal_dim} -% \begin{variable}{\l_coffin_internal_fp} -% \begin{variable}{\l_coffin_internal_tl} +% \begin{variable}{\l_@@_internal_box} +% \begin{variable}{\l_@@_internal_dim} +% \begin{variable}{\l_@@_internal_tl} % Scratch variables. % \begin{macrocode} -\box_new:N \l_coffin_internal_box -\dim_new:N \l_coffin_internal_dim -\fp_new:N \l_coffin_internal_fp -\tl_new:N \l_coffin_internal_tl +\box_new:N \l_@@_internal_box +\dim_new:N \l_@@_internal_dim +\tl_new:N \l_@@_internal_tl % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} -% \end{variable} % -% \begin{variable}{\c_coffin_corners_prop} +% \begin{variable}{\c_@@_corners_prop} % The \enquote{corners}; of a coffin define the real content, as % opposed to the \TeX{} bounding box. They all start off in the same % place, of course. % \begin{macrocode} -\prop_new:N \c_coffin_corners_prop -\prop_put:Nnn \c_coffin_corners_prop { tl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { tr } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { bl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { br } { { 0 pt } { 0 pt } } +\prop_new:N \c_@@_corners_prop +\prop_put:Nnn \c_@@_corners_prop { tl } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c_@@_corners_prop { tr } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c_@@_corners_prop { bl } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c_@@_corners_prop { br } { { 0 pt } { 0 pt } } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_coffin_poles_prop} +% \begin{variable}{\c_@@_poles_prop} % Pole positions are given for horizontal, vertical and reference-point % based values. % \begin{macrocode} -\prop_new:N \c_coffin_poles_prop -\tl_set:Nn \l_coffin_internal_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } -\prop_put:Nno \c_coffin_poles_prop { l } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { hc } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { r } { \l_coffin_internal_tl } -\tl_set:Nn \l_coffin_internal_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } -\prop_put:Nno \c_coffin_poles_prop { b } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { vc } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { t } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { B } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { H } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { T } { \l_coffin_internal_tl } +\prop_new:N \c_@@_poles_prop +\tl_set:Nn \l_@@_internal_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } +\prop_put:Nno \c_@@_poles_prop { l } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { hc } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { r } { \l_@@_internal_tl } +\tl_set:Nn \l_@@_internal_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } +\prop_put:Nno \c_@@_poles_prop { b } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { vc } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { t } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { B } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { H } { \l_@@_internal_tl } +\prop_put:Nno \c_@@_poles_prop { T } { \l_@@_internal_tl } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_coffin_calc_a_fp} -% \begin{variable}{\l_coffin_calc_b_fp} -% \begin{variable}{\l_coffin_calc_c_fp} -% \begin{variable}{\l_coffin_calc_d_fp} -% \begin{variable}{\l_coffin_calc_result_fp} -% Used for calculations of intersections and in other internal places. +% \begin{variable}{\l_@@_slope_x_fp} +% \begin{variable}{\l_@@_slope_y_fp} +% Used for calculations of intersections. % \begin{macrocode} -\fp_new:N \l_coffin_calc_a_fp -\fp_new:N \l_coffin_calc_b_fp -\fp_new:N \l_coffin_calc_c_fp -\fp_new:N \l_coffin_calc_d_fp -\fp_new:N \l_coffin_calc_result_fp +\fp_new:N \l_@@_slope_x_fp +\fp_new:N \l_@@_slope_y_fp % \end{macrocode} % \end{variable} % \end{variable} -% \end{variable} -% \end{variable} -% \end{variable} % -% \begin{variable}{\l_coffin_error_bool} +% \begin{variable}{\l_@@_error_bool} % For propagating errors so that parts of the code can work around them. % \begin{macrocode} -\bool_new:N \l_coffin_error_bool +\bool_new:N \l_@@_error_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_coffin_offset_x_dim} -% \begin{variable}{\l_coffin_offset_y_dim} +% \begin{variable}{\l_@@_offset_x_dim} +% \begin{variable}{\l_@@_offset_y_dim} % The offset between two sets of coffin handles when typesetting. These % values are corrected from those requested in an alignment for the % positions of the handles. % \begin{macrocode} -\dim_new:N \l_coffin_offset_x_dim -\dim_new:N \l_coffin_offset_y_dim +\dim_new:N \l_@@_offset_x_dim +\dim_new:N \l_@@_offset_y_dim % \end{macrocode} % \end{variable} % \end{variable} % -% \begin{variable}{\l_coffin_pole_a_tl} -% \begin{variable}{\l_coffin_pole_b_tl} +% \begin{variable}{\l_@@_pole_a_tl} +% \begin{variable}{\l_@@_pole_b_tl} % Needed for finding the intersection of two poles. % \begin{macrocode} -\tl_new:N \l_coffin_pole_a_tl -\tl_new:N \l_coffin_pole_b_tl -% \end{macrocode} -% \end{variable} -% \end{variable} -% -% \begin{variable}{\l_coffin_sin_fp} -% \begin{variable}{\l_coffin_cos_fp} -% Used for rotations to get the sine and cosine values. -% \begin{macrocode} -\fp_new:N \l_coffin_sin_fp -\fp_new:N \l_coffin_cos_fp +\tl_new:N \l_@@_pole_a_tl +\tl_new:N \l_@@_pole_b_tl % \end{macrocode} % \end{variable} % \end{variable} % -% \begin{variable}{\l_coffin_x_dim} -% \begin{variable}{\l_coffin_y_dim} -% \begin{variable}{\l_coffin_x_prime_dim} -% \begin{variable}{\l_coffin_y_prime_dim} +% \begin{variable}{\l_@@_x_dim} +% \begin{variable}{\l_@@_y_dim} +% \begin{variable}{\l_@@_x_prime_dim} +% \begin{variable}{\l_@@_y_prime_dim} % For calculating intersections and so forth. % \begin{macrocode} -\dim_new:N \l_coffin_x_dim -\dim_new:N \l_coffin_y_dim -\dim_new:N \l_coffin_x_prime_dim -\dim_new:N \l_coffin_y_prime_dim -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{variable} -% \end{variable} -% -% \begin{variable}{\l_coffin_x_fp} -% \begin{variable}{\l_coffin_y_fp} -% \begin{variable}{\l_coffin_x_prime_fp} -% \begin{variable}{\l_coffin_y_prime_fp} -% Used for calculations where there are clear $x$- and -% $y$-components, for example during vector rotation. -% \begin{macrocode} -\fp_new:N \l_coffin_x_fp -\fp_new:N \l_coffin_y_fp -\fp_new:N \l_coffin_x_prime_fp -\fp_new:N \l_coffin_y_prime_fp +\dim_new:N \l_@@_x_dim +\dim_new:N \l_@@_y_dim +\dim_new:N \l_@@_x_prime_dim +\dim_new:N \l_@@_y_prime_dim % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} % \end{variable} % -% \begin{variable}{\l_coffin_Depth_dim} -% \begin{variable}{\l_coffin_Height_dim} -% \begin{variable}{\l_coffin_TotalHeight_dim} -% \begin{variable}{\l_coffin_Width_dim} +% \begin{variable}{\l_@@_Depth_dim} +% \begin{variable}{\l_@@_Height_dim} +% \begin{variable}{\l_@@_TotalHeight_dim} +% \begin{variable}{\l_@@_Width_dim} % Dimensions for the various parts of a coffin. % \begin{macrocode} -\dim_new:N \l_coffin_Depth_dim -\dim_new:N \l_coffin_Height_dim -\dim_new:N \l_coffin_TotalHeight_dim -\dim_new:N \l_coffin_Width_dim +\dim_new:N \l_@@_Depth_dim +\dim_new:N \l_@@_Height_dim +\dim_new:N \l_@@_TotalHeight_dim +\dim_new:N \l_@@_Width_dim % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} % \end{variable} % -% \begin{macro}{\coffin_saved_Depth:} -% \begin{macro}{\coffin_saved_Height:} -% \begin{macro}{\coffin_saved_TotalHeight:} -% \begin{macro}{\coffin_saved_Width:} +% \begin{macro}{\@@_saved_Depth:} +% \begin{macro}{\@@_saved_Height:} +% \begin{macro}{\@@_saved_TotalHeight:} +% \begin{macro}{\@@_saved_Width:} % Used to save the meaning of \cs{Depth}, \cs{Height}, \cs{TotalHeight} % and \cs{Width}. % \begin{macrocode} -\cs_new_nopar:Npn \coffin_saved_Depth: { } -\cs_new_nopar:Npn \coffin_saved_Height: { } -\cs_new_nopar:Npn \coffin_saved_TotalHeight: { } -\cs_new_nopar:Npn \coffin_saved_Width: { } +\cs_new_nopar:Npn \@@_saved_Depth: { } +\cs_new_nopar:Npn \@@_saved_Height: { } +\cs_new_nopar:Npn \@@_saved_TotalHeight: { } +\cs_new_nopar:Npn \@@_saved_Width: { } % \end{macrocode} % \end{macro} % \end{macro} @@ -552,25 +503,40 @@ % placing material in them. This all relies on the following data % structures. % -% \begin{macro}{\coffin_if_exist:NT} +% \begin{macro}[EXP, pTF]{\coffin_if_exist:N, \coffin_if_exist:c} % Several of the higher-level coffin functions will give multiple % errors if the coffin does not exist. A cleaner way to handle this % is provided here: both the box and the coffin structure are % checked. % \begin{macrocode} -\cs_new_protected:Npn \coffin_if_exist:NT #1#2 +\prg_new_conditional:Npnn \coffin_if_exist:N #1 { p , T , F , TF } { \cs_if_exist:NTF #1 { - \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } - { #2 } - { - \msg_kernel_error:nnx { coffins } { unknown-coffin } - { \token_to_str:N #1 } - } + \cs_if_exist:cTF { l_@@_poles_ \__int_value:w #1 _prop } + { \prg_return_true: } + { \prg_return_false: } } + { \prg_return_false: } + } +\cs_generate_variant:Nn \coffin_if_exist_p:N { c } +\cs_generate_variant:Nn \coffin_if_exist:NT { c } +\cs_generate_variant:Nn \coffin_if_exist:NF { c } +\cs_generate_variant:Nn \coffin_if_exist:NTF { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_if_exist:NT} +% Several of the higher-level coffin functions will give multiple +% errors if the coffin does not exist. So a wrapper is provided to deal +% with this correctly, issuing an error on erroneous use. +% \begin{macrocode} +\cs_new_protected:Npn \@@_if_exist:NT #1#2 + { + \coffin_if_exist:NTF #1 + { #2 } { - \msg_kernel_error:nnx { coffins } { unknown-coffin } + \__msg_kernel_error:nnx { kernel } { unknown-coffin } { \token_to_str:N #1 } } } @@ -583,10 +549,10 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_clear:N #1 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \box_clear:N #1 - \coffin_reset_structure:N #1 + \@@_reset_structure:N #1 } } \cs_generate_variant:Nn \coffin_clear:N { c } @@ -603,12 +569,12 @@ \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 - \prop_clear_new:c { l_coffin_corners_ \int_value:w #1 _prop } - \prop_clear_new:c { l_coffin_poles_ \int_value:w #1 _prop } - \prop_gset_eq:cN { l_coffin_corners_ \int_value:w #1 _prop } - \c_coffin_corners_prop - \prop_gset_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } - \c_coffin_poles_prop + \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } + \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } + \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } + \c_@@_corners_prop + \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } + \c_@@_poles_prop } \cs_generate_variant:Nn \coffin_new:N { c } % \end{macrocode} @@ -620,7 +586,7 @@ % \begin{macrocode} \cs_new_protected:Npn \hcoffin_set:Nn #1#2 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \hbox_set:Nn #1 { @@ -629,9 +595,9 @@ #2 \color_group_end: } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 + \@@_reset_structure:N #1 + \@@_update_poles:N #1 + \@@_update_corners:N #1 } } \cs_generate_variant:Nn \hcoffin_set:Nn { c } @@ -642,32 +608,38 @@ % 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 -% temporary box. +% temporary box. No \cs{color_ensure_current:} here as that would add a +% whatsit to the start of the vertical box and mess up the location of the +% \texttt{T}~pole (see \emph{\TeX{} by Topic} for discussion of the +% \tn{vtop} primitive, used to do the measuring). % \begin{macrocode} \cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \vbox_set:Nn #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> \color_group_begin: - \color_ensure_current: #3 \color_group_end: } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 - \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 } - \coffin_set_pole:Nnx #1 { T } + \@@_reset_structure:N #1 + \@@_update_poles:N #1 + \@@_update_corners:N #1 + \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } + \@@_set_pole:Nnx #1 { T } { { 0 pt } - { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } } + { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_@@_internal_box } } { 1000 pt } { 0 pt } } - \box_clear:N \l_coffin_internal_box + \box_clear:N \l_@@_internal_box } } \cs_generate_variant:Nn \vcoffin_set:Nnn { c } @@ -681,16 +653,16 @@ % \begin{macrocode} \cs_new_protected:Npn \hcoffin_set:Nw #1 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \hbox_set:Nw #1 \color_group_begin: \color_ensure_current: \cs_set_protected_nopar:Npn \hcoffin_set_end: { \color_group_end: \hbox_set_end: - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 + \@@_reset_structure:N #1 + \@@_update_poles:N #1 + \@@_update_corners:N #1 } } } @@ -706,29 +678,33 @@ % \begin{macrocode} \cs_new_protected:Npn \vcoffin_set:Nnw #1#2 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \vbox_set:Nw #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> \color_group_begin: \color_ensure_current: \cs_set_protected:Npn \vcoffin_set_end: { \color_group_end: \vbox_set_end: - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 - \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 } - \coffin_set_pole:Nnx #1 { T } + \@@_reset_structure:N #1 + \@@_update_poles:N #1 + \@@_update_corners:N #1 + \vbox_set_top:Nn \l_@@_internal_box { \vbox_unpack:N #1 } + \@@_set_pole:Nnx #1 { T } { { 0 pt } { - \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } + \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_@@_internal_box } } { 1000 pt } { 0 pt } } - \box_clear:N \l_coffin_internal_box + \box_clear:N \l_@@_internal_box } } } @@ -747,10 +723,10 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_set_eq:NN #1#2 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { \box_set_eq:NN #1 #2 - \coffin_set_eq_structure:NN #1 #2 + \@@_set_eq_structure:NN #1 #2 } } \cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc } @@ -758,20 +734,28 @@ % \end{macro} % % \begin{variable}{\c_empty_coffin} -% \begin{variable}{\l_coffin_aligned_coffin} -% \begin{variable}{\l_coffin_aligned_internal_coffin} +% \begin{variable}{\l_@@_aligned_coffin} +% \begin{variable}{\l_@@_aligned_internal_coffin} % Special coffins: these cannot be set up earlier as they need % \cs{coffin_new:N}. The empty coffin is set as a box as the full % coffin-setting system needs some material which is not yet available. % \begin{macrocode} \coffin_new:N \c_empty_coffin \hbox_set:Nn \c_empty_coffin { } -\coffin_new:N \l_coffin_aligned_coffin -\coffin_new:N \l_coffin_aligned_internal_coffin +\coffin_new:N \l_@@_aligned_coffin +\coffin_new:N \l_@@_aligned_internal_coffin % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} +% +% \begin{variable}{\l_tmpa_coffin, \l_tmpb_coffin} +% The usual scratch space. +% \begin{macrocode} +\coffin_new:N \l_tmpa_coffin +\coffin_new:N \l_tmpb_coffin +% \end{macrocode} +% \end{variable} % % \subsection{Measuring coffins} % @@ -794,16 +778,16 @@ % % \subsection{Coffins: handle and pole management} % -% \begin{macro}{\coffin_get_pole:NnN} +% \begin{macro}{\@@_get_pole:NnN} % A simple wrapper around the recovery of a coffin pole, with some % error checking and recovery built-in. % \begin{macrocode} -\cs_new_protected:Npn \coffin_get_pole:NnN #1#2#3 +\cs_new_protected:Npn \@@_get_pole:NnN #1#2#3 { \prop_get:cnNF - { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 + { l_@@_poles_ \__int_value:w #1 _prop } {#2} #3 { - \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } + \__msg_kernel_error:nnxx { kernel } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } } @@ -811,42 +795,42 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_reset_structure:N} +% \begin{macro}{\@@_reset_structure:N} % Resetting the structure is a simple copy job. % \begin{macrocode} -\cs_new_protected:Npn \coffin_reset_structure:N #1 +\cs_new_protected:Npn \@@_reset_structure:N #1 { - \prop_set_eq:cN { l_coffin_corners_ \int_value:w #1 _prop } - \c_coffin_corners_prop - \prop_set_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } - \c_coffin_poles_prop + \prop_set_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } + \c_@@_corners_prop + \prop_set_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } + \c_@@_poles_prop } % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_set_eq_structure:NN,\coffin_gset_eq_structure:NN} +% \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 \coffin_set_eq_structure:NN #1#2 +\cs_new_protected:Npn \@@_set_eq_structure:NN #1#2 { - \prop_set_eq:cc { l_coffin_corners_ \int_value:w #1 _prop } - { l_coffin_corners_ \int_value:w #2 _prop } - \prop_set_eq:cc { l_coffin_poles_ \int_value:w #1 _prop } - { l_coffin_poles_ \int_value:w #2 _prop } + \prop_set_eq:cc { l_@@_corners_ \__int_value:w #1 _prop } + { l_@@_corners_ \__int_value:w #2 _prop } + \prop_set_eq:cc { l_@@_poles_ \__int_value:w #1 _prop } + { l_@@_poles_ \__int_value:w #2 _prop } } -\cs_new_protected:Npn \coffin_gset_eq_structure:NN #1#2 +\cs_new_protected:Npn \@@_gset_eq_structure:NN #1#2 { - \prop_gset_eq:cc { l_coffin_corners_ \int_value:w #1 _prop } - { l_coffin_corners_ \int_value:w #2 _prop } - \prop_gset_eq:cc { l_coffin_poles_ \int_value:w #1 _prop } - { l_coffin_poles_ \int_value:w #2 _prop } + \prop_gset_eq:cc { l_@@_corners_ \__int_value:w #1 _prop } + { l_@@_corners_ \__int_value:w #2 _prop } + \prop_gset_eq:cc { l_@@_poles_ \__int_value:w #1 _prop } + { l_@@_poles_ \__int_value:w #2 _prop } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_set_user_dimensions:N} -% \begin{macro}{\coffin_end_user_dimensions:} +% \begin{macro}{\@@_set_user_dimensions:N} +% \begin{macro}{\@@_end_user_dimensions:} % \begin{macro}{\Depth} % \begin{macro}{\Height} % \begin{macro}{\TotalHeight} @@ -854,27 +838,27 @@ % These make design-level names for the dimensions of a coffin easy to % get at. % \begin{macrocode} -\cs_new_protected:Npn \coffin_set_user_dimensions:N #1 +\cs_new_protected:Npn \@@_set_user_dimensions:N #1 { - \cs_set_eq:NN \coffin_saved_Height: \Height - \cs_set_eq:NN \coffin_saved_Depth: \Depth - \cs_set_eq:NN \coffin_saved_TotalHeight: \TotalHeight - \cs_set_eq:NN \coffin_saved_Width: \Width - \cs_set_eq:NN \Height \l_coffin_Height_dim - \cs_set_eq:NN \Depth \l_coffin_Depth_dim - \cs_set_eq:NN \TotalHeight \l_coffin_TotalHeight_dim - \cs_set_eq:NN \Width \l_coffin_Width_dim + \cs_set_eq:NN \@@_saved_Height: \Height + \cs_set_eq:NN \@@_saved_Depth: \Depth + \cs_set_eq:NN \@@_saved_TotalHeight: \TotalHeight + \cs_set_eq:NN \@@_saved_Width: \Width + \cs_set_eq:NN \Height \l_@@_Height_dim + \cs_set_eq:NN \Depth \l_@@_Depth_dim + \cs_set_eq:NN \TotalHeight \l_@@_TotalHeight_dim + \cs_set_eq:NN \Width \l_@@_Width_dim \dim_set:Nn \Height { \box_ht:N #1 } \dim_set:Nn \Depth { \box_dp:N #1 } \dim_set:Nn \TotalHeight { \box_ht:N #1 + \box_dp:N #1 } \dim_set:Nn \Width { \box_wd:N #1 } } -\cs_new_protected_nopar:Npn \coffin_end_user_dimensions: +\cs_new_protected_nopar:Npn \@@_end_user_dimensions: { - \cs_set_eq:NN \Height \coffin_saved_Height: - \cs_set_eq:NN \Depth \coffin_saved_Depth: - \cs_set_eq:NN \TotalHeight \coffin_saved_TotalHeight: - \cs_set_eq:NN \Width \coffin_saved_Width: + \cs_set_eq:NN \Height \@@_saved_Height: + \cs_set_eq:NN \Depth \@@_saved_Depth: + \cs_set_eq:NN \TotalHeight \@@_saved_TotalHeight: + \cs_set_eq:NN \Width \@@_saved_Width: } % \end{macrocode} % \end{macro} @@ -887,7 +871,7 @@ % \begin{macro} % {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn} % \begin{macro}{\coffin_set_vertical_pole:Nnn,\coffin_set_vertical_pole:cnn} -% \begin{macro}{\coffin_set_pole:Nnn, \coffin_set_pole:Nnx} +% \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 % the system, then to do the setting with full expansion. The @@ -895,93 +879,93 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_set_horizontal_pole:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \@@_set_user_dimensions:N #1 + \@@_set_pole:Nnx #1 {#2} { { 0 pt } { \dim_eval:n {#3} } { 1000 pt } { 0 pt } } - \coffin_end_user_dimensions: + \@@_end_user_dimensions: } } \cs_new_protected:Npn \coffin_set_vertical_pole:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \@@_set_user_dimensions:N #1 + \@@_set_pole:Nnx #1 {#2} { { \dim_eval:n {#3} } { 0 pt } { 0 pt } { 1000 pt } } - \coffin_end_user_dimensions: + \@@_end_user_dimensions: } } -\cs_new_protected:Npn \coffin_set_pole:Nnn #1#2#3 - { \prop_put:cnn { l_coffin_poles_ \int_value:w #1 _prop } {#2} {#3} } +\cs_new_protected:Npn \@@_set_pole:Nnn #1#2#3 + { \prop_put:cnn { l_@@_poles_ \__int_value:w #1 _prop } {#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 \coffin_set_pole:Nnn { Nnx } +\cs_generate_variant:Nn \@@_set_pole:Nnn { Nnx } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\coffin_update_corners:N} +% \begin{macro}{\@@_update_corners:N} % 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 \coffin_update_corners:N #1 +\cs_new_protected:Npn \@@_update_corners:N #1 { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { tl } + \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { tl } { { 0 pt } { \dim_use:N \box_ht:N #1 } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { tr } + \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { tr } { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { bl } + \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { bl } { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { br } + \prop_put:cnx { l_@@_corners_ \__int_value:w #1 _prop } { br } { { \dim_use:N \box_wd:N #1 } { \dim_eval:n { - \box_dp:N #1 } } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_update_poles:N} +% \begin{macro}{\@@_update_poles:N} % 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. % It also does not set poles which are relevant only to vertical % coffins. % \begin{macrocode} -\cs_new_protected:Npn \coffin_update_poles:N #1 +\cs_new_protected:Npn \@@_update_poles:N #1 { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { hc } + \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { hc } { { \dim_eval:n { 0.5 \box_wd:N #1 } } { 0 pt } { 0 pt } { 1000 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { r } + \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { r } { { \dim_use:N \box_wd:N #1 } { 0 pt } { 0 pt } { 1000 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { vc } + \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { vc } { { 0 pt } { \dim_eval:n { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } } { 1000 pt } { 0 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { t } + \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { t } { { 0 pt } { \dim_use:N \box_ht:N #1 } { 1000 pt } { 0 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { b } + \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } { b } { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } @@ -994,27 +978,27 @@ % % \subsection{Coffins: calculation of pole intersections} % -% \begin{macro}{\coffin_calculate_intersection:Nnn} -% \begin{macro}[aux]{\coffin_calculate_intersection:nnnnnnnn} -% \begin{macro}[aux]{\coffin_calculate_intersection_aux:nnnnnN} +% \begin{macro}{\@@_calculate_intersection:Nnn} +% \begin{macro}[aux]{\@@_calculate_intersection:nnnnnnnn} +% \begin{macro}[aux]{\@@_calculate_intersection_aux:nnnnnN} % The lead off in finding intersections is to recover the two poles % and then hand off to the auxiliary for the actual calculation. There % may of course not be an intersection, for which an error trap is % needed. % \begin{macrocode} -\cs_new_protected:Npn \coffin_calculate_intersection:Nnn #1#2#3 +\cs_new_protected:Npn \@@_calculate_intersection:Nnn #1#2#3 { - \coffin_get_pole:NnN #1 {#2} \l_coffin_pole_a_tl - \coffin_get_pole:NnN #1 {#3} \l_coffin_pole_b_tl - \bool_set_false:N \l_coffin_error_bool + \@@_get_pole:NnN #1 {#2} \l_@@_pole_a_tl + \@@_get_pole:NnN #1 {#3} \l_@@_pole_b_tl + \bool_set_false:N \l_@@_error_bool \exp_last_two_unbraced:Noo - \coffin_calculate_intersection:nnnnnnnn - \l_coffin_pole_a_tl \l_coffin_pole_b_tl - \bool_if:NT \l_coffin_error_bool + \@@_calculate_intersection:nnnnnnnn + \l_@@_pole_a_tl \l_@@_pole_b_tl + \bool_if:NT \l_@@_error_bool { - \msg_kernel_error:nn { coffins } { no-pole-intersection } - \dim_zero:N \l_coffin_x_dim - \dim_zero:N \l_coffin_y_dim + \__msg_kernel_error:nn { kernel } { no-pole-intersection } + \dim_zero:N \l_@@_x_dim + \dim_zero:N \l_@@_y_dim } } % \end{macrocode} @@ -1029,7 +1013,7 @@ % is either horizontal or vertical then one or more of $c$, $d$, % $c'$ and $d'$ will be zero and a special case is needed. % \begin{macrocode} -\cs_new_protected:Npn \coffin_calculate_intersection:nnnnnnnn +\cs_new_protected:Npn \@@_calculate_intersection:nnnnnnnn #1#2#3#4#5#6#7#8 { \dim_compare:nNnTF {#3} = { \c_zero_dim } @@ -1039,9 +1023,9 @@ % second pole: if it is also vertical then there is an error. % \begin{macrocode} { - \dim_set:Nn \l_coffin_x_dim {#1} + \dim_set:Nn \l_@@_x_dim {#1} \dim_compare:nNnTF {#7} = \c_zero_dim - { \bool_set_true:N \l_coffin_error_bool } + { \bool_set_true:N \l_@@_error_bool } % \end{macrocode} % The second pole may still be horizontal, in which case the % $y$-component of the intersection will be $b'$. If not, @@ -1053,10 +1037,10 @@ % \begin{macrocode} { \dim_compare:nNnTF {#8} = \c_zero_dim - { \dim_set:Nn \l_coffin_y_dim {#6} } + { \dim_set:Nn \l_@@_y_dim {#6} } { - \coffin_calculate_intersection_aux:nnnnnN - {#1} {#5} {#6} {#7} {#8} \l_coffin_y_dim + \@@_calculate_intersection_aux:nnnnnN + {#1} {#5} {#6} {#7} {#8} \l_@@_y_dim } } } @@ -1068,12 +1052,12 @@ { \dim_compare:nNnTF {#4} = \c_zero_dim { - \dim_set:Nn \l_coffin_y_dim {#2} + \dim_set:Nn \l_@@_y_dim {#2} \dim_compare:nNnTF {#8} = { \c_zero_dim } - { \bool_set_true:N \l_coffin_error_bool } + { \bool_set_true:N \l_@@_error_bool } { \dim_compare:nNnTF {#7} = \c_zero_dim - { \dim_set:Nn \l_coffin_x_dim {#5} } + { \dim_set:Nn \l_@@_x_dim {#5} } % \end{macrocode} % The formula for the case where the second pole is neither horizontal % nor vertical is @@ -1083,8 +1067,8 @@ % which is again handled by the same auxiliary. % \begin{macrocode} { - \coffin_calculate_intersection_aux:nnnnnN - {#2} {#6} {#5} {#8} {#7} \l_coffin_x_dim + \@@_calculate_intersection_aux:nnnnnN + {#2} {#6} {#5} {#8} {#7} \l_@@_x_dim } } } @@ -1097,32 +1081,30 @@ { \dim_compare:nNnTF {#7} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#5} - \coffin_calculate_intersection_aux:nnnnnN - {#5} {#1} {#2} {#3} {#4} \l_coffin_y_dim + \dim_set:Nn \l_@@_x_dim {#5} + \@@_calculate_intersection_aux:nnnnnN + {#5} {#1} {#2} {#3} {#4} \l_@@_y_dim } { \dim_compare:nNnTF {#8} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#6} - \coffin_calculate_intersection_aux:nnnnnN - {#6} {#2} {#1} {#4} {#3} \l_coffin_x_dim + \dim_set:Nn \l_@@_x_dim {#6} + \@@_calculate_intersection_aux:nnnnnN + {#6} {#2} {#1} {#4} {#3} \l_@@_x_dim } % \end{macrocode} % If none of the special cases apply then there is still a need to % check that there is a unique intersection between the two pole. This % is the case if they have different slopes. % \begin{macrocode} - { - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#3} - \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#4} - \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#7} - \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#8} - \fp_div:Nn \l_coffin_calc_b_fp \l_coffin_calc_a_fp - \fp_div:Nn \l_coffin_calc_d_fp \l_coffin_calc_c_fp + { + \fp_set:Nn \l_@@_slope_x_fp + { \dim_to_fp:n {#4} / \dim_to_fp:n {#3} } + \fp_set:Nn \l_@@_slope_y_fp + { \dim_to_fp:n {#8} / \dim_to_fp:n {#7} } \fp_compare:nNnTF - \l_coffin_calc_b_fp = \l_coffin_calc_d_fp - { \bool_set_true:N \l_coffin_error_bool } + \l_@@_slope_x_fp = \l_@@_slope_y_fp + { \bool_set_true:N \l_@@_error_bool } % \end{macrocode} % All of the tests pass, so there is the full complexity of the % calculation: @@ -1137,29 +1119,23 @@ % $x$-position. % \begin{macrocode} { - \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#6} - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} - \fp_sub:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#1} - \fp_mul:Nn \l_coffin_calc_a_fp - { \l_coffin_calc_b_fp } - \fp_add:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#5} - \fp_mul:Nn \l_coffin_calc_a_fp - { \l_coffin_calc_d_fp } - \fp_sub:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_sub:Nn \l_coffin_calc_b_fp - { \l_coffin_calc_d_fp } - \fp_div:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_b_fp } - \dim_set:Nn \l_coffin_x_dim - { \fp_to_dim:N \l_coffin_calc_result_fp } - \coffin_calculate_intersection_aux:nnnnnN - { \l_coffin_x_dim } - {#5} {#6} {#8} {#7} \l_coffin_y_dim + \dim_set:Nn \l_@@_x_dim + { + \fp_to_dim:n + { + ( + \dim_to_fp:n {#1} * \l_@@_slope_x_fp + - ( \dim_to_fp:n {#5} * \l_@@_slope_y_fp ) + - \dim_to_fp:n {#2} + + \dim_to_fp:n {#6} + ) + / + ( \l_@@_slope_x_fp - \l_@@_slope_y_fp ) + } + } + \@@_calculate_intersection_aux:nnnnnN + { \l_@@_x_dim } + {#5} {#6} {#8} {#7} \l_@@_y_dim } } } @@ -1170,24 +1146,23 @@ % The formula for finding the intersection point is in most cases the % same. The formula here is % \[ -% \#6 = \frac{\#5}{\#4} \left ( \#1 - \#2 \right ) + \#3 +% \#6 = \#4 \cdot \left( \frac { \#1 - \#2 } { \#5 } \right)\#3 % \] % Thus |#4| and |#5| should be the directions of the pole while % |#2| and |#3| are co-ordinates. % \begin{macrocode} -\cs_new_protected:Npn \coffin_calculate_intersection_aux:nnnnnN - #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_calculate_intersection_aux:nnnnnN #1#2#3#4#5#6 { - \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#1} - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} - \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#3} - \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#4} - \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#5} - \fp_sub:Nn \l_coffin_calc_result_fp { \l_coffin_calc_a_fp } - \fp_div:Nn \l_coffin_calc_result_fp { \l_coffin_calc_d_fp } - \fp_mul:Nn \l_coffin_calc_result_fp { \l_coffin_calc_c_fp } - \fp_add:Nn \l_coffin_calc_result_fp { \l_coffin_calc_b_fp } - \dim_set:Nn #6 { \fp_to_dim:N \l_coffin_calc_result_fp } + \dim_set:Nn #6 + { + \fp_to_dim:n + { + \dim_to_fp:n {#4} * + ( \dim_to_fp:n {#1} - \dim_to_fp:n {#2} ) / + \dim_to_fp:n {#5} + + \dim_to_fp:n {#3} + } + } } % \end{macrocode} % \end{macro} @@ -1209,8 +1184,8 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin + \@@_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin % \end{macrocode} % Correct the placement of the reference point. If the $x$-offset % is negative then the reference point of the second box is to the left @@ -1219,46 +1194,46 @@ % than the sum of the $x$-offset and the width of the second box. % So a second kern may be needed. % \begin{macrocode} - \hbox_set:Nn \l_coffin_aligned_coffin + \hbox_set:Nn \l_@@_aligned_coffin { - \dim_compare:nNnT { \l_coffin_offset_x_dim } < \c_zero_dim - { \tex_kern:D -\l_coffin_offset_x_dim } - \hbox_unpack:N \l_coffin_aligned_coffin - \dim_set:Nn \l_coffin_internal_dim - { \l_coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } - \dim_compare:nNnT \l_coffin_internal_dim < \c_zero_dim - { \tex_kern:D -\l_coffin_internal_dim } + \dim_compare:nNnT { \l_@@_offset_x_dim } < \c_zero_dim + { \tex_kern:D -\l_@@_offset_x_dim } + \hbox_unpack:N \l_@@_aligned_coffin + \dim_set:Nn \l_@@_internal_dim + { \l_@@_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } + \dim_compare:nNnT \l_@@_internal_dim < \c_zero_dim + { \tex_kern:D -\l_@@_internal_dim } } % \end{macrocode} % The coffin structure is reset, and the corners are cleared: only % those from the two parent coffins are needed. % \begin{macrocode} - \coffin_reset_structure:N \l_coffin_aligned_coffin + \@@_reset_structure:N \l_@@_aligned_coffin \prop_clear:c - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _ prop } - \coffin_update_poles:N \l_coffin_aligned_coffin + { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _ prop } + \@@_update_poles:N \l_@@_aligned_coffin % \end{macrocode} % The structures of the parent coffins are now transferred to the new % coffin, which requires that the appropriate offsets are applied. That % will then depend on whether any shift was needed. % \begin{macrocode} - \dim_compare:nNnTF \l_coffin_offset_x_dim < \c_zero_dim + \dim_compare:nNnTF \l_@@_offset_x_dim < \c_zero_dim { - \coffin_offset_poles:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } - \coffin_offset_poles:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } - \coffin_offset_corners:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } - \coffin_offset_corners:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } + \@@_offset_poles:Nnn #1 { -\l_@@_offset_x_dim } { 0 pt } + \@@_offset_poles:Nnn #4 { 0 pt } { \l_@@_offset_y_dim } + \@@_offset_corners:Nnn #1 { -\l_@@_offset_x_dim } { 0 pt } + \@@_offset_corners:Nnn #4 { 0 pt } { \l_@@_offset_y_dim } } { - \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_poles:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } - \coffin_offset_corners:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_corners:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + \@@_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_poles:Nnn #4 + { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } + \@@_offset_corners:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_corners:Nnn #4 + { \l_@@_offset_x_dim } { \l_@@_offset_y_dim } } - \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin - \coffin_set_eq:NN #1 \l_coffin_aligned_coffin + \@@_update_vertical_poles:NNN #1 #4 \l_@@_aligned_coffin + \coffin_set_eq:NN #1 \l_@@_aligned_coffin } \cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } % \end{macrocode} @@ -1278,37 +1253,37 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin - \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } - \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } - \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } - \coffin_reset_structure:N \l_coffin_aligned_coffin + \@@_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin + \box_set_ht:Nn \l_@@_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l_@@_aligned_coffin { \box_dp:N #1 } + \box_set_wd:Nn \l_@@_aligned_coffin { \box_wd:N #1 } + \@@_reset_structure:N \l_@@_aligned_coffin \prop_set_eq:cc - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _prop } - { l_coffin_corners_ \int_value:w #1 _prop } - \coffin_update_poles:N \l_coffin_aligned_coffin - \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_poles:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } - \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin - \coffin_set_eq:NN #1 \l_coffin_aligned_coffin + { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _prop } + { l_@@_corners_ \__int_value:w #1 _prop } + \@@_update_poles:N \l_@@_aligned_coffin + \@@_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \@@_offset_poles:Nnn #4 + { \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 } \cs_new_protected:Npn \coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin - \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } - \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } - \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } - \box_set_eq:NN #1 \l_coffin_aligned_coffin + \@@_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_@@_aligned_coffin + \box_set_ht:Nn \l_@@_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l_@@_aligned_coffin { \box_dp:N #1 } + \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} % -% \begin{macro}{\coffin_align:NnnNnnnnN} +% \begin{macro}{\@@_align:NnnNnnnnN} % The internal function aligns the two coffins into a third one, but % performs no corrections on the resulting coffin poles. The process % begins by finding the points of intersection for the poles for each @@ -1319,30 +1294,30 @@ % input coffins. The default poles are then set up, but the final result % will depend on how the bounding box is being handled. % \begin{macrocode} -\cs_new_protected:Npn \coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 +\cs_new_protected:Npn \@@_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 { - \coffin_calculate_intersection:Nnn #4 {#5} {#6} - \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } - \coffin_calculate_intersection:Nnn #1 {#2} {#3} - \dim_set:Nn \l_coffin_offset_x_dim - { \l_coffin_x_dim - \l_coffin_x_prime_dim + #7 } - \dim_set:Nn \l_coffin_offset_y_dim - { \l_coffin_y_dim - \l_coffin_y_prime_dim + #8 } - \hbox_set:Nn \l_coffin_aligned_internal_coffin + \@@_calculate_intersection:Nnn #4 {#5} {#6} + \dim_set:Nn \l_@@_x_prime_dim { \l_@@_x_dim } + \dim_set:Nn \l_@@_y_prime_dim { \l_@@_y_dim } + \@@_calculate_intersection:Nnn #1 {#2} {#3} + \dim_set:Nn \l_@@_offset_x_dim + { \l_@@_x_dim - \l_@@_x_prime_dim + #7 } + \dim_set:Nn \l_@@_offset_y_dim + { \l_@@_y_dim - \l_@@_y_prime_dim + #8 } + \hbox_set:Nn \l_@@_aligned_internal_coffin { \box_use:N #1 \tex_kern:D -\box_wd:N #1 - \tex_kern:D \l_coffin_offset_x_dim - \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #4 } + \tex_kern:D \l_@@_offset_x_dim + \box_move_up:nn { \l_@@_offset_y_dim } { \box_use:N #4 } } - \coffin_set_eq:NN #9 \l_coffin_aligned_internal_coffin + \coffin_set_eq:NN #9 \l_@@_aligned_internal_coffin } % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_offset_poles:Nnn} -% \begin{macro}[aux]{\coffin_offset_pole:Nnnnnnn} +% \begin{macro}{\@@_offset_poles:Nnn} +% \begin{macro}[aux]{\@@_offset_pole:Nnnnnnn} % Transferring structures from one coffin to another requires that the % positions are updated by the offset between the two coffins. This is % done by mapping to the property list of the source coffins, moving @@ -1353,22 +1328,22 @@ % or handle names, and that multiple alignments do not result in a % whole set of values. % \begin{macrocode} -\cs_new_protected:Npn \coffin_offset_poles:Nnn #1#2#3 +\cs_new_protected:Npn \@@_offset_poles:Nnn #1#2#3 { - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } + \prop_map_inline:cn { l_@@_poles_ \__int_value:w #1 _prop } + { \@@_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } } -\cs_new_protected:Npn \coffin_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 +\cs_new_protected:Npn \@@_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 { - \dim_set:Nn \l_coffin_x_dim { #3 + #7 } - \dim_set:Nn \l_coffin_y_dim { #4 + #8 } + \dim_set:Nn \l_@@_x_dim { #3 + #7 } + \dim_set:Nn \l_@@_y_dim { #4 + #8 } \tl_if_in:nnTF {#2} { - } - { \tl_set:Nn \l_coffin_internal_tl { {#2} } } - { \tl_set:Nn \l_coffin_internal_tl { { #1 - #2 } } } - \exp_last_unbraced:NNo \coffin_set_pole:Nnx \l_coffin_aligned_coffin - { \l_coffin_internal_tl } + { \tl_set:Nn \l_@@_internal_tl { {#2} } } + { \tl_set:Nn \l_@@_internal_tl { { #1 - #2 } } } + \exp_last_unbraced:NNo \@@_set_pole:Nnx \l_@@_aligned_coffin + { \l_@@_internal_tl } { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + { \dim_use:N \l_@@_x_dim } { \dim_use:N \l_@@_y_dim } {#5} {#6} } } @@ -1376,21 +1351,21 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\coffin_offset_corners:Nnn} -% \begin{macro}[aux]{\coffin_offset_corners:Nnnnn} +% \begin{macro}{\@@_offset_corners:Nnn} +% \begin{macro}[aux]{\@@_offset_corner:Nnnnn} % Saving the offset corners of a coffin is very similar, except that % there is no need to worry about naming: every corner can be saved % here as order is unimportant. % \begin{macrocode} -\cs_new_protected:Npn \coffin_offset_corners:Nnn #1#2#3 +\cs_new_protected:Npn \@@_offset_corners:Nnn #1#2#3 { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } + \prop_map_inline:cn { l_@@_corners_ \__int_value:w #1 _prop } + { \@@_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } } -\cs_new_protected:Npn \coffin_offset_corner:Nnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_offset_corner:Nnnnn #1#2#3#4#5#6 { \prop_put:cnx - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _prop } + { l_@@_corners_ \__int_value:w \l_@@_aligned_coffin _prop } { #1 - #2 } { { \dim_eval:n { #3 + #5 } } @@ -1401,46 +1376,46 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\coffin_update_vertical_poles:NNN} -% \begin{macro}[aux]{\coffin_update_T:nnnnnnnnN} -% \begin{macro}[aux]{\coffin_update_B:nnnnnnnnN} +% \begin{macro}{\@@_update_vertical_poles:NNN} +% \begin{macro}[aux]{\@@_update_T:nnnnnnnnN} +% \begin{macro}[aux]{\@@_update_B:nnnnnnnnN} % The \texttt{T} and \texttt{B} poles will need to be recalculated % after alignment. These functions find the larger absolute value for % the poles, but this is of course only logical when the poles are % horizontal. % \begin{macrocode} -\cs_new_protected:Npn \coffin_update_vertical_poles:NNN #1#2#3 +\cs_new_protected:Npn \@@_update_vertical_poles:NNN #1#2#3 { - \coffin_get_pole:NnN #3 { #1 -T } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #3 { #2 -T } \l_coffin_pole_b_tl - \exp_last_two_unbraced:Noo \coffin_update_T:nnnnnnnnN - \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 - \coffin_get_pole:NnN #3 { #1 -B } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #3 { #2 -B } \l_coffin_pole_b_tl - \exp_last_two_unbraced:Noo \coffin_update_B:nnnnnnnnN - \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 + \@@_get_pole:NnN #3 { #1 -T } \l_@@_pole_a_tl + \@@_get_pole:NnN #3 { #2 -T } \l_@@_pole_b_tl + \exp_last_two_unbraced:Noo \@@_update_T:nnnnnnnnN + \l_@@_pole_a_tl \l_@@_pole_b_tl #3 + \@@_get_pole:NnN #3 { #1 -B } \l_@@_pole_a_tl + \@@_get_pole:NnN #3 { #2 -B } \l_@@_pole_b_tl + \exp_last_two_unbraced:Noo \@@_update_B:nnnnnnnnN + \l_@@_pole_a_tl \l_@@_pole_b_tl #3 } -\cs_new_protected:Npn \coffin_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9 +\cs_new_protected:Npn \@@_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { T } + \@@_set_pole:Nnx #9 { T } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { T } + \@@_set_pole:Nnx #9 { T } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } } -\cs_new_protected:Npn \coffin_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 +\cs_new_protected:Npn \@@_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { B } + \@@_set_pole:Nnx #9 { B } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { B } + \@@_set_pole:Nnx #9 { B } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } } @@ -1456,556 +1431,120 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } - #1 {#2} {#3} {#4} {#5} \l_coffin_aligned_coffin + \@@_align:NnnNnnnnN \c_empty_coffin { H } { l } + #1 {#2} {#3} {#4} {#5} \l_@@_aligned_coffin \hbox_unpack:N \c_empty_box - \box_use:N \l_coffin_aligned_coffin + \box_use:N \l_@@_aligned_coffin } \cs_generate_variant:Nn \coffin_typeset:Nnnnn { c } % \end{macrocode} % \end{macro} % -% \subsection{Rotating coffins} -% -% \begin{variable}{\l_coffin_bounding_prop} -% A property list for the bounding box of a coffin. This is only needed -% during the rotation, so there is just the one. -% \begin{macrocode} -\prop_new:N \l_coffin_bounding_prop -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_coffin_bounding_shift_dim} -% The shift of the bounding box of a coffin from the real content. -% \begin{macrocode} -\dim_new:N \l_coffin_bounding_shift_dim -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_coffin_left_corner_dim} -% \begin{variable}{\l_coffin_right_corner_dim} -% \begin{variable}{\l_coffin_bottom_corner_dim} -% \begin{variable}{\l_coffin_top_corner_dim} -% These are used to hold maxima for the various corner values: these -% thus define the minimum size of the bounding box after rotation. -% \begin{macrocode} -\dim_new:N \l_coffin_left_corner_dim -\dim_new:N \l_coffin_right_corner_dim -\dim_new:N \l_coffin_bottom_corner_dim -\dim_new:N \l_coffin_top_corner_dim -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{variable} -% \end{variable} -% -% \begin{macro}{\coffin_rotate:Nn, \coffin_rotate:cn} -% Rotating a coffin requires several steps which can be conveniently -% run together. The first step is to convert the angle given in degrees -% to one in radians. This is then used to set \cs{l_coffin_sin_fp} and -% \cs{l_coffin_cos_fp}, which are carried through unchanged for the rest -% of the procedure. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_rotate:Nn #1#2 - { - \fp_set:Nn \l_coffin_internal_fp {#2} - \fp_div:Nn \l_coffin_internal_fp { 180 } - \fp_mul:Nn \l_coffin_internal_fp { \c_pi_fp } - \fp_sin:Nn \l_coffin_sin_fp { \l_coffin_internal_fp } - \fp_cos:Nn \l_coffin_cos_fp { \l_coffin_internal_fp } -% \end{macrocode} -% The corners and poles of the coffin can now be rotated around the -% origin. This is best achieved using mapping functions. -% \begin{macrocode} - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_rotate_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_rotate_pole:Nnnnnn #1 {##1} ##2 } -% \end{macrocode} -% The bounding box of the coffin needs to be rotated, and to do this -% the corners have to be found first. They are then rotated in the same -% way as the corners of the coffin material itself. -% \begin{macrocode} - \coffin_set_bounding:N #1 - \prop_map_inline:Nn \l_coffin_bounding_prop - { \coffin_rotate_bounding:nnn {##1} ##2 } -% \end{macrocode} -% At this stage, there needs to be a calculation to find where the -% corners of the content and the box itself will end up. -% \begin{macrocode} - \coffin_find_corner_maxima:N #1 - \coffin_find_bounding_shift: - \box_rotate:Nn #1 {#2} -% \end{macrocode} -% The correction of the box position itself takes place here. The idea -% is that the bounding box for a coffin is tight up to the content, and -% has the reference point at the bottom-left. The $x$-direction is -% handled by moving the content by the difference in the positions of -% the bounding box and the content left edge. The $y$-direction is -% dealt with by moving the box down by any depth it has acquired. -% \begin{macrocode} - \hbox_set:Nn #1 - { - \tex_kern:D \l_coffin_bounding_shift_dim - \tex_kern:D -\l_coffin_left_corner_dim - \box_move_down:nn { \l_coffin_bottom_corner_dim } - { \box_use:N #1 } - } -% \end{macrocode} -% If there have been any previous rotations then the size of the -% bounding box will be bigger than the contents. This can be corrected -% easily by setting the size of the box to the height and width of the -% content. -% \begin{macrocode} - \box_set_ht:Nn #1 - { \l_coffin_top_corner_dim - \l_coffin_bottom_corner_dim } - \box_set_dp:Nn #1 { 0 pt } - \box_set_wd:Nn #1 - { \l_coffin_right_corner_dim - \l_coffin_left_corner_dim } -% \end{macrocode} -% The final task is to move the poles and corners such that they are -% back in alignment with the box reference point. -% \begin{macrocode} - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_shift_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_shift_pole:Nnnnnn #1 {##1} ##2 } - } -\cs_generate_variant:Nn \coffin_rotate:Nn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_set_bounding:N} -% The bounding box corners for a coffin are easy enough to find: this -% is the same code as for the corners of the material itself, but -% using a dedicated property list. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_set_bounding:N #1 - { - \prop_put:Nnx \l_coffin_bounding_prop { tl } - { { 0 pt } { \dim_use:N \box_ht:N #1 } } - \prop_put:Nnx \l_coffin_bounding_prop { tr } - { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } - \dim_set:Nn \l_coffin_internal_dim { - \box_dp:N #1 } - \prop_put:Nnx \l_coffin_bounding_prop { bl } - { { 0 pt } { \dim_use:N \l_coffin_internal_dim } } - \prop_put:Nnx \l_coffin_bounding_prop { br } - { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l_coffin_internal_dim } } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_rotate_bounding:nnn} -% \begin{macro}{\coffin_rotate_corner:Nnnn} -% Rotating the position of the corner of the coffin is just a case -% of treating this as a vector from the reference point. The same -% treatment is used for the corners of the material itself and the -% bounding box. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_rotate_bounding:nnn #1#2#3 - { - \coffin_rotate_vector:nnNN {#2} {#3} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:Nnx \l_coffin_bounding_prop {#1} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -\cs_new_protected:Npn \coffin_rotate_corner:Nnnn #1#2#3#4 - { - \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\coffin_rotate_pole:Nnnnnn} -% Rotating a single pole simply means shifting the co-ordinate of -% the pole and its direction. The rotation here is about the bottom-left -% corner of the coffin. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_rotate_pole:Nnnnnn #1#2#3#4#5#6 - { - \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \coffin_rotate_vector:nnNN {#5} {#6} - \l_coffin_x_prime_dim \l_coffin_y_prime_dim - \coffin_set_pole:Nnx #1 {#2} - { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } - { \dim_use:N \l_coffin_x_prime_dim } - { \dim_use:N \l_coffin_y_prime_dim } - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_rotate_vector:nnNN} -% A rotation function, which needs only an input vector (as dimensions) -% and an output space. The values \cs{l_coffin_cos_fp} and -% \cs{l_coffin_sin_fp} should previously have been set up correctly. -% Working this way means that the floating point work is kept to a -% minimum: for any given rotation the sin and cosine values do no -% change, after all. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_rotate_vector:nnNN #1#2#3#4 - { - \fp_set_from_dim:Nn \l_coffin_x_fp {#1} - \fp_set_from_dim:Nn \l_coffin_y_fp {#2} - \fp_set_eq:NN \l_coffin_x_prime_fp \l_coffin_x_fp - \fp_set_eq:NN \l_coffin_internal_fp \l_coffin_y_fp - \fp_mul:Nn \l_coffin_x_prime_fp { \l_coffin_cos_fp } - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_sin_fp } - \fp_sub:Nn \l_coffin_x_prime_fp { \l_coffin_internal_fp } - \fp_set_eq:NN \l_coffin_y_prime_fp \l_coffin_y_fp - \fp_set_eq:NN \l_coffin_internal_fp \l_coffin_x_fp - \fp_mul:Nn \l_coffin_y_prime_fp { \l_coffin_cos_fp } - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_sin_fp } - \fp_add:Nn \l_coffin_y_prime_fp { \l_coffin_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_x_prime_fp } - \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_y_prime_fp } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_find_corner_maxima:N} -% \begin{macro}[aux]{\coffin_find_corner_maxima_aux:nn} -% The idea here is to find the extremities of the content of the -% coffin. This is done by looking for the smallest values for the bottom -% and left corners, and the largest values for the top and right -% corners. The values start at the maximum dimensions so that the -% case where all are positive or all are negative works out correctly. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_find_corner_maxima:N #1 - { - \dim_set:Nn \l_coffin_top_corner_dim { -\c_max_dim } - \dim_set:Nn \l_coffin_right_corner_dim { -\c_max_dim } - \dim_set:Nn \l_coffin_bottom_corner_dim { \c_max_dim } - \dim_set:Nn \l_coffin_left_corner_dim { \c_max_dim } - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_find_corner_maxima_aux:nn ##2 } - } -\cs_new_protected:Npn \coffin_find_corner_maxima_aux:nn #1#2 - { - \dim_set_min:Nn \l_coffin_left_corner_dim {#1} - \dim_set_max:Nn \l_coffin_right_corner_dim {#1} - \dim_set_min:Nn \l_coffin_bottom_corner_dim {#2} - \dim_set_max:Nn \l_coffin_top_corner_dim {#2} - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\coffin_find_bounding_shift:} -% \begin{macro}[aux]{\coffin_find_bounding_shift_aux:nn} -% The approach to finding the shift for the bounding box is similar to -% that for the corners. However, there is only one value needed here and -% a fixed input property list, so things are a bit clearer. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \coffin_find_bounding_shift: - { - \dim_set:Nn \l_coffin_bounding_shift_dim { \c_max_dim } - \prop_map_inline:Nn \l_coffin_bounding_prop - { \coffin_find_bounding_shift_aux:nn ##2 } - } -\cs_new_protected:Npn \coffin_find_bounding_shift_aux:nn #1#2 - { \dim_set_min:Nn \l_coffin_bounding_shift_dim {#1} } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\coffin_shift_corner:Nnnn} -% \begin{macro}{\coffin_shift_pole:Nnnnnn} -% Shifting the corners and poles of a coffin means subtracting the -% appropriate values from the $x$- and $y$-components. For -% the poles, this means that the direction vector is unchanged. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_shift_corner:Nnnn #1#2#3#4 - { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _ prop } {#2} - { - { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } - { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } - } - } -\cs_new_protected:Npn \coffin_shift_pole:Nnnnnn #1#2#3#4#5#6 - { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _ prop } {#2} - { - { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } - { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } - {#5} {#6} - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Resizing coffins} -% -% \begin{variable}{\l_coffin_scale_x_fp} -% \begin{variable}{\l_coffin_scale_y_fp} -% Storage for the scaling factors in $x$ and $y$, respectively. -% \begin{macrocode} -\fp_new:N \l_coffin_scale_x_fp -\fp_new:N \l_coffin_scale_y_fp -% \end{macrocode} -% \end{variable} -% \end{variable} -% -% \begin{variable}{\l_coffin_scaled_total_height_dim} -% \begin{variable}{\l_coffin_scaled_width_dim} -% When scaling, the values given have to be turned into absolute values. -% \begin{macrocode} -\dim_new:N \l_coffin_scaled_total_height_dim -\dim_new:N \l_coffin_scaled_width_dim -% \end{macrocode} -% \end{variable} -% \end{variable} -% -% \begin{macro}{\coffin_resize:Nnn, \coffin_resize:cnn} -% Resizing a coffin begins by setting up the user-friendly names for -% the dimensions of the coffin box. The new sizes are then turned into -% scale factor. This is the same operation as takes place for the -% underlying box, but that operation is grouped and so the same -% calculation is done here. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_resize:Nnn #1#2#3 - { - \coffin_set_user_dimensions:N #1 - \box_resize:Nnn #1 {#2} {#3} - \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_coffin_internal_fp { \Width } - \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_internal_fp } - \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} - \fp_set_from_dim:Nn \l_coffin_internal_fp { \TotalHeight } - \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_internal_fp } - \coffin_resize_common:Nnn #1 {#2} {#3} - } -\cs_generate_variant:Nn \coffin_resize:Nnn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_resize_common:Nnn} -% The poles and corners of the coffin are scaled to the appropriate -% places before actually resizing the underlying box. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_resize_common:Nnn #1#2#3 - { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_scale_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } -% \end{macrocode} -% Negative $x$-scaling values will place the poles in the wrong -% location: this is corrected here. -% \begin{macrocode} - \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp - { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } - } - \coffin_end_user_dimensions: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_scale:Nnn, \coffin_scale:cnn} -% For scaling, the opposite calculation is done to find the new -% dimensions for the coffin. Only the total height is needed, as this -% is the shift required for corners and poles. The scaling is done -% the \TeX{} way as this works properly with floating point values -% without needing to use the \texttt{fp} module. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_scale:Nnn #1#2#3 - { - \box_scale:Nnn #1 {#2} {#3} - \coffin_set_user_dimensions:N #1 - \fp_set:Nn \l_coffin_scale_x_fp {#2} - \fp_set:Nn \l_coffin_scale_y_fp {#3} - \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp - { \l_coffin_scaled_total_height_dim #3 \TotalHeight } - { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } - \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp - { \l_coffin_scaled_width_dim -#2 \Width } - { \l_coffin_scaled_width_dim #2 \Width } - \coffin_resize_common:Nnn #1 - { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } - } -\cs_generate_variant:Nn \coffin_scale:Nnn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_scale_vector:nnNN} -% This functions scales a vector from the origin using the pre-set scale -% factors in $x$ and $y$. This is a much less complex operation -% than rotation, and as a result the code is a lot clearer. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_scale_vector:nnNN #1#2#3#4 - { - \fp_set_from_dim:Nn \l_coffin_internal_fp {#1} - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_scale_x_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_internal_fp } - \fp_set_from_dim:Nn \l_coffin_internal_fp {#2} - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_scale_y_fp } - \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_internal_fp } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\coffin_scale_corner:Nnnn} -% \begin{macro}{\coffin_scale_pole:Nnnnnn} -% Scaling both corners and poles is a simple calculation using the -% preceding vector scaling. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_scale_corner:Nnnn #1#2#3#4 - { - \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -\cs_new_protected:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 - { - \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \coffin_set_pole:Nnx #1 {#2} - { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } - {#5} {#6} - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\coffin_x_shift_corner:Nnnn} -% \begin{macro}{\coffin_x_shift_pole:Nnnnnn} -% These functions correct for the $x$ displacement that takes -% place with a negative horizontal scaling. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 - { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { - { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} - } - } -\cs_new_protected:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 - { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } {#2} - { - { \dim_eval:n #3 + \box_wd:N #1 } {#4} - {#5} {#6} - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Coffin diagnostics} % -% \begin{variable}{\l_coffin_display_coffin} -% \begin{variable}{\l_coffin_display_coord_coffin} -% \begin{variable}{\l_coffin_display_pole_coffin} +% \begin{variable}{\l_@@_display_coffin} +% \begin{variable}{\l_@@_display_coord_coffin} +% \begin{variable}{\l_@@_display_pole_coffin} % Used for printing coffins with data structures attached. % \begin{macrocode} -\coffin_new:N \l_coffin_display_coffin -\coffin_new:N \l_coffin_display_coord_coffin -\coffin_new:N \l_coffin_display_pole_coffin +\coffin_new:N \l_@@_display_coffin +\coffin_new:N \l_@@_display_coord_coffin +\coffin_new:N \l_@@_display_pole_coffin % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} % -% \begin{variable}{\l_coffin_display_handles_prop} +% \begin{variable}{\l_@@_display_handles_prop} % This property list is used to print coffin handles at suitable % positions. The offsets are expressed as multiples of the basic offset % value, which therefore acts as a scale-factor. % \begin{macrocode} -\prop_new:N \l_coffin_display_handles_prop -\prop_put:Nnn \l_coffin_display_handles_prop { tl } +\prop_new:N \l_@@_display_handles_prop +\prop_put:Nnn \l_@@_display_handles_prop { tl } { { b } { r } { -1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { thc } +\prop_put:Nnn \l_@@_display_handles_prop { thc } { { b } { hc } { 0 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { tr } +\prop_put:Nnn \l_@@_display_handles_prop { tr } { { b } { l } { 1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vcl } +\prop_put:Nnn \l_@@_display_handles_prop { vcl } { { vc } { r } { -1 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vchc } +\prop_put:Nnn \l_@@_display_handles_prop { vchc } { { vc } { hc } { 0 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vcr } +\prop_put:Nnn \l_@@_display_handles_prop { vcr } { { vc } { l } { 1 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { bl } +\prop_put:Nnn \l_@@_display_handles_prop { bl } { { t } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { bhc } +\prop_put:Nnn \l_@@_display_handles_prop { bhc } { { t } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { br } +\prop_put:Nnn \l_@@_display_handles_prop { br } { { t } { l } { 1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Tl } +\prop_put:Nnn \l_@@_display_handles_prop { Tl } { { t } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Thc } +\prop_put:Nnn \l_@@_display_handles_prop { Thc } { { t } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Tr } +\prop_put:Nnn \l_@@_display_handles_prop { Tr } { { t } { l } { 1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hl } +\prop_put:Nnn \l_@@_display_handles_prop { Hl } { { vc } { r } { -1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hhc } +\prop_put:Nnn \l_@@_display_handles_prop { Hhc } { { vc } { hc } { 0 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hr } +\prop_put:Nnn \l_@@_display_handles_prop { Hr } { { vc } { l } { 1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Bl } +\prop_put:Nnn \l_@@_display_handles_prop { Bl } { { b } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Bhc } +\prop_put:Nnn \l_@@_display_handles_prop { Bhc } { { b } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Br } +\prop_put:Nnn \l_@@_display_handles_prop { Br } { { b } { l } { 1 } { -1 } } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_coffin_display_offset_dim} +% \begin{variable}{\l_@@_display_offset_dim} % The standard offset for the label from the handle position when % displaying handles. % \begin{macrocode} -\dim_new:N \l_coffin_display_offset_dim -\dim_set:Nn \l_coffin_display_offset_dim { 2 pt } +\dim_new:N \l_@@_display_offset_dim +\dim_set:Nn \l_@@_display_offset_dim { 2 pt } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_coffin_display_x_dim} -% \begin{variable}{\l_coffin_display_y_dim} +% \begin{variable}{\l_@@_display_x_dim} +% \begin{variable}{\l_@@_display_y_dim} % As the intersections of poles have to be calculated to find which % ones to print, there is a need to avoid repetition. This is done % by saving the intersection into two dedicated values. % \begin{macrocode} -\dim_new:N \l_coffin_display_x_dim -\dim_new:N \l_coffin_display_y_dim +\dim_new:N \l_@@_display_x_dim +\dim_new:N \l_@@_display_y_dim % \end{macrocode} % \end{variable} % \end{variable} % -% \begin{variable}{\l_coffin_display_poles_prop} +% \begin{variable}{\l_@@_display_poles_prop} % A property list for printing poles: various things need to be deleted % from this to get a \enquote{nice} output. % \begin{macrocode} -\prop_new:N \l_coffin_display_poles_prop +\prop_new:N \l_@@_display_poles_prop % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_coffin_display_font_tl} +% \begin{variable}{\l_@@_display_font_tl} % Stores the settings used to print coffin data: this keeps things % flexible. % \begin{macrocode} -\tl_new:N \l_coffin_display_font_tl +\tl_new:N \l_@@_display_font_tl %<*initex> -\tl_set:Nn \l_coffin_display_font_tl { } % TODO +\tl_set:Nn \l_@@_display_font_tl { } % TODO %</initex> %<*package> -\tl_set:Nn \l_coffin_display_font_tl { \sffamily \tiny } +\tl_set:Nn \l_@@_display_font_tl { \sffamily \tiny } %</package> % \end{macrocode} % \end{variable} % % \begin{macro}{\coffin_mark_handle:Nnnn, \coffin_mark_handle:cnnn} -% \begin{macro}[aux]{\coffin_mark_handle_aux:nnnnNnn} +% \begin{macro}[aux]{\@@_mark_handle_aux:nnnnNnn} % Marking a single handle is relatively easy. The standard attachment % function is used, meaning that there are two calculations for the % location. However, this is likely to be okay given the load expected. @@ -2014,7 +1553,7 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_mark_handle:Nnnn #1#2#3#4 { - \hcoffin_set:Nn \l_coffin_display_pole_coffin + \hcoffin_set:Nn \l_@@_display_pole_coffin { %<*initex> \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO @@ -2025,8 +1564,8 @@ %</package> } \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } - \hcoffin_set:Nn \l_coffin_display_coord_coffin + \l_@@_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } + \hcoffin_set:Nn \l_@@_display_coord_coffin { %<*initex> % TODO @@ -2034,37 +1573,37 @@ %<*package> \color {#4} %</package> - \l_coffin_display_font_tl + \l_@@_display_font_tl ( \tl_to_str:n { #2 , #3 } ) } - \prop_get:NnN \l_coffin_display_handles_prop - { #2 #3 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l_@@_display_handles_prop + { #2 #3 } \l_@@_internal_tl + \quark_if_no_value:NTF \l_@@_internal_tl { - \prop_get:NnN \l_coffin_display_handles_prop - { #3 #2 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l_@@_display_handles_prop + { #3 #2 } \l_@@_internal_tl + \quark_if_no_value:NTF \l_@@_internal_tl { \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_coffin_display_coord_coffin { l } { vc } + \l_@@_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } } { - \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn - \l_coffin_internal_tl #1 {#2} {#3} + \exp_last_unbraced:No \@@_mark_handle_aux:nnnnNnn + \l_@@_internal_tl #1 {#2} {#3} } } { - \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn - \l_coffin_internal_tl #1 {#2} {#3} + \exp_last_unbraced:No \@@_mark_handle_aux:nnnnNnn + \l_@@_internal_tl #1 {#2} {#3} } } -\cs_new_protected:Npn \coffin_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \@@_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 { \coffin_attach_mark:NnnNnnnn #5 {#6} {#7} - \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } - { #4 \l_coffin_display_offset_dim } + \l_@@_display_coord_coffin {#1} {#2} + { #3 \l_@@_display_offset_dim } + { #4 \l_@@_display_offset_dim } } \cs_generate_variant:Nn \coffin_mark_handle:Nnnn { c } % \end{macrocode} @@ -2072,9 +1611,9 @@ % \end{macro} % % \begin{macro}{\coffin_display_handles:Nn, \coffin_display_handles:cn} -% \begin{macro}[aux]{\coffin_display_handles_aux:nnnnnn} -% \begin{macro}[aux]{\coffin_display_handles_aux:nnnn} -% \begin{macro}[aux]{\coffin_display_attach:Nnnnn} +% \begin{macro}[aux]{\@@_display_handles_aux:nnnnnn} +% \begin{macro}[aux]{\@@_display_handles_aux:nnnn} +% \begin{macro}[aux]{\@@_display_attach:Nnnnn} % Printing the poles starts by removing any duplicates, for which the % \texttt{H} poles is used as the definitive version for the baseline % and bottom. Two loops are then used to find the combinations of @@ -2083,7 +1622,7 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_display_handles:Nn #1#2 { - \hcoffin_set:Nn \l_coffin_display_pole_coffin + \hcoffin_set:Nn \l_@@_display_pole_coffin { %<*initex> \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO @@ -2093,22 +1632,22 @@ \rule { 1 pt } { 1 pt } %</package> } - \prop_set_eq:Nc \l_coffin_display_poles_prop - { l_coffin_poles_ \int_value:w #1 _prop } - \coffin_get_pole:NnN #1 { H } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #1 { T } \l_coffin_pole_b_tl - \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl - { \prop_del:Nn \l_coffin_display_poles_prop { T } } - \coffin_get_pole:NnN #1 { B } \l_coffin_pole_b_tl - \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl - { \prop_del:Nn \l_coffin_display_poles_prop { B } } - \coffin_set_eq:NN \l_coffin_display_coffin #1 - \prop_map_inline:Nn \l_coffin_display_poles_prop + \prop_set_eq:Nc \l_@@_display_poles_prop + { l_@@_poles_ \__int_value:w #1 _prop } + \@@_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 + { \prop_remove:Nn \l_@@_display_poles_prop { T } } + \@@_get_pole:NnN #1 { B } \l_@@_pole_b_tl + \tl_if_eq:NNT \l_@@_pole_a_tl \l_@@_pole_b_tl + { \prop_remove:Nn \l_@@_display_poles_prop { B } } + \coffin_set_eq:NN \l_@@_display_coffin #1 + \prop_map_inline:Nn \l_@@_display_poles_prop { - \prop_del:Nn \l_coffin_display_poles_prop {##1} - \coffin_display_handles_aux:nnnnnn {##1} ##2 {#2} + \prop_remove:Nn \l_@@_display_poles_prop {##1} + \@@_display_handles_aux:nnnnnn {##1} ##2 {#2} } - \box_use:N \l_coffin_display_coffin + \box_use:N \l_@@_display_coffin } % \end{macrocode} % For each pole there is a check for an intersection, which here does @@ -2116,20 +1655,20 @@ % and used to align the pole coffin with the main coffin for output. % The positions are recovered from the preset list if available. % \begin{macrocode} -\cs_new_protected:Npn \coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_display_handles_aux:nnnnnn #1#2#3#4#5#6 { - \prop_map_inline:Nn \l_coffin_display_poles_prop + \prop_map_inline:Nn \l_@@_display_poles_prop { - \bool_set_false:N \l_coffin_error_bool - \coffin_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2 - \bool_if:NF \l_coffin_error_bool + \bool_set_false:N \l_@@_error_bool + \@@_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2 + \bool_if:NF \l_@@_error_bool { - \dim_set:Nn \l_coffin_display_x_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_display_y_dim { \l_coffin_y_dim } - \coffin_display_attach:Nnnnn - \l_coffin_display_pole_coffin { hc } { vc } + \dim_set:Nn \l_@@_display_x_dim { \l_@@_x_dim } + \dim_set:Nn \l_@@_display_y_dim { \l_@@_y_dim } + \@@_display_attach:Nnnnn + \l_@@_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } - \hcoffin_set:Nn \l_coffin_display_coord_coffin + \hcoffin_set:Nn \l_@@_display_coord_coffin { %<*initex> % TODO @@ -2137,40 +1676,40 @@ %<*package> \color {#6} %</package> - \l_coffin_display_font_tl + \l_@@_display_font_tl ( \tl_to_str:n { #1 , ##1 } ) } - \prop_get:NnN \l_coffin_display_handles_prop - { #1 ##1 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l_@@_display_handles_prop + { #1 ##1 } \l_@@_internal_tl + \quark_if_no_value:NTF \l_@@_internal_tl { - \prop_get:NnN \l_coffin_display_handles_prop - { ##1 #1 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l_@@_display_handles_prop + { ##1 #1 } \l_@@_internal_tl + \quark_if_no_value:NTF \l_@@_internal_tl { - \coffin_display_attach:Nnnnn - \l_coffin_display_coord_coffin { l } { vc } + \@@_display_attach:Nnnnn + \l_@@_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } } { \exp_last_unbraced:No - \coffin_display_handles_aux:nnnn - \l_coffin_internal_tl + \@@_display_handles_aux:nnnn + \l_@@_internal_tl } } { - \exp_last_unbraced:No \coffin_display_handles_aux:nnnn - \l_coffin_internal_tl + \exp_last_unbraced:No \@@_display_handles_aux:nnnn + \l_@@_internal_tl } } } } -\cs_new_protected:Npn \coffin_display_handles_aux:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_display_handles_aux:nnnn #1#2#3#4 { - \coffin_display_attach:Nnnnn - \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } - { #4 \l_coffin_display_offset_dim } + \@@_display_attach:Nnnnn + \l_@@_display_coord_coffin {#1} {#2} + { #3 \l_@@_display_offset_dim } + { #4 \l_@@_display_offset_dim } } \cs_generate_variant:Nn \coffin_display_handles:Nn { c } % \end{macrocode} @@ -2179,29 +1718,29 @@ % and stored for the display coffin the code simply uses it directly, % with no calculation. % \begin{macrocode} -\cs_new_protected:Npn \coffin_display_attach:Nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \@@_display_attach:Nnnnn #1#2#3#4#5 { - \coffin_calculate_intersection:Nnn #1 {#2} {#3} - \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } - \dim_set:Nn \l_coffin_offset_x_dim - { \l_coffin_display_x_dim - \l_coffin_x_prime_dim + #4 } - \dim_set:Nn \l_coffin_offset_y_dim - { \l_coffin_display_y_dim - \l_coffin_y_prime_dim + #5 } - \hbox_set:Nn \l_coffin_aligned_coffin + \@@_calculate_intersection:Nnn #1 {#2} {#3} + \dim_set:Nn \l_@@_x_prime_dim { \l_@@_x_dim } + \dim_set:Nn \l_@@_y_prime_dim { \l_@@_y_dim } + \dim_set:Nn \l_@@_offset_x_dim + { \l_@@_display_x_dim - \l_@@_x_prime_dim + #4 } + \dim_set:Nn \l_@@_offset_y_dim + { \l_@@_display_y_dim - \l_@@_y_prime_dim + #5 } + \hbox_set:Nn \l_@@_aligned_coffin { - \box_use:N \l_coffin_display_coffin - \tex_kern:D -\box_wd:N \l_coffin_display_coffin - \tex_kern:D \l_coffin_offset_x_dim - \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #1 } + \box_use:N \l_@@_display_coffin + \tex_kern:D -\box_wd:N \l_@@_display_coffin + \tex_kern:D \l_@@_offset_x_dim + \box_move_up:nn { \l_@@_offset_y_dim } { \box_use:N #1 } } - \box_set_ht:Nn \l_coffin_aligned_coffin - { \box_ht:N \l_coffin_display_coffin } - \box_set_dp:Nn \l_coffin_aligned_coffin - { \box_dp:N \l_coffin_display_coffin } - \box_set_wd:Nn \l_coffin_aligned_coffin - { \box_wd:N \l_coffin_display_coffin } - \box_set_eq:NN \l_coffin_display_coffin \l_coffin_aligned_coffin + \box_set_ht:Nn \l_@@_aligned_coffin + { \box_ht:N \l_@@_display_coffin } + \box_set_dp:Nn \l_@@_aligned_coffin + { \box_dp:N \l_@@_display_coffin } + \box_set_wd:Nn \l_@@_aligned_coffin + { \box_wd:N \l_@@_display_coffin } + \box_set_eq:NN \l_@@_display_coffin \l_@@_aligned_coffin } % \end{macrocode} % \end{macro} @@ -2216,13 +1755,13 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_show_structure:N #1 { - \coffin_if_exist:NT #1 + \@@_if_exist:NT #1 { - \msg_aux_show:Nnx #1 { coffins } + \__msg_show_variable:Nnn #1 { coffins } { \prop_map_function:cN - { l_coffin_poles_ \int_value:w #1 _prop } - \msg_aux_show_unbraced:nn + { l_@@_poles_ \__int_value:w #1 _prop } + \__msg_show_item_unbraced:nn } } } @@ -2233,7 +1772,7 @@ % \subsection{Messages} % % \begin{macrocode} -\msg_kernel_new:nnnn { coffins } { no-pole-intersection } +\__msg_kernel_new:nnnn { kernel } { no-pole-intersection } { No~intersection~between~coffin~poles. } { \c_msg_coding_error_text_tl @@ -2241,17 +1780,17 @@ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. } -\msg_kernel_new:nnnn { coffins } { unknown-coffin } +\__msg_kernel_new:nnnn { kernel } { unknown-coffin } { Unknown~coffin~'#1'. } { The~coffin~'#1'~was~never~defined. } -\msg_kernel_new:nnnn { coffins } { unknown-coffin-pole } +\__msg_kernel_new:nnnn { kernel } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~ but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong. } -\msg_kernel_new:nnn { coffins } { show } +\__msg_kernel_new:nnn { kernel } { show-coffins } { Size~of~coffin~\token_to_str:N #1 : \\ > ~ ht~=~\dim_use:N \box_ht:N #1 \\ |