diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx | 536 |
1 files changed, 312 insertions, 224 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 8feef032c77..197f62c3960 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -1,5 +1,5 @@ % \iffalse meta-comment -% +% %% File: l3coffins.dtx Copyright(C) 2010,2011 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3coffins.dtx 2717 2011-09-03 13:40:31Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 2814 2011-09-12 12:56:08Z joseph $ {L3 Experimental coffin code layer} %</driver|package> %<*driver> @@ -46,13 +46,13 @@ \end{document} %</driver> % \fi -% +% % \title{^^A % The \textsf{l3coffins} package\\ Coffin code layer^^A % \thanks{This file describes v\ExplFileVersion, % last revised \ExplFileDate.}^^A % } -% +% % \author{^^A % The \LaTeX3 Project\thanks % {^^A @@ -73,17 +73,17 @@ % the \pkg{xcoffins} module (in the \pkg{l3experimental} bundle). % % \section{Creating and initialising coffins} -% -% \begin{function}{\coffin_new:N, \coffin_new:c} +% +% \begin{function}[added = 2011-08-17]{\coffin_new:N, \coffin_new:c} % \begin{syntax} % \cs{coffin_new:N} \meta{coffin} % \end{syntax} % Creates a new \meta{coffin} or raises an error if the name is -% already taken. The declaration is global. The \meta{coffin} will +% already taken. The declaration is global. The \meta{coffin} will % initially be empty. % \end{function} % -% \begin{function}{\coffin_clear:N, \coffin_clear:c} +% \begin{function}[added = 2011-08-17]{\coffin_clear:N, \coffin_clear:c} % \begin{syntax} % \cs{coffin_clear:N} \meta{coffin} % \end{syntax} @@ -91,7 +91,7 @@ % group level. % \end{function} % -%\begin{function} +% \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} @@ -99,10 +99,14 @@ % Sets both the content and poles of \meta{coffin1} equal to those % of \meta{coffin2} within the current \TeX\ group level. % \end{function} -% +% % \section{Setting coffin content and poles} % -% \begin{function}{\hcoffin_set:Nn, \hcoffin_set:cn} +% All coffin functions create and manipulate coffins locally within the +% current \TeX\ group level. +% +% \begin{function}[added = 2011-08-17, updated = 2011-09-03] +% {\hcoffin_set:Nn, \hcoffin_set:cn} % \begin{syntax} % \cs{hcoffin_set:Nn} \meta{coffin} \Arg{material} % \end{syntax} @@ -111,100 +115,125 @@ % then set up based on the size of the typeset material. % \end{function} % -% \begin{function}{\vcoffin_set:Nnn, \vcoffin_set:cnn} +% \begin{function}[added = 2011-09-10] +% {\hcoffin_set:Nw, \hcoffin_set:cw, \hcoffin_set_end:} +% \begin{syntax} +% \cs{hcoffin_set:Nw} \meta{coffin} \Arg{material} \cs{hcoffin_set_end:} +% \end{syntax} +% Typesets the \meta{material} in horizontal mode, storing the result +% in the \meta{coffin}. The standard poles for the \meta{coffin} are +% then set up based on the size of the typeset material. +% These functions are useful for setting the entire contents of an +% environment in a coffin. +% \end{function} +% +% \begin{function}[added = 2011-08-17, updated = 2011-09-03 +% ]{\vcoffin_set:Nnn, \vcoffin_set:cnn} % \begin{syntax} % \cs{vcoffin_set:Nnn} \meta{coffin} \Arg{width} \Arg{material} % \end{syntax} % Typesets the \meta{material} in vertical mode constrained to the % given \meta{width} and stores the result in the \meta{coffin}. The -% standard poles for the \meta{coffin} are then set up based on the +% standard poles for the \meta{coffin} are then set up based on the % size of the typeset material. % \end{function} % -% \begin{function} +% \begin{function}[added = 2011-09-10] +% {\vcoffin_set:Nnw, \vcoffin_set:cnw, \vcoffin_set_end:} +% \begin{syntax} +% \cs{vcoffin_set:Nnw} \meta{coffin} \Arg{width} \Arg{material} \cs{vcoffin_set_end:} +% \end{syntax} +% Typesets the \meta{material} in vertical mode constrained to the +% given \meta{width} and stores the result in the \meta{coffin}. The +% standard poles for the \meta{coffin} are then set up based on the +% size of the typeset material. +% These functions are useful for setting the entire contents of an +% environment in a coffin. +% \end{function} +% +% \begin{function}[added = 2011-08-17] % {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn} % \begin{syntax} -% \cs{coffin_set_horizontal_pole:Nnn} \meta{coffin} +% \cs{coffin_set_horizontal_pole:Nnn} \meta{coffin} % ~~\Arg{pole} \Arg{offset} % \end{syntax} % Sets the \meta{pole} to run horizontally through the \meta{coffin}. % The \meta{pole} will be located at the \meta{offset} from the % bottom edge of the bounding box of the \meta{coffin}. The % \meta{offset} should be given as a dimension expression; this may -% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and -% \cs{Width}, which will evaluate to the appropriate dimensions of +% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and +% \cs{Width}, which will evaluate to the appropriate dimensions of % the \meta{coffin}. % \end{function} % -% \begin{function} +% \begin{function}[added = 2011-08-17] % {\coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn} % \begin{syntax} -% \cs{coffin_set_vertical_pole:Nnn} \meta{coffin} -% ~~\Arg{pole} \Arg{offset} +% \cs{coffin_set_vertical_pole:Nnn} \meta{coffin} \Arg{pole} \Arg{offset} % \end{syntax} % Sets the \meta{pole} to run vertically through the \meta{coffin}. % The \meta{pole} will be located at the \meta{offset} from the % left-hand edge of the bounding box of the \meta{coffin}. The % \meta{offset} should be given as a dimension expression; this may -% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and -% \cs{Width}, which will evaluate to the appropriate dimensions of +% include the terms \cs{TotalHeight}, \cs{Height}, \cs{Depth} and +% \cs{Width}, which will evaluate to the appropriate dimensions of % the \meta{coffin}. % \end{function} -% +% % \section{Coffin transformations} -% -% \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn} +% +% \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 +% 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}{\coffin_rotate:Nn, \coffin_rotate:cn} +% +% \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 +% coffin content and poles. Multiple rotations will not result in % the bounding box of the coffin growing unnecessarily. % \end{function} % -% \begin{function}{\coffin_scale:Nnn, \coffin_scale:cnn} +% \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, +% 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} -% { +% { % \coffin_attach:NnnNnnnn, \coffin_attach:cnnNnnnn, % \coffin_attach:Nnncnnnn, \coffin_attach:cnncnnnn % } % \begin{syntax} -% \cs{coffin_attach:NnnNnnnn} +% \cs{coffin_attach:NnnNnnnn} % ~~\meta{coffin1} \Arg{coffin1-pole1} \Arg{coffin1-pole2} % ~~\meta{coffin2} \Arg{coffin2-pole1} \Arg{coffin2-pole2} % ~~\Arg{x-offset} \Arg{y-offset} % \end{syntax} -% This function carries out alignment such that the bounding box +% This function attaches <coffin2> to <coffin1> such that the bounding box % of \meta{coffin1} is not altered, \emph{i.e.}~\meta{coffin2} can -% protrude outside of the bounding box of the coffin. The alignment +% 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 +% 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 @@ -214,19 +243,19 @@ % \end{function} % % \begin{function} -% { +% { % \coffin_join:NnnNnnnn, \coffin_join:cnnNnnnn, % \coffin_join:Nnncnnnn, \coffin_join:cnncnnnn % } % \begin{syntax} -% \cs{coffin_join:NnnNnnnn} +% \cs{coffin_join:NnnNnnnn} % ~~\meta{coffin1} \Arg{coffin1-pole1} \Arg{coffin1-pole2} % ~~\meta{coffin2} \Arg{coffin2-pole1} \Arg{coffin2-pole2} % ~~\Arg{x-offset} \Arg{y-offset} % \end{syntax} -% This function carries out alignment such that the bounding box -% of \meta{coffin1} after the process will expand. The new bounding -% box will cover the area contain the bounding boxes of the two +% This function joins <coffin2> to <coffin1> such that the bounding box +% of \meta{coffin1} 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 @@ -244,37 +273,38 @@ % \end{syntax} % Typesetting is carried out by first calculating \meta{handle}, the % point of intersection of \meta{pole1} and \meta{pole2}. The coffin -% is then typeset such that the relationship between the current +% 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 -% be given as dimension expressions. Typesetting a coffin is -% therefore analogous to carrying out an alignment where the +% by the \meta{x-offset} and \meta{y-offset}. The two offsets should +% be given as dimension expressions. Typesetting a coffin is +% therefore analogous to carrying out an alignment where the % \enquote{parent} coffin is the current insertion point. % \end{function} -% +% % \section{Coffin diagnostics} % -% \begin{function}{\coffin_display_handles:cn, \coffin_display_handles:cn} +% \begin{function}[updated = 2011-09-02] +% {\coffin_display_handles:cn, \coffin_display_handles:cn} % \begin{syntax} % \cs{coffin_display_handles:Nn} \meta{coffin} \Arg{colour} % \end{syntax} % This function first calculates the intersections between all of -% the \meta{poles} of the \meta{coffin} to give a set of -% \meta{handles}. It then prints the \meta{coffin} at the current -% location in the source, with the position of the \meta{handles} -% marked on the coffin. The \meta{handles} will be labelled as part -% of this process: the locations of the \meta{handles} and the labels +% the \meta{poles} of the \meta{coffin} to give a set of +% \meta{handles}. It then prints the \meta{coffin} at the current +% location in the source, with the position of the \meta{handles} +% marked on the coffin. The \meta{handles} will be labelled as part +% of this process: the locations of the \meta{handles} and the labels % are both printed in the \meta{colour} specified. % \end{function} % -% \begin{function}{\coffin_mark_handle:Nnnn, \coffin_mark_handle:cnnn} +% \begin{function}[updated = 2011-09-02] +% {\coffin_mark_handle:Nnnn, \coffin_mark_handle:cnnn} % \begin{syntax} -% \cs{coffin_mark_handle:Nnnn} \meta{coffin} \Arg{pole1} \Arg{pole2} -% ~~\Arg{colour} +% \cs{coffin_mark_handle:Nnnn} \meta{coffin} \Arg{pole1} \Arg{pole2} \Arg{colour} % \end{syntax} -% This function first calculates the \meta{handle} for the +% 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{pole2}. 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. @@ -285,13 +315,13 @@ % \cs{coffin_show_structure:N} \meta{coffin} % \end{syntax} % This function shows the structural information about the -% \meta{coffin} in the terminal. The width, height and depth of the -% typeset material are given, along with the location of all of the -% poles of the coffin. -% +% \meta{coffin} in the terminal. The width, height and depth of the +% typeset material are given, along with the location of all of the +% poles of the coffin. +% % Notice that the poles of a coffin are defined by four values: -% the $x$ and $y$ co-ordinates of a point that the pole -% passes through and the $x$- and $y$-components of a +% the $x$ and $y$ co-ordinates of a point that the pole +% passes through and the $x$- and $y$-components of a % vector denoting the direction of the pole. It is the ratio between % the later, rather than the absolute values, which determines the % direction of the pole. @@ -302,11 +332,11 @@ % \begin{implementation} % % \section{\pkg{l3coffins} Implementation} -% +% % \begin{macrocode} %<*initex|package> % \end{macrocode} -% +% % \begin{macrocode} %<*package> \ProvidesExplPackage @@ -334,7 +364,7 @@ % \end{variable} % % \begin{variable}{\c_coffin_corners_prop} -% The \enquote{corners}; of a coffin define the real content, as +% 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} @@ -345,7 +375,7 @@ \prop_put:Nnn \c_coffin_corners_prop { br } { { 0 pt } { 0 pt } } % \end{macrocode} % \end{variable} -% +% % \begin{variable}{\c_coffin_poles_prop} % Pole positions are given for horizontal, vertical and reference-point % based values. @@ -443,7 +473,7 @@ % \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 +% 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 @@ -507,7 +537,7 @@ { \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 } } @@ -519,7 +549,7 @@ } % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\coffin_clear:N, \coffin_clear:c} % Clearing coffins means emptying the box and resetting all of the % structures. @@ -535,22 +565,22 @@ \cs_generate_variant:Nn \coffin_clear: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{l_\ldots} variables has -% to be broken. +% to be broken. % \begin{macrocode} \cs_new_protected_nopar: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 } + \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 } + \prop_gset_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } \c_coffin_poles_prop } \cs_generate_variant:Nn \coffin_new:N { c } @@ -565,12 +595,12 @@ { \coffin_if_exist:NT #1 { - \hbox_set:Nn #1 - { + \hbox_set:Nn #1 + { \color_group_begin: \color_ensure_current: - #2 - \color_group_end: + #2 + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -582,23 +612,23 @@ % \end{macro} % % \begin{macro}{\vcoffin_set:Nnn, \vcoffin_set:cnn} -% Setting vertical coffins is more complex. First, the material is +% 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 +% for a horizontal coffin, before finding the top baseline using a % temporary box. % \begin{macrocode} \cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3 { \coffin_if_exist:NT #1 { - \vbox_set:Nn #1 + \vbox_set:Nn #1 { \dim_set:Nn \tex_hsize:D {#2} \color_group_begin: \color_ensure_current: - #3 - \color_group_end: - } + #3 + \color_group_end: + } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 \coffin_update_corners:N #1 @@ -617,6 +647,70 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\hcoffin_set:Nw, \hcoffin_set:cw} +% \begin{macro}{\hcoffin_set_end:} +% These are the \enquote{begin}/\enquote{end} versions of the above: +% watch the grouping! +% \begin{macrocode} +\cs_new_protected_nopar:Npn \hcoffin_set:Nw #1 + { + \coffin_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 + } + } + } +\cs_new_protected_nopar:Npn \hcoffin_set_end: { } +\cs_generate_variant:Nn \hcoffin_set:Nw { c } +% \end{macrocode} +% +% \end{macro}\end{macro} +% +% \begin{macro}{\vcoffin_set:Nnw, \vcoffin_set:cnw} +% \begin{macro}{\vcoffin_set_end:} +% The same for vertical coffins. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \vcoffin_set:Nnw #1#2 + { + \coffin_if_exist:NT #1 + { + \vbox_set:Nw #1 + \dim_set:Nn \tex_hsize:D {#2} + \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_tmp_box { \vbox_unpack:N #1 } + \coffin_set_pole:Nnx #1 { T } + { + { 0 pt } + { + \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_tmp_box } + } + { 1000 pt } + { 0 pt } + } + \box_clear:N \l_coffin_tmp_box + } + } + } +\cs_new_protected_nopar:Npn \vcoffin_set_end: { } +\cs_generate_variant:Nn \vcoffin_set:Nnw { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro} % { % \coffin_set_eq:NN, \coffin_set_eq:Nc, @@ -655,14 +749,14 @@ % \subsection{Coffins: handle and pole management} % % \begin{macro}{\coffin_get_pole:NnN} -% A simple wrapper around the recovery of a coffin pole, with some +% A simple wrapper around the recovery of a coffin pole, with some % error checking and recovery built-in. % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_get_pole:NnN #1#2#3 { \prop_get:cnNF { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 - { + { \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } @@ -676,15 +770,15 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_reset_structure:N #1 { - \prop_set_eq:cN { l_coffin_corners_ \int_value:w #1 _prop } + \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 } + \prop_set_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } \c_coffin_poles_prop } % \end{macrocode} % \end{macro} % -% \begin{macro}{\coffin_set_eq_structure:NN} +% \begin{macro}{\coffin_set_eq_structure:NN,\coffin_gset_eq_structure:NN} % Setting coffin structures equal simply means copying the property % list. % \begin{macrocode} @@ -695,6 +789,13 @@ \prop_set_eq:cc { l_coffin_poles_ \int_value:w #1 _prop } { l_coffin_poles_ \int_value:w #2 _prop } } +\cs_new_protected_nopar:Npn \coffin_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 } + } % \end{macrocode} % \end{macro} % @@ -741,7 +842,7 @@ % {\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} -% Setting the pole of a coffin at the user/designer level requires a +% 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 % three-argument version is used internally to do a direct setting. @@ -754,7 +855,7 @@ \coffin_set_pole:Nnx #1 {#2} { { 0 pt } { \dim_eval:n {#3} } - { 1000 pt } { 0 pt } + { 1000 pt } { 0 pt } } \coffin_end_user_dimensions: } @@ -766,7 +867,7 @@ \coffin_set_user_dimensions:N #1 \coffin_set_pole:Nnx #1 {#2} { - { \dim_eval:n {#3} } { 0 pt } + { \dim_eval:n {#3} } { 0 pt } { 0 pt } { 1000 pt } } \coffin_end_user_dimensions: @@ -795,7 +896,7 @@ { { \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 } { { 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_coffin_corners_ \int_value:w #1 _prop } { br } { { \dim_use:N \box_wd:N #1 } { \dim_eval:n { - \box_dp:N #1 } } } } % \end{macrocode} @@ -810,17 +911,17 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_update_poles:N #1 { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { hc } + \prop_put:cnx { l_coffin_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_coffin_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_coffin_poles_ \int_value:w #1 _prop } { vc } { { 0 pt } { \dim_eval:n { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } } @@ -834,7 +935,7 @@ { 1000 pt } { 0 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { b } + \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { b } { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } @@ -852,7 +953,7 @@ % \begin{macro}[aux]{\coffin_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 +% may of course not be an intersection, for which an error trap is % needed. % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_calculate_intersection:Nnn #1#2#3 @@ -864,7 +965,7 @@ \coffin_calculate_intersection:nnnnnnnn \l_coffin_pole_a_tl \l_coffin_pole_b_tl \bool_if:NT \l_coffin_error_bool - { + { \msg_kernel_error:nn { coffins } { no-pole-intersection } \dim_zero:N \l_coffin_x_dim \dim_zero:N \l_coffin_y_dim @@ -872,18 +973,18 @@ } % \end{macrocode} % The two poles passed here each have four values (as dimensions), -% ($a$, $b$, $c$, $d$) and -% ($a'$, $b'$, $c'$, $d'$). These are arguments +% ($a$, $b$, $c$, $d$) and +% ($a'$, $b'$, $c'$, $d'$). These are arguments % $1$--$4$ and $5$--$8$, respectively. In both -% cases $a$ and $b$ are the co-ordinates of a point on the +% cases $a$ and $b$ are the co-ordinates of a point on the % pole and $c$ and $d$ define the direction of the pole. Finding -% the intersection depends on the directions of the poles, which are +% the intersection depends on the directions of the poles, which are % given by $d / c$ and $d' / c'$. However, if one of the poles % 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_nopar:Npn \coffin_calculate_intersection:nnnnnnnn - #1#2#3#4#5#6#7#8 + #1#2#3#4#5#6#7#8 { \dim_compare:nNnTF {#3} = { \c_zero_dim } % \end{macrocode} @@ -896,7 +997,7 @@ \dim_compare:nNnTF {#7} = \c_zero_dim { \bool_set_true:N \l_coffin_error_bool } % \end{macrocode} -% The second pole may still be horizontal, in which case the +% The second pole may still be horizontal, in which case the % $y$-component of the intersection will be $b'$. If not, % \[ % y = \frac{d'}{c'} \left ( x - a' \right ) + b' @@ -907,7 +1008,7 @@ { \dim_compare:nNnTF {#8} = \c_zero_dim { \dim_set:Nn \l_coffin_y_dim {#6} } - { + { \coffin_calculate_intersection_aux:nnnnnN {#1} {#5} {#6} {#7} {#8} \l_coffin_y_dim } @@ -935,10 +1036,10 @@ % \] % which is again handled by the same auxiliary. % \begin{macrocode} - { + { \coffin_calculate_intersection_aux:nnnnnN {#2} {#6} {#5} {#8} {#7} \l_coffin_x_dim - } + } } } % \end{macrocode} @@ -950,23 +1051,23 @@ { \dim_compare:nNnTF {#7} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#5} + \dim_set:Nn \l_coffin_x_dim {#5} \coffin_calculate_intersection_aux:nnnnnN {#5} {#1} {#2} {#3} {#4} \l_coffin_y_dim } { \dim_compare:nNnTF {#8} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#6} + \dim_set:Nn \l_coffin_x_dim {#6} \coffin_calculate_intersection_aux:nnnnnN {#6} {#2} {#1} {#4} {#3} \l_coffin_x_dim } % \end{macrocode} -% If none of the special cases apply then there is still a need to +% 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} @@ -986,12 +1087,12 @@ % and noting that the two ratios are already worked out from the test % just performed. There is quite a bit of shuffling from dimensions to % floating points in order to do the work. The $y$-values is then -% worked out using the standard auxiliary starting from the +% worked out using the standard auxiliary starting from the % $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_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} @@ -1029,7 +1130,7 @@ % |#2| and |#3| are co-ordinates. % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_calculate_intersection_aux:nnnnnN - #1#2#3#4#5#6 + #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} @@ -1062,10 +1163,10 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN + \coffin_align:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin % \end{macrocode} -% Correct the placement of the reference point. If the $x$-offset +% 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 % of that of the first, which is corrected using a kern. On the right % side the first box might stick out, which will show up if it is wider @@ -1076,11 +1177,11 @@ { \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 + \hbox_unpack:N \l_coffin_aligned_coffin \dim_set:Nn \l_coffin_tmp_dim { \l_coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } \dim_compare:nNnT \l_coffin_tmp_dim < \c_zero_dim - { \tex_kern:D -\l_coffin_tmp_dim } + { \tex_kern:D -\l_coffin_tmp_dim } } % \end{macrocode} % The coffin structure is reset, and the corners are cleared: only @@ -1105,12 +1206,12 @@ { \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } \coffin_offset_poles:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + { \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 } + { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } } - \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin + \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin \coffin_set_eq:NN #1 \l_coffin_aligned_coffin } \cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } @@ -1131,7 +1232,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN + \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 } @@ -1143,13 +1244,13 @@ \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 } + { \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 } \cs_new_protected_nopar:Npn \coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN + \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 } @@ -1168,7 +1269,7 @@ % of the input coffins. Those for the first coffin are worked out after % those for the second coffin, as this allows the `primed' % storage area to be used for the second coffin. The `real' box -% offsets are then calculated, before using these to re-box the +% offsets are then calculated, before using these to re-box the % 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} @@ -1182,7 +1283,7 @@ { \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 + \hbox_set:Nn \l_coffin_aligned_internal_coffin { \box_use:N #1 \tex_kern:D -\box_wd:N #1 @@ -1190,7 +1291,7 @@ \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #4 } } \coffin_set_eq:NN #9 \l_coffin_aligned_internal_coffin - } + } % \end{macrocode} % \end{macro} % @@ -1223,7 +1324,7 @@ { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } {#5} {#6} - } + } } % \end{macrocode} % \end{macro} @@ -1242,7 +1343,7 @@ } \cs_new_protected_nopar:Npn \coffin_offset_corner:Nnnnn #1#2#3#4#5#6 { - \prop_put:cnx + \prop_put:cnx { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _prop } { #1 - #2 } { @@ -1277,11 +1378,11 @@ { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { T } + \coffin_set_pole:Nnx #9 { T } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { T } + \coffin_set_pole:Nnx #9 { T } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } } @@ -1289,11 +1390,11 @@ { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { B } + \coffin_set_pole:Nnx #9 { B } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { B } + \coffin_set_pole:Nnx #9 { B } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } } @@ -1304,27 +1405,14 @@ % % \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. This is done -% using the same approach as \cs{coffin_align:NnnNnnnnN} but without the -% offset corrections (which would be thrown away). The same is true -% for overlaying coffins, which uses the known size of an empty -% box! +% which is done using a coffin with no content at all. As well as aligning to +% the empty coffin, there is also a need to leave vertical mode, if necessary. % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } + \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } #1 {#2} {#3} {#4} {#5} \l_coffin_aligned_coffin - \hbox_set:Nn \l_coffin_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_tmp_dim - { \l_coffin_offset_x_dim + \box_wd:N #1 } - \dim_compare:nNnT { \l_coffin_tmp_dim } < \c_zero_dim - { \tex_kern:D -\l_coffin_tmp_dim } - } - \hbox_unpack:N \c_empty_box + \hbox_unpack:N \c_empty_box \box_use:N \l_coffin_aligned_coffin } \cs_generate_variant:Nn \coffin_typeset:Nnnnn { c } @@ -1366,7 +1454,7 @@ % \end{variable} % % \begin{macro}{\coffin_rotate:Nn, \coffin_rotate:cn} -% Rotating a coffin requires several steps which can be conveniently +% 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 @@ -1399,7 +1487,7 @@ % 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_corner_maxima:N #1 \coffin_find_bounding_shift: \box_rotate:Nn #1 {#2} % \end{macrocode} @@ -1410,7 +1498,7 @@ % 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 + \hbox_set:Nn #1 { \tex_kern:D \l_coffin_bounding_shift_dim \tex_kern:D -\l_coffin_left_corner_dim @@ -1418,25 +1506,25 @@ { \box_use:N #1 } } % \end{macrocode} -% If there have been any previous rotations then the size of the +% 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 +% easily by setting the size of the box to the height and width of the % content. % \begin{macrocode} - \box_set_ht:Nn #1 + \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 + \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 +% 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} @@ -1448,14 +1536,14 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \coffin_set_bounding:N #1 { - \prop_put:Nnx \l_coffin_bounding_prop { tl } + \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 } + \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_tmp_dim { - \box_dp:N #1 } - \prop_put:Nnx \l_coffin_bounding_prop { bl } + \dim_set:Nn \l_coffin_tmp_dim { - \box_dp:N #1 } + \prop_put:Nnx \l_coffin_bounding_prop { bl } { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } } - \prop_put:Nnx \l_coffin_bounding_prop { br } + \prop_put:Nnx \l_coffin_bounding_prop { br } { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l_coffin_tmp_dim } } } % \end{macrocode} @@ -1472,34 +1560,34 @@ { \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 } } + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } } \cs_new_protected_nopar: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 } } + { { \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 +% 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_nopar: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} + \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} @@ -1508,8 +1596,8 @@ % 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 +% 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_nopar:Npn \coffin_rotate_vector:nnNN #1#2#3#4 @@ -1520,7 +1608,7 @@ \fp_set_eq:NN \l_coffin_tmp_fp \l_coffin_y_fp \fp_mul:Nn \l_coffin_x_prime_fp { \l_coffin_cos_fp } \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_sin_fp } - \fp_sub:Nn \l_coffin_x_prime_fp { \l_coffin_tmp_fp } + \fp_sub:Nn \l_coffin_x_prime_fp { \l_coffin_tmp_fp } \fp_set_eq:NN \l_coffin_y_prime_fp \l_coffin_y_fp \fp_set_eq:NN \l_coffin_tmp_fp \l_coffin_x_fp \fp_mul:Nn \l_coffin_y_prime_fp { \l_coffin_cos_fp } @@ -1534,7 +1622,7 @@ % % \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 +% 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 @@ -1546,7 +1634,7 @@ \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 } + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } { \coffin_find_corner_maxima_aux:nn ##2 } } \cs_new_protected_nopar:Npn \coffin_find_corner_maxima_aux:nn #1#2 @@ -1554,7 +1642,7 @@ \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} + \dim_set_max:Nn \l_coffin_top_corner_dim {#2} } % \end{macrocode} % \end{macro} @@ -1604,7 +1692,7 @@ % \end{macrocode} % \end{macro} % \end{macro} -% +% % \subsection{Resizing coffins} % % \begin{variable}{\l_coffin_scale_x_fp} @@ -1630,7 +1718,7 @@ % \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 +% 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} @@ -1670,7 +1758,7 @@ { \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} @@ -1695,7 +1783,7 @@ \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 + \coffin_resize_common:Nnn #1 { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } } \cs_generate_variant:Nn \coffin_scale:Nnn { c } @@ -1721,14 +1809,14 @@ % % \begin{macro}{\coffin_scale_corner:Nnnn} % \begin{macro}{\coffin_scale_pole:Nnnnnn} -% Scaling both corners and poles is a simple calculation using the +% Scaling both corners and poles is a simple calculation using the % preceding vector scaling. % \begin{macrocode} \cs_new_protected_nopar: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 } } + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } } \cs_new_protected_nopar:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 { @@ -1737,7 +1825,7 @@ { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } {#5} {#6} - } + } } % \end{macrocode} % \end{macro} @@ -1751,16 +1839,16 @@ \cs_new_protected_nopar: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_nopar: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} + { \dim_eval:n #3 + \box_wd:N #1 } {#4} + {#5} {#6} } } % \end{macrocode} @@ -1838,7 +1926,7 @@ % % \begin{variable}{\l_coffin_display_x_dim} % \begin{variable}{\l_coffin_display_y_dim} -% As the intersections of poles have to be calculated to find which +% 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} @@ -1857,7 +1945,7 @@ % \end{variable} % % \begin{variable}{\l_coffin_display_font_tl} -% Stores the settings used to print coffin data: this keeps things +% Stores the settings used to print coffin data: this keeps things % flexible. % \begin{macrocode} \tl_new:N \l_coffin_display_font_tl @@ -1894,19 +1982,19 @@ \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO %</initex> %<*package> - \color {#4} - \rule { 1 pt } { 1 pt } + \color {#4} + \rule { 1 pt } { 1 pt } %</package> } \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } + \l_coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } \hcoffin_set:Nn \l_coffin_display_coord_coffin { %<*initex> % TODO %</initex> %<*package> - \color {#4} + \color {#4} %</package> \l_coffin_display_font_tl ( \tl_to_str:n { #2 , #3 } ) @@ -1918,7 +2006,7 @@ \prop_get:NnN \l_coffin_display_handles_prop { #3 #2 } \l_coffin_tmp_tl \quark_if_no_value:NTF \l_coffin_tmp_tl - { + { \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} \l_coffin_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } @@ -1926,7 +2014,7 @@ { \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn \l_coffin_tmp_tl #1 {#2} {#3} - } + } } { \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn @@ -1937,7 +2025,7 @@ { \coffin_attach_mark:NnnNnnnn #5 {#6} {#7} \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } + { #3 \l_coffin_display_offset_dim } { #4 \l_coffin_display_offset_dim } } \cs_generate_variant:Nn \coffin_mark_handle:Nnnn { c } @@ -1950,8 +2038,8 @@ % \begin{macro}[aux]{\coffin_display_handles_aux:nnnn} % \begin{macro}[aux]{\coffin_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 +% \texttt{H} poles is used as the definitive version for the baseline +% and bottom. Two loops are then used to find the combinations of % handles for all of these poles. This is done such that poles are % removed during the loops to avoid duplication. % \begin{macrocode} @@ -1963,27 +2051,27 @@ \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TODO %</initex> %<*package> - \color {#2} - \rule { 1 pt } { 1 pt } + \color {#2} + \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 + \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 + \coffin_set_eq:NN \l_coffin_display_coffin #1 \prop_clear:N \l_coffin_handles_tmp_prop \prop_map_inline:Nn \l_coffin_display_poles_prop { \prop_del:Nn \l_coffin_display_poles_prop {##1} \coffin_display_handles_aux:nnnnnn {##1} ##2 {#2} } - \box_use:N \l_coffin_display_coffin + \box_use:N \l_coffin_display_coffin } % \end{macrocode} % For each pole there is a check for an intersection, which here does @@ -1994,7 +2082,7 @@ \cs_new_protected_nopar:Npn \coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6 { \prop_map_inline:Nn \l_coffin_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 @@ -2007,10 +2095,10 @@ \hcoffin_set:Nn \l_coffin_display_coord_coffin { %<*initex> - % TODO + % TODO %</initex> %<*package> - \color {#6} + \color {#6} %</package> \l_coffin_display_font_tl ( \tl_to_str:n { #1 , ##1 } ) @@ -2023,12 +2111,12 @@ { ##1 #1 } \l_coffin_tmp_tl \quark_if_no_value:NTF \l_coffin_tmp_tl { - \coffin_display_attach:Nnnnn + \coffin_display_attach:Nnnnn \l_coffin_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } } - { - \exp_last_unbraced:No + { + \exp_last_unbraced:No \coffin_display_handles_aux:nnnn \l_coffin_tmp_tl } @@ -2044,7 +2132,7 @@ { \coffin_display_attach:Nnnnn \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } + { #3 \l_coffin_display_offset_dim } { #4 \l_coffin_display_offset_dim } } \cs_generate_variant:Nn \coffin_display_handles:Nn { c } @@ -2070,11 +2158,11 @@ \tex_kern:D \l_coffin_offset_x_dim \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #1 } } - \box_set_ht:Nn \l_coffin_aligned_coffin + \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N \l_coffin_display_coffin } - \box_set_dp:Nn \l_coffin_aligned_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_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 } @@ -2087,7 +2175,7 @@ % \begin{macro}{\coffin_show_structure:N, \coffin_show_structure:c} % \begin{macro}[aux]{\coffin_show_aux:n} % \begin{macro}[aux]{\coffin_show_aux:w} -% For showing the various internal structures attached to a coffin in +% For showing the various internal structures attached to a coffin in % a way that keeps things relatively readable. If there is no apparent % structure then the code complains. % \begin{macrocode} @@ -2095,8 +2183,8 @@ { \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } { - \iow_term:x - { + \iow_term:x + { \iow_newline: Size~of~coffin~\token_to_str:N #1 : \iow_newline: > ~ ht~=~\dim_use:N \box_ht:N #1 \iow_newline: @@ -2111,9 +2199,9 @@ \coffin_show_aux:nn } \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \coffin_show_aux:w \l_coffin_tmp_tl } + { \exp_after:wN \coffin_show_aux:w \l_coffin_tmp_tl } } - { + { \iow_term:x { ---~No~poles~found~--- } \tl_show:n { Is~this~really~a~coffin? } } @@ -2159,4 +2247,4 @@ % % \end{implementation} % -% \PrintIndex
\ No newline at end of file +% \PrintIndex |