diff options
author | Karl Berry <karl@freefriends.org> | 2024-05-30 19:57:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-05-30 19:57:31 +0000 |
commit | 7823d0887ef6fcc70fce9a18a53637f6daf80806 (patch) | |
tree | 48bba31d9f17fe4731e7e6c200224ce4d6b6ccb5 /Master/texmf-dist/source | |
parent | 331c40fd5e3111d98316166d251fc1629235c6bc (diff) |
nicematrix (30may24)
git-svn-id: svn://tug.org/texlive/trunk@71390 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx | 891 |
1 files changed, 566 insertions, 325 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx index 340d2e0f5ef..059c4b2ca6c 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.27b} -\def\myfiledate{2024/04/23} +\def\myfileversion{6.28} +\def\myfiledate{2024/05/29} % % %<*batchfile> @@ -102,25 +102,11 @@ version 2005/12/01 or later. % % % \bigskip -% By default, the package \pkg{nicematrix} doesn't patch any existing code. +% The development of the extension \pkg{nicematrix} is done on the following GitHub +% depot: % -% \smallskip -% However, when the option |renew-dots| is used, the commands |\cdots|, -% |\ldots|, |\dots|, |\vdots|, |\ddots| and |\iddots| are redefined in the -% environments provided by \pkg{nicematrix}. In the same way, if the option -% |renew-matrix| is used, the environment |{matrix}| of \pkg{amsmath} is -% redefined. -% -% \smallskip -% On the other hand, the environment |{array}| is never redefined. +% \verb|https://github.com/fpantigny/nicematrix| % -% \smallskip -% Of course, the package \pkg{nicematrix} uses the features of the package -% \pkg{array}. It tries to be independent of its implementation. Unfortunately, -% it was not possible to be strictly independent. For example, the package -% \pkg{nicematrix} relies upon the fact that the package |{array}| uses -% |\ialign| to begin the |\halign|. -% % % \bigskip % \section{Declaration of the package and packages loaded} @@ -170,6 +156,8 @@ version 2005/12/01 or later. % the Tagging Project. % \begin{macrocode} \bool_const:Nn \c_@@_tagging_array_bool { \cs_if_exist_p:N \ar@ialign } +\bool_const:Nn \c_@@_testphase_table_bool + { \IfPackageLoadedTF { latex-lab-testphase-table } \c_true_bool \c_false_bool } % \end{macrocode} % % @@ -415,8 +403,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn \seq_set_split:Nnn { N V n } -\cs_generate_variant:Nn \str_lowercase:n { V } +\cs_generate_variant:Nn \seq_set_split:Nnn { N o n } +\cs_generate_variant:Nn \str_lowercase:n { o } % \end{macrocode} % % \medskip @@ -565,8 +553,8 @@ version 2005/12/01 or later. % the rules even if \pkg{colortbl} is not loaded. % \begin{macrocode} \cs_set_protected:Npn \CT@arc@ { } - \cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } } - \cs_set:Npn \CT@arc #1 #2 + \cs_set_nopar:Npn \arrayrulecolor #1 # { \CT@arc { #1 } } + \cs_set_nopar:Npn \CT@arc #1 #2 { \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign { \cs_gset_nopar:Npn \CT@arc@ { \color #1 { #2 } } } @@ -574,13 +562,13 @@ version 2005/12/01 or later. % \end{macrocode} % Idem for |\CT@drs@|. % \begin{macrocode} - \cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } } - \cs_set:Npn \CT@drs #1 #2 + \cs_set_nopar:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } } + \cs_set_nopar:Npn \CT@drs #1 #2 { \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign { \cs_gset:Npn \CT@drsc@ { \color #1 { #2 } } } } - \cs_set:Npn \hline + \cs_set_nopar:Npn \hline { \noalign { \ifnum 0 = `} \fi \cs_set_eq:NN \hskip \vskip @@ -599,8 +587,8 @@ version 2005/12/01 or later. % be linked to |\cline| in the beginning of |{NiceArrayWithDelims}|. The % following commands must \emph{not} be protected. % \begin{macrocode} -\cs_set:Npn \@@_standard_cline #1 { \@@_standard_cline:w #1 \q_stop } -\cs_set:Npn \@@_standard_cline:w #1-#2 \q_stop +\cs_set_nopar:Npn \@@_standard_cline #1 { \@@_standard_cline:w #1 \q_stop } +\cs_set_nopar:Npn \@@_standard_cline:w #1-#2 \q_stop { \int_if_zero:nT \l_@@_first_col_int { \omit & } \int_compare:nNnT { #1 } > \c_one_int @@ -694,8 +682,8 @@ version 2005/12/01 or later. \tl_if_blank:nF { #1 } { \tl_if_head_eq_meaning:nNTF { #1 } [ - { \cs_set:Npn \CT@arc@ { \color #1 } } - { \cs_set:Npn \CT@arc@ { \color { #1 } } } + { \cs_set_nopar:Npn \CT@arc@ { \color #1 } } + { \cs_set_nopar:Npn \CT@arc@ { \color { #1 } } } } } \cs_generate_variant:Nn \@@_set_CT@arc@:n { o } @@ -706,8 +694,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_set_CT@drsc@:n #1 { \tl_if_head_eq_meaning:nNTF { #1 } [ - { \cs_set:Npn \CT@drsc@ { \color #1 } } - { \cs_set:Npn \CT@drsc@ { \color { #1 } } } + { \cs_set_nopar:Npn \CT@drsc@ { \color #1 } } + { \cs_set_nopar:Npn \CT@drsc@ { \color { #1 } } } } \cs_generate_variant:Nn \@@_set_CT@drsc@:n { o } % \end{macrocode} @@ -732,10 +720,6 @@ version 2005/12/01 or later. \cs_generate_variant:Nn \@@_color:n { o } % \end{macrocode} % -% \bigskip -% \begin{macrocode} -\cs_set_eq:NN \@@_old_pgfpointanchor \pgfpointanchor -% \end{macrocode} % % \bigskip % \begin{macrocode} @@ -970,6 +954,7 @@ version 2005/12/01 or later. \bool_new:N \g_@@_rotate_bool % \end{macrocode} % +% % \bigskip % The following boolean will be raise then the command |\rotate| is used with % the key |c|. @@ -1110,12 +1095,12 @@ version 2005/12/01 or later. % The following command will be able to reconstruct the full name of the current % command or environment (despite its name which contains \textsl{env}). This % command must \emph{not} be protected since it will be used in error messages -% and we have to use |\str_if_eq:VnTF| and not |\tl_if_eq:NnTF| because we need +% and we have to use |\str_if_eq:onTF| and not |\tl_if_eq:NnTF| because we need % to be fully expandable). % \begin{macrocode} \cs_new:Npn \@@_full_name_env: { - \str_if_eq:VnTF \g_@@_com_or_env_str { command } + \str_if_eq:onTF \g_@@_com_or_env_str { command } { command \space \c_backslash_str \g_@@_name_env_str } { environment \space \{ \g_@@_name_env_str \} } } @@ -1163,6 +1148,14 @@ version 2005/12/01 or later. \bool_new:N \l_@@_in_code_after_bool % \end{macrocode} % +% +% \bigskip +% The following parameter will be raised when a block content a |&| in its +% content (=label). +% \begin{macrocode} +\bool_new:N \l_@@_ampersand_bool +% \end{macrocode} +% % \bigskip % The counters |\l_@@_old_iRow_int| and |\l_@@_old_jCol_int| will be used to % save the values of the potential LaTeX counters |iRow| and |jCol|. These LaTeX @@ -1275,11 +1268,21 @@ version 2005/12/01 or later. % The L3 programming layer provides scratch dimensions |\l_tmpa_dim| and % |\l_tmpb_dim|. We creates two more in the same spirit. % \begin{macrocode} -\dim_zero_new:N \l_@@_tmpc_dim -\dim_zero_new:N \l_@@_tmpd_dim +\dim_new:N \l_@@_tmpc_dim +\dim_new:N \l_@@_tmpd_dim % \end{macrocode} % % \bigskip +% \begin{macrocode} +\dim_new:N \g_@@_dp_row_zero_dim +\dim_new:N \g_@@_ht_row_zero_dim +\dim_new:N \g_@@_ht_row_one_dim +\dim_new:N \g_@@_dp_ante_last_row_dim +\dim_new:N \g_@@_ht_last_row_dim +\dim_new:N \g_@@_dp_last_row_dim +% \end{macrocode} +% +% \bigskip % Some cells will be declared as ``empty'' (for example a cell with an % instruction |\Cdots|). % \begin{macrocode} @@ -1475,6 +1478,7 @@ version 2005/12/01 or later. \str_new:N \l_@@_hpos_block_str \str_set:Nn \l_@@_hpos_block_str { c } \bool_new:N \l_@@_hpos_of_block_cap_bool +\bool_new:N \l_@@_p_block_bool % \end{macrocode} % % \medskip @@ -2261,6 +2265,12 @@ version 2005/12/01 or later. \tl_new:N \l_@@_baseline_tl \tl_set:Nn \l_@@_baseline_tl { c } % \end{macrocode} +% +% \bigskip +% The following parameter corresponds to the key |ampersand-in-blocks| +% \begin{macrocode} +\bool_new:N \l_@@_amp_in_blocks_bool +% \end{macrocode} % % \bigskip % The flag |\l_@@_exterior_arraycolsep_bool| corresponds to the option @@ -2492,6 +2502,8 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { NiceMatrix / Global } { + ampersand-in-blocks .bool_set:N = \l_@@_amp_in_blocks_bool , + ampersand-in-blocks .default:n = true , no-cell-nodes .code:n = \cs_set_protected:Npn \@@_node_for_cell: { \box_use_drop:N \l_@@_cell_box } , @@ -3475,10 +3487,10 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_@@_baseline_tl| may have the value |t|, |c| or |b|. However, if the value % is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the -% right translation will be done further. Remark that |\str_if_eq:VnTF| is +% right translation will be done further. Remark that |\str_if_eq:onTF| is % fully expandable and we need something fully expandable here. % \begin{macrocode} - [ \str_if_eq:VnTF \l_@@_baseline_tl c c t ] + [ \str_if_eq:onTF \l_@@_baseline_tl c c t ] } % \end{macrocode} % @@ -3554,7 +3566,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_everycr_i: { - \bool_if:NT \c_@@_tagging_array_bool + \bool_if:NT \c_@@_testphase_table_bool { \tbl_if_row_was_started:T { \UseTaggingSocket { tbl / row / end } } \tbl_update_cell_data_for_next_row: @@ -3587,10 +3599,7 @@ version 2005/12/01 or later. { \int_compare:nNnF \c@iRow = \l_@@_last_row_int % \end{macrocode} -% The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of -% the rules in the array. The package \pkg{nicematrix} uses it even if -% \pkg{colortbl} is not loaded. We use a TeX group in order to limit the scope -% of |\CT@arc@|. +% % \begin{macrocode} { \hrule height \arrayrulewidth width \c_zero_dim } } @@ -3636,21 +3645,21 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_redefine_everycr: { \everycr { \@@_everycr: } } -\hook_gput_code:nnn { begindocument } { . } - { - \IfPackageLoadedTF { colortbl } - { - \cs_set_protected:Npn \@@_redefine_everycr: - { - \CT@everycr - { - \noalign { \cs_gset_eq:NN \CT@row@color \prg_do_nothing: } - \@@_everycr: - } - } - } - { } - } + \hook_gput_code:nnn { begindocument } { . } + { + \IfPackageLoadedTF { colortbl } + { + \cs_set_protected:Npn \@@_redefine_everycr: + { + \CT@everycr + { + \noalign { \cs_gset_eq:NN \CT@row@color \prg_do_nothing: } + \@@_everycr: + } + } + } + { } + } % \end{macrocode} % % If \pkg{booktabs} is loaded, we have to patch the macro |\@BTnormal| which is @@ -3688,16 +3697,11 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_some_initialization: { - \dim_gzero_new:N \g_@@_dp_row_zero_dim \dim_gset:Nn \g_@@_dp_row_zero_dim { \box_dp:N \@arstrutbox } - \dim_gzero_new:N \g_@@_ht_row_zero_dim \dim_gset:Nn \g_@@_ht_row_zero_dim { \box_ht:N \@arstrutbox } - \dim_gzero_new:N \g_@@_ht_row_one_dim - \dim_gset:Nn \g_@@_ht_row_one_dim { \box_ht:N \@arstrutbox } - \dim_gzero_new:N \g_@@_dp_ante_last_row_dim - \dim_gzero_new:N \g_@@_ht_last_row_dim + \dim_gset_eq:NN \g_@@_ht_row_one_dim \g_@@_ht_row_zero_dim + \dim_gzero:N \g_@@_dp_ante_last_row_dim \dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \@arstrutbox } - \dim_gzero_new:N \g_@@_dp_last_row_dim \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox } } % \end{macrocode} @@ -3735,7 +3739,7 @@ version 2005/12/01 or later. \cs_set_nopar:Npn \arraystretch { 0.47 } \dim_set:Nn \arraycolsep { 1.45 pt } % \end{macrocode} -% By default, |\@@_small_scripstyle:| is null. +% By default, |\@@_tuning_key_small:| is no-op. % \begin{macrocode} \cs_set_eq:NN \@@_tuning_key_small: \scriptstyle } @@ -3763,9 +3767,9 @@ version 2005/12/01 or later. { \cs_set_nopar:Npn \ar@ialign { - \tbl_init_cell_data_for_table: + \bool_if:NT \c_@@_testphase_table_bool \tbl_init_cell_data_for_table: \@@_redefine_everycr: - \tabskip = \c_zero_skip + \dim_zero:N \tabskip \@@_some_initialization: % \end{macrocode} % @@ -3786,7 +3790,7 @@ version 2005/12/01 or later. \cs_set_nopar:Npn \ialign { \@@_redefine_everycr: - \tabskip = \c_zero_skip + \dim_zero:N \tabskip \@@_some_initialization: \cs_set_eq:NN \ialign \@@_old_ialign: \halign @@ -4061,7 +4065,9 @@ version 2005/12/01 or later. % |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second % part of the environment (and the closing |\c_math_toggle_token| also). % \begin{macrocode} - \hbox_set:Nw \l_@@_the_array_box + \hbox_set:Nw \l_@@_the_array_box + \bool_if:NT \c_@@_testphase_table_bool + { \UseTaggingSocket { tbl / hmode / begin } } % \end{macrocode} % % \begin{macrocode} @@ -4101,7 +4107,7 @@ version 2005/12/01 or later. % \section{The \textbackslash CodeBefore} % % The following command will be executed if the |\CodeBefore| has to be actually -% executed (that commmand will be used only once and is present only for legibility). +% executed (that commmand will be used only once and is present alone only for legibility). % \begin{macrocode} \cs_new_protected:Npn \@@_pre_code_before: { @@ -4426,6 +4432,7 @@ version 2005/12/01 or later. \tl_gset:Nn \g_@@_left_delim_tl { #1 } \tl_gset:Nn \g_@@_right_delim_tl { #2 } \tl_gset:Nn \g_@@_user_preamble_tl { #4 } + \tl_if_empty:NT \g_@@_user_preamble_tl { \@@_fatal:n { empty~preamble } } % \end{macrocode} % % @@ -4545,7 +4552,7 @@ version 2005/12/01 or later. % command |\@@_CodeBefore_Body:w|. After that job, the command |\@@_CodeBefore_Body:w| % will go on with |\@@_pre_array:|. % \begin{macrocode} - \IfBooleanTF { #6 } \@@_CodeBefore_Body:w \@@_pre_array: + \bool_if:nTF { #6 } \@@_CodeBefore_Body:w \@@_pre_array: } % \end{macrocode} % @@ -4558,6 +4565,18 @@ version 2005/12/01 or later. \c_math_toggle_token \skip_horizontal:N \l_@@_right_margin_dim \skip_horizontal:N \l_@@_extra_right_margin_dim + + % % awful workaround + \int_compare:nNnT \g_@@_col_total_int = \c_one_int + { + \dim_compare:nNnT \l_@@_columns_width_dim > \c_zero_dim + { + \skip_horizontal:N - \l_@@_columns_width_dim + \bool_if:NTF \l_@@_tabular_bool + { \skip_horizontal:n { - 2 \tabcolsep } } + { \skip_horizontal:n { - 2 \arraycolsep } } + } + } \hbox_set_end: % \end{macrocode} % End of the construction of the array (in the box |\l_@@_the_array_box|). @@ -4798,7 +4817,7 @@ version 2005/12/01 or later. % % \bigskip % The final user provides a preamble, but we must convert that preamble into a -% preamble that will be given to |{array}| (of the package \pkg{array}). +% preamble which will be given to |{array}| (of the package \pkg{array}). % % \bigskip % The preamble given by the final user is stored in |\g_@@_user_preamble_tl|. @@ -4872,6 +4891,12 @@ version 2005/12/01 or later. { \IfPackageLoadedTF { colortbl } { +% \end{macrocode} +% When \pkg{colortbl} is used, we have to catch the tokens |\columncolor| in the +% preamble because, otherwise, \pkg{colortbl} will catch them and the colored +% panels won't be drawn by \pkg{nicematrix} but by \pkg{colortbl} (with an +% output which is not perfect). +% \begin{macrocode} \regex_const:Nn \c_@@_columncolor_regex { \c { columncolor } } \cs_new_protected:Npn \@@_replace_columncolor: { @@ -5186,7 +5211,7 @@ version 2005/12/01 or later. % % % \medskip -% For |p|, |b| and |m|. +% For |p| but also |b| and |m|. % \begin{macrocode} \cs_new:Npn \@@_p #1 { @@ -5262,7 +5287,7 @@ version 2005/12/01 or later. { \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl } { \cs_set_nopar:Npn \exp_not:N \l_@@_hpos_cell_tl - { \str_lowercase:V \l_@@_hpos_col_str } + { \str_lowercase:o \l_@@_hpos_col_str } } \str_case:on \l_@@_hpos_col_str { @@ -5288,7 +5313,7 @@ version 2005/12/01 or later. % \end{macrocode} % We use |\str_lowercase:n| to convert |R| to |r|, etc. % \begin{macrocode} - { \str_lowercase:V \l_@@_hpos_col_str } + { \str_lowercase:o \l_@@_hpos_col_str } } } % \end{macrocode} @@ -5341,6 +5366,8 @@ version 2005/12/01 or later. % mono-column blocks. % \begin{macrocode} \dim_set:Nn \l_@@_col_width_dim { #2 } + \bool_if:NT \c_@@_testphase_table_bool + { \tag_struct_begin:n { tag = Div } } \@@_cell_begin:w % \end{macrocode} % We use the form |\minipage|--|\endminipage| (|\varwidth|--|\endvarwidth|) for @@ -5355,6 +5382,7 @@ version 2005/12/01 or later. \vrule height \box_ht:N \@arstrutbox width \c_zero_dim \everypar { } } + \bool_if:NT \c_@@_testphase_table_bool \tagpdfparaOn % \end{macrocode} % Now, the potential code for the horizontal position of the content of the cell % (|\centering|, |\raggedright|, |\RaggedRight|, etc.). @@ -5381,6 +5409,7 @@ version 2005/12/01 or later. % \begin{macrocode} #4 \@@_cell_end: + \bool_if:NT \c_@@_testphase_table_bool \tag_struct_end: } } } @@ -6032,7 +6061,9 @@ version 2005/12/01 or later. \multispan { #1 } \cs_set_eq:NN \@@_update_max_cell_width: \prg_do_nothing: \begingroup - \cs_set:Npn \@addamp + \bool_if:NT \c_@@_testphase_table_bool + { \tbl_update_multicolumn_cell_data:n { #1 } } + \cs_set_nopar:Npn \@addamp { \legacy_if:nTF { @firstamp } { \@firstampfalse } { \@preamerr 5 } } % \end{macrocode} % @@ -6051,6 +6082,8 @@ version 2005/12/01 or later. \exp_args:No \@mkpream \g_@@_preamble_tl \@addtopreamble \@empty \endgroup + \bool_if:NT \c_@@_testphase_table_bool + { \UseTaggingSocket { tbl / colspan } { #1 } } % \end{macrocode} % % \medskip @@ -6084,7 +6117,7 @@ version 2005/12/01 or later. % \medskip % The following lines were in the original definition of |\multicolumn|. % \begin{macrocode} - \cs_set:Npn \@sharp { #3 } + \cs_set_nopar:Npn \@sharp { #3 } \@arstrut \@preamble \null @@ -6804,7 +6837,7 @@ version 2005/12/01 or later. \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl \bool_if:NTF \l_@@_light_syntax_expanded_bool \seq_set_split:Nee - \seq_set_split:NVn + \seq_set_split:Non \l_@@_rows_seq \l_@@_end_of_row_tl { #1 } % \end{macrocode} % We delete the last row if it is empty. @@ -6913,7 +6946,7 @@ version 2005/12/01 or later. % The command |\@@_create_col_nodes:| will construct a special last row. % That last row is a false row used to create the |col| nodes and to fix the % width of the columns (when the array is constructed with an option which -% specifies the width of the columns). +% specifies the width of the columns such as |columns-width|). % \begin{macrocode} \cs_new:Npn \@@_create_col_nodes: { @@ -7080,7 +7113,7 @@ version 2005/12/01 or later. { \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } } \skip_horizontal:N \g_tmpa_skip \int_gincr:N \g_tmpa_int - \bool_lazy_any:nF % modified 2023/12/13 + \bool_lazy_any:nF { \g_@@_delims_bool \l_@@_tabular_bool @@ -7160,7 +7193,7 @@ version 2005/12/01 or later. \endpgfpicture } } - \cr + % \cr } % \end{macrocode} % @@ -7492,7 +7525,11 @@ version 2005/12/01 or later. \@@_settings_for_tabular: \NiceArray { #2 } } - { \endNiceArray } + { + \endNiceArray + \bool_if:NT \c_@@_testphase_table_bool + { \UseTaggingSocket { tbl / hmode / end } } + } % \end{macrocode} % % \begin{macrocode} @@ -7982,7 +8019,7 @@ version 2005/12/01 or later. % % \bigskip % We define a new \textsc{pgf} shape for the diag nodes because we want to -% provide a anchor called |.5| for those nodes. +% provide an anchor called |.5| for those nodes. % \begin{macrocode} \pgfdeclareshape { @@_diag_node } { @@ -7993,6 +8030,14 @@ version 2005/12/01 or later. } \anchor { 5 } { \five } \anchor { center } { \pgfpointorigin } + \anchor { 1 } { \five \pgf@x = 0.2 \pgf@x \pgf@y = 0.2 \pgf@y } + \anchor { 2 } { \five \pgf@x = 0.4 \pgf@x \pgf@y = 0.4 \pgf@y } + \anchor { 3 } { \five \pgf@x = 0.6 \pgf@x \pgf@y = 0.6 \pgf@y } + \anchor { 4 } { \five \pgf@x = 0.8 \pgf@x \pgf@y = 0.8 \pgf@y } + \anchor { 6 } { \five \pgf@x = 1.2 \pgf@x \pgf@y = 1.2 \pgf@y } + \anchor { 7 } { \five \pgf@x = 1.4 \pgf@x \pgf@y = 1.4 \pgf@y } + \anchor { 8 } { \five \pgf@x = 1.6 \pgf@x \pgf@y = 1.6 \pgf@y } + \anchor { 9 } { \five \pgf@x = 1.8 \pgf@x \pgf@y = 1.8 \pgf@y } } % \end{macrocode} % @@ -12916,6 +12961,9 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { NiceMatrix / Block / FirstPass } { + j .code:n = \str_set:Nn \l_@@_hpos_block_str j + \bool_set_true:N \l_@@_p_block_bool , + j .value_forbidden:n = true , l .code:n = \str_set:Nn \l_@@_hpos_block_str l , l .value_forbidden:n = true , r .code:n = \str_set:Nn \l_@@_hpos_block_str r , @@ -12936,6 +12984,8 @@ version 2005/12/01 or later. b .value_forbidden:n = true , B .code:n = \str_set:Nn \l_@@_vpos_block_str B , B .value_forbidden:n = true , + p .code:n = \bool_set_true:N \l_@@_p_block_bool , + p .value_forbidden:n = true , color .code:n = \@@_color:n { #1 } \tl_set_rescan:Nnn @@ -13066,18 +13116,28 @@ version 2005/12/01 or later. % % % \medskip -% If the block is mono-column or mono-row, we have a special treatment. That's -% why we have two macros: |\@@_Block_iv:nnnnn| and |\@@_Block_v:nnnnn| (the five +% We have different treatments when the key |p| is used and when the block is +% mono-column or mono-row, etc. That's why we have several macros: +% |\@@_Block_iv:nnnnn|, |\@@_Block_v:nnnnn|, |\@@_Block_vi:nnnn|, etc. (the five % arguments of those macros are provided by curryfication). % \begin{macrocode} - \bool_if:nTF - { - ( - \int_compare_p:nNn \l_tmpa_int = \c_one_int - || - \int_compare_p:nNn \l_tmpb_int = \c_one_int - ) - && ! \tl_if_empty_p:n { #5 } + \bool_set_false:N \l_tmpa_bool + \bool_if:NT \l_@@_amp_in_blocks_bool + { \tl_if_in:nnT { #5 } { & } { \bool_set_true:N \l_tmpa_bool } } + \bool_if:NTF \l_tmpa_bool + { \exp_args:Nee \@@_Block_vii:nnnnn } + { + \bool_if:NTF \l_@@_p_block_bool + { \exp_args:Nee \@@_Block_vi:nnnnn } + { + \bool_if:nTF + { + ( + \int_compare_p:nNn \l_tmpa_int = \c_one_int + || + \int_compare_p:nNn \l_tmpb_int = \c_one_int + ) + && ! \tl_if_empty_p:n { #5 } % \end{macrocode} % For the blocks mono-column, we will compose right now in a box in order to % compute its width and take that width into account for the width of the @@ -13087,10 +13147,12 @@ version 2005/12/01 or later. % column, it's imperative. Otherwise, the process for the determination of the % widths of the columns will be wrong. % \begin{macrocode} - && ! \l_@@_X_bool + && ! \l_@@_X_bool + } + { \exp_args:Nee \@@_Block_iv:nnnnn } + { \exp_args:Nee \@@_Block_v:nnnnn } + } } - { \exp_args:Nee \@@_Block_iv:nnnnn } - { \exp_args:Nee \@@_Block_v:nnnnn } { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } } % \end{macrocode} @@ -13098,12 +13160,13 @@ version 2005/12/01 or later. % % \bigskip % The following macro is for the case of a |\Block| which is mono-row or -% mono-column (or both). In that case, the content of the block is composed -% right now in a box (because we have to take into account the dimensions of -% that box for the width of the current column or the height and the depth of the -% current row). However, that box will be put in the array \emph{after the -% construction of the array} (by using \textsc{pgf}) with |\@@_draw_blocks:| and -% above all |\@@_Block_v:nnnnnn| which will do the main job. +% mono-column (or both) and don't use the key~|p|. In that case, the content of +% the block is composed right now in a box (because we have to take into account +% the dimensions of that box for the width of the current column or the height +% and the depth of the current row). However, that box will be put in the array +% \emph{after the construction of the array} (by using \textsc{pgf}) with +% |\@@_draw_blocks:| and above all |\@@_Block_v:nnnnnn| which will do the main +% job. % % |#1| is $i$ (the number of rows of the block), |#2| is $j$ (the number of % columns of the block), |#3| is the list of \textsl{key=values} pairs, |#4| are @@ -13209,7 +13272,7 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { minipage }% - [ \str_lowercase:V \l_@@_vpos_block_str ] + [ \str_lowercase:o \l_@@_vpos_block_str ] { \l_@@_col_width_dim } \str_case:on \l_@@_hpos_block_str { c \centering r \raggedleft l \raggedright } @@ -13224,7 +13287,7 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { tabular }% - [ \str_lowercase:V \l_@@_vpos_block_str ] + [ \str_lowercase:o \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13240,7 +13303,7 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { array }% - [ \str_lowercase:V \l_@@_vpos_block_str ] + [ \str_lowercase:o \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13254,7 +13317,7 @@ version 2005/12/01 or later. % \bigskip % If there were |\rotate| (which raises |\g_@@_rotate_bool|) in the content of % the |\Block|, we do a rotation of the box (and we also adjust the -% baseline the rotated box). +% baseline of the rotated box). % \begin{macrocode} \bool_if:NT \g_@@_rotate_bool \@@_rotate_box_of_block: % \end{macrocode} @@ -13275,37 +13338,29 @@ version 2005/12/01 or later. } } % \end{macrocode} -% If we are in a mono-row block and if that block has no vertical option for the -% position\footnote{If the block has a key of a vertical position, that means -% that it has to be put in a vertical space determined by the \emph{others} -% cells of the row. Therefore there is no point creating space here. Moreover, -% that would lead to problems when a multi-row block with a position key such as -% |b| or |B|.}, we take into account the height and the depth of that block for the -% height and the depth of the row. +% If we are in a mono-row block we take into account the height and the depth of +% that block for the height and the depth of the row. % \begin{macrocode} - \str_if_eq:VnT \l_@@_vpos_block_str { c } + \int_compare:nNnT { #1 } = \c_one_int { - \int_compare:nNnT { #1 } = \c_one_int + \dim_gset:Nn \g_@@_blocks_ht_dim { - \dim_gset:Nn \g_@@_blocks_ht_dim + \dim_max:nn + \g_@@_blocks_ht_dim { - \dim_max:nn - \g_@@_blocks_ht_dim - { - \box_ht:c - { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } - } - } - \dim_gset:Nn \g_@@_blocks_dp_dim + \box_ht:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } + \dim_gset:Nn \g_@@_blocks_dp_dim + { + \dim_max:nn + \g_@@_blocks_dp_dim { - \dim_max:nn - \g_@@_blocks_dp_dim - { - \box_dp:c - { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } - } - } - } + \box_dp:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } } \seq_gput_right:Nx \g_@@_blocks_seq { @@ -13340,6 +13395,8 @@ version 2005/12/01 or later. } % \end{macrocode} % +% +% % \bigskip % \begin{macrocode} \cs_new:Npn \@@_adjust_hpos_rotate: @@ -13398,10 +13455,10 @@ version 2005/12/01 or later. % % \bigskip % The following macro is for the standard case, where the block is not mono-row -% and not mono-column. In that case, the content of the block is \emph{not} -% composed right now in a box. The composition in a box will be done further, -% just after the construction of the array (cf. |\@@_draw_blocks:| and -% above all |\@@_Block_v:nnnnnn|). +% and not mono-column and does not use the key |p|). In that case, the content of +% the block is \emph{not} composed right now in a box. The composition in a box +% will be done further, just after the construction of the array (cf. +% |\@@_draw_blocks:| and above all |\@@_Block_v:nnnnnn|). % % |#1| is $i$ (the number of rows of the block), |#2| is $j$ (the number of % columns of the block), |#3| is the list of \textsl{key=values} pairs, |#4| are @@ -13434,18 +13491,20 @@ version 2005/12/01 or later. % the tabular is the same as the external alignment of the tabular (that is to % say the position of the block in its zone of merged cells). % \begin{macrocode} - \use:e - { - \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ] - { @ { } \l_@@_hpos_block_str @ { } } - } - #5 - \end { tabular } + \bool_if:NT \c_@@_testphase_table_bool + { \tag_stop:n { table } } + \use:e + { + \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ] + { @ { } \l_@@_hpos_block_str @ { } } + } + #5 + \end { tabular } } \group_end: } % \end{macrocode} -% When we are \emph{not} in an environments |{NiceTabular}| (or similar). +% When we are \emph{not} in an environment |{NiceTabular}| (or similar). % \begin{macrocode} { \group_begin: @@ -13473,6 +13532,40 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% \bigskip +% The following macro is for the case of a |\Block| which uses the key~|p|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_Block_vi:nnnnn #1 #2 #3 #4 #5 + { + \seq_gput_right:Nx \g_@@_blocks_seq + { + \l_tmpa_tl + { \exp_not:n { #3 } } + { + \group_begin: + \exp_not:n { #4 #5 } + \group_end: + } + } + } +% \end{macrocode} +% +% +% \bigskip +% The following macro is for the case of a |\Block| which uses the key~|p|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_Block_vii:nnnnn #1 #2 #3 #4 #5 + { + \seq_gput_right:Nx \g_@@_blocks_seq + { + \l_tmpa_tl + { \exp_not:n { #3 } } + { \exp_not:n { #4 #5 } } + } + } +% \end{macrocode} +% % % \bigskip % We recall that the options of the command |\Block| are analyzed twice: first @@ -13523,6 +13616,8 @@ version 2005/12/01 or later. % Some keys have not a property |.value_required:n| (or similar) because they % are in |FirstPass|. % \begin{macrocode} + j .code:n = \str_set:Nn \l_@@_hpos_block_str j + \bool_set_true:N \l_@@_p_block_bool , l .code:n = \str_set:Nn \l_@@_hpos_block_str l , r .code:n = \str_set:Nn \l_@@_hpos_block_str r , c .code:n = \str_set:Nn \l_@@_hpos_block_str c , @@ -13536,9 +13631,11 @@ version 2005/12/01 or later. T .code:n = \str_set:Nn \l_@@_vpos_block_str T , b .code:n = \str_set:Nn \l_@@_vpos_block_str b , B .code:n = \str_set:Nn \l_@@_vpos_block_str B , - m .code:n = \str_set:Nn \l_@@_vpos_block_str { c } , + m .code:n = \str_set:Nn \l_@@_vpos_block_str c , m .value_forbidden:n = true , v-center .meta:n = m , + p .code:n = \bool_set_true:N \l_@@_p_block_bool , + p .value_forbidden:n = true , name .tl_set:N = \l_@@_block_name_str , name .value_required:n = true , name .initial:n = , @@ -13636,8 +13733,17 @@ version 2005/12/01 or later. \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } % \end{macrocode} % +% +% If the content of the block contains |&|, we will have a special treatement +% (since the cell must be divided in several sub-cells). +% \begin{macrocode} + \tl_if_in:nnT { #6 } { & } { \bool_set_true:N \l_@@_ampersand_bool } +% \end{macrocode} +% % \begin{macrocode} - \bool_if:NT \l_@@_vlines_block_bool + \bool_lazy_and:nnT + \l_@@_vlines_block_bool + { ! \l_@@_ampersand_bool } { \tl_gput_right:Nx \g_nicematrix_code_after_tl { @@ -13768,11 +13874,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \medskip -% \begin{macrocode} - \hbox_set:Nn \l_@@_cell_box { \set@color #6 } - \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: -% \end{macrocode} % % \bigskip % Let's consider the following |{NiceTabular}|. Because of the instruction @@ -13825,38 +13926,40 @@ version 2005/12/01 or later. % The construction of the node corresponding to the merged cells. % \begin{macrocode} \pgfpicture - \pgfrememberpicturepositiononpagetrue - \pgf@relevantforpicturesizefalse - \@@_qpoint:n { row - #1 } - \dim_set_eq:NN \l_tmpa_dim \pgf@y - \@@_qpoint:n { col - #2 } - \dim_set_eq:NN \l_tmpb_dim \pgf@x - \@@_qpoint:n { row - \int_eval:n { \l_@@_last_row_int + 1 } } - \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y - \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } - \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \@@_qpoint:n { row - #1 } + \dim_set_eq:NN \l_tmpa_dim \pgf@y + \@@_qpoint:n { col - #2 } + \dim_set_eq:NN \l_tmpb_dim \pgf@x + \@@_qpoint:n { row - \int_eval:n { \l_@@_last_row_int + 1 } } + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y + \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x % \end{macrocode} % +% +% % We construct the node for the block with the name |(#1-#2-block)|. % % The function |\@@_pgf_rect_node:nnnnn| takes in as arguments the name of the node % and the four coordinates of two opposite corner points of the rectangle. % \begin{macrocode} - \@@_pgf_rect_node:nnnnn - { \@@_env: - #1 - #2 - block } - \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim - \str_if_empty:NF \l_@@_block_name_str - { - \pgfnodealias - { \@@_env: - \l_@@_block_name_str } - { \@@_env: - #1 - #2 - block } - \str_if_empty:NF \l_@@_name_str - { - \pgfnodealias - { \l_@@_name_str - \l_@@_block_name_str } - { \@@_env: - #1 - #2 - block } - } - } + \@@_pgf_rect_node:nnnnn + { \@@_env: - #1 - #2 - block } + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim + \str_if_empty:NF \l_@@_block_name_str + { + \pgfnodealias + { \@@_env: - \l_@@_block_name_str } + { \@@_env: - #1 - #2 - block } + \str_if_empty:NF \l_@@_name_str + { + \pgfnodealias + { \l_@@_name_str - \l_@@_block_name_str } + { \@@_env: - #1 - #2 - block } + } + } % \end{macrocode} % % \medskip @@ -13867,64 +13970,64 @@ version 2005/12/01 or later. % normal node is used to put the label. % % \begin{macrocode} - \bool_if:NF \l_@@_hpos_of_block_cap_bool - { - \dim_set_eq:NN \l_tmpb_dim \c_max_dim + \bool_if:NF \l_@@_hpos_of_block_cap_bool + { + \dim_set_eq:NN \l_tmpb_dim \c_max_dim % \end{macrocode} % The short node is constructed by taking into account the \emph{contents} of % the columns involved in at least one cell of the block. That's why we have to % do a loop over the rows of the array. % \begin{macrocode} - \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int - { + \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int + { % \end{macrocode} % We recall that, when a cell is empty, no (normal) node is created in that % cell. That's why we test the existence of the node before using it. % \begin{macrocode} - \cs_if_exist:cT - { pgf @ sh @ ns @ \@@_env: - ##1 - #2 } - { - \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } - { - \pgfpointanchor { \@@_env: - ##1 - #2 } { west } - \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } - } - } - } + \cs_if_exist:cT + { pgf @ sh @ ns @ \@@_env: - ##1 - #2 } + { + \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \@@_env: - ##1 - #2 } { west } + \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + } + } + } % \end{macrocode} % If all the cells of the column were empty, |\l_tmpb_dim| has still the same % value |\c_max_dim|. In that case, you use for |\l_tmpb_dim| the value of the % position of the vertical rule. % \begin{macrocode} - \dim_compare:nNnT \l_tmpb_dim = \c_max_dim - { - \@@_qpoint:n { col - #2 } - \dim_set_eq:NN \l_tmpb_dim \pgf@x - } - \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim } - \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int - { - \cs_if_exist:cT - { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } - { - \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } - { - \pgfpointanchor - { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } - { east } - \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf@x } - } - } - } - \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim } - { - \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } - \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x - } - \@@_pgf_rect_node:nnnnn - { \@@_env: - #1 - #2 - block - short } - \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim - } + \dim_compare:nNnT \l_tmpb_dim = \c_max_dim + { + \@@_qpoint:n { col - #2 } + \dim_set_eq:NN \l_tmpb_dim \pgf@x + } + \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim } + \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int + { + \cs_if_exist:cT + { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } + { + \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor + { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } + { east } + \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf@x } + } + } + } + \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim } + { + \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x + } + \@@_pgf_rect_node:nnnnn + { \@@_env: - #1 - #2 - block - short } + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim + } % \end{macrocode} % % \medskip @@ -13946,145 +14049,273 @@ version 2005/12/01 or later. { south~east } } } + \endpgfpicture % \end{macrocode} % +% \bigskip +% \begin{macrocode} + \bool_if:NTF \l_@@_ampersand_bool + { + \seq_set_split:Nnn \l_tmpa_seq { & } { #6 } + \int_zero_new:N \l_@@_split_int + \int_set:Nn \l_@@_split_int { \seq_count:N \l_tmpa_seq } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \@@_qpoint:n { row - #1 } + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y + \@@_qpoint:n { row - \int_eval:n { #3 + 1 } } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y + \@@_qpoint:n { col - #2 } + \dim_set_eq:NN \l_tmpa_dim \pgf@x + \@@_qpoint:n { col - \int_eval:n { #4 + 1 } } + \dim_set:Nn \l_tmpb_dim + { ( \pgf@x - \l_tmpa_dim ) / \int_use:N \l_@@_split_int } + \bool_lazy_or:nnT + \l_@@_vlines_block_bool + { \tl_if_eq_p:NN \l_@@_vlines_clist \c_@@_all_tl } + { + \int_step_inline:nn { \l_@@_split_int - 1 } + { + \pgfpathmoveto + { + \pgfpoint + { \l_tmpa_dim + ##1 \l_tmpb_dim } + \l_@@_tmpc_dim + } + \pgfpathlineto + { + \pgfpoint + { \l_tmpa_dim + ##1 \l_tmpb_dim } + \l_@@_tmpd_dim + } + \CT@arc@ + \pgfsetlinewidth { 1.1 \arrayrulewidth } + \pgfsetrectcap + \pgfusepathqstroke + } + } + \@@_qpoint:n { row - #1 - base } + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y + \int_step_inline:nn \l_@@_split_int + { + \group_begin: + \dim_set:Nn \col@sep + { \bool_if:NTF \l_@@_tabular_bool \tabcolsep \arraycolsep } + \pgftransformshift + { + \pgfpoint + { + \str_case:on \l_@@_hpos_block_str + { + l { \l_tmpa_dim + ##1 \l_tmpb_dim - \l_tmpb_dim + \col@sep} + c { \l_tmpa_dim + ##1 \l_tmpb_dim - 0.5 \l_tmpb_dim } + r { \l_tmpa_dim + ##1 \l_tmpb_dim - \col@sep } + } + } + { \l_@@_tmpc_dim } + } + \pgfset + { + inner~xsep = \c_zero_dim , + inner~ysep = \c_zero_dim + } + \pgfnode + { rectangle } + { + \str_case:on \l_@@_hpos_block_str + { + c { base } + l { base~west } + r { base~east } + } + } + { \seq_item:Nn \l_tmpa_seq { ##1 } } { } { } + \group_end: + } + \endpgfpicture + } + { + \bool_if:NTF \l_@@_p_block_bool + { +% \end{macrocode} +% When the final user has used the key~|p|, we have to compute the width. +% \begin{macrocode} + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \bool_if:NTF \l_@@_hpos_of_block_cap_bool + { + \@@_qpoint:n { col - #2 } + \dim_gset_eq:NN \g_tmpa_dim \pgf@x + \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } + } + { + \pgfpointanchor { \@@_env: - #1 - #2 - block - short } { west } + \dim_gset_eq:NN \g_tmpa_dim \pgf@x + \pgfpointanchor { \@@_env: - #1 - #2 - block - short } { east } + } + \dim_gset:Nn \g_tmpb_dim { \pgf@x - \g_tmpa_dim } + \endpgfpicture + \hbox_set:Nn \l_@@_cell_box + { + \begin { minipage } [ \str_lowercase:o \l_@@_vpos_block_str ] + { \g_tmpb_dim } + \str_case:on \l_@@_hpos_block_str + { c \centering r \raggedleft l \raggedright j { } } + #6 + \end { minipage } + } + } + { \hbox_set:Nn \l_@@_cell_box { \set@color #6 } } + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: +% \end{macrocode} % -% \medskip +% \bigskip % Now, we will put the label of the block. % \begin{macrocode} - \bool_lazy_any:nTF - { - { \str_if_eq_p:on \l_@@_vpos_block_str { c } } - { \str_if_eq_p:on \l_@@_vpos_block_str { T } } - { \str_if_eq_p:on \l_@@_vpos_block_str { B } } - } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \bool_lazy_any:nTF + { + { \str_if_eq_p:on \l_@@_vpos_block_str { c } } + { \str_if_eq_p:on \l_@@_vpos_block_str { T } } + { \str_if_eq_p:on \l_@@_vpos_block_str { B } } + } % \end{macrocode} % \medskip % \begin{macrocode} - { + { % \end{macrocode} % If we are in the first column, we must put the block as if it was with the key~|r|. % \begin{macrocode} - \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str } + \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str } % \end{macrocode} % If we are in the last column, we must put the block as if it was with the key~|l|. % \begin{macrocode} - \bool_if:nT \g_@@_last_col_found_bool - { - \int_compare:nNnT { #2 } = \g_@@_col_total_int - { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str } - } + \bool_if:nT \g_@@_last_col_found_bool + { + \int_compare:nNnT { #2 } = \g_@@_col_total_int + { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str } + } % \end{macrocode} % |\l_tmpa_tl| will contain the anchor of the \textsc{pgf} node which will be used. % \begin{macrocode} - \tl_set:Nx \l_tmpa_tl - { - \str_case:on \l_@@_vpos_block_str + \tl_set:Nx \l_tmpa_tl { - c { - \str_case:on \l_@@_hpos_block_str - { - c { center } - l { west } - r { east } - } + \str_case:on \l_@@_vpos_block_str + { + c { + \str_case:on \l_@@_hpos_block_str + { + c { center } + l { west } + r { east } + j { center } + } - } - T { - \str_case:on \l_@@_hpos_block_str - { - c { north } - l { north~west } - r { north~east } - } + } + T { + \str_case:on \l_@@_hpos_block_str + { + c { north } + l { north~west } + r { north~east } + j { north } + } - } - B { - \str_case:on \l_@@_hpos_block_str - { - c { south} - l { south~west } - r { south~east } - } + } + B { + \str_case:on \l_@@_hpos_block_str + { + c { south } + l { south~west } + r { south~east } + j { south } + } - } + } + } } - } % \end{macrocode} % \begin{macrocode} - \pgftransformshift - { - \pgfpointanchor - { - \@@_env: - #1 - #2 - block - \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } + \pgftransformshift + { + \pgfpointanchor + { + \@@_env: - #1 - #2 - block + \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } + } + { \l_tmpa_tl } } + \pgfset + { + inner~xsep = \c_zero_dim , + inner~ysep = \c_zero_dim + } + \pgfnode + { rectangle } { \l_tmpa_tl } - } - \pgfset - { - inner~xsep = \c_zero_dim , - inner~ysep = \c_zero_dim - } - \pgfnode - { rectangle } - { \l_tmpa_tl } - { \box_use_drop:N \l_@@_cell_box } { } { } - } + { \box_use_drop:N \l_@@_cell_box } { } { } + } % \end{macrocode} % End of the case when |\l_@@_vpos_block_str| is equal to |c|, |T| or |B|. % Now, the other cases. % \begin{macrocode} - { + { % \end{macrocode} % % \begin{macrocode} - \pgfextracty \l_tmpa_dim - { - \@@_qpoint:n + \pgfextracty \l_tmpa_dim { - row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 } - - base + \@@_qpoint:n + { + row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 } + - base + } } - } - \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } + \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } % \end{macrocode} % We retrieve (in |\pgf@x|) the $x$-value of the center of the block. % \begin{macrocode} - \pgfpointanchor - { - \@@_env: - #1 - #2 - block - \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } - } - { - \str_case:on \l_@@_hpos_block_str + \pgfpointanchor + { + \@@_env: - #1 - #2 - block + \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } + } { - c { center } - l { west } - r { east } - } - } + \str_case:on \l_@@_hpos_block_str + { + c { center } + l { west } + r { east } + j { center } + } + } % \end{macrocode} % We put the label of the block which has been composed in |\l_@@_cell_box|. % \begin{macrocode} - \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } - \pgfset { inner~sep = \c_zero_dim } - \pgfnode - { rectangle } - { - \str_case:on \l_@@_hpos_block_str + \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } + \pgfset { inner~sep = \c_zero_dim } + \pgfnode + { rectangle } { - c { base } - l { base~west } - r { base~east } + \str_case:on \l_@@_hpos_block_str + { + c { base } + l { base~west } + r { base~east } + j { base } + } } - } - { \box_use_drop:N \l_@@_cell_box } { } { } - } + { \box_use_drop:N \l_@@_cell_box } { } { } + } % \end{macrocode} % % \begin{macrocode} - \endpgfpicture + \endpgfpicture + } \group_end: } % \end{macrocode} @@ -15764,9 +15995,9 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \@@_ShowCellNames_CodeBefore { } { - \dim_zero_new:N \g_@@_tmpc_dim - \dim_zero_new:N \g_@@_tmpd_dim - \dim_zero_new:N \g_@@_tmpe_dim + \dim_gzero_new:N \g_@@_tmpc_dim + \dim_gzero_new:N \g_@@_tmpd_dim + \dim_gzero_new:N \g_@@_tmpe_dim \int_step_inline:nn \c@iRow { \begin { pgfpicture } @@ -15850,9 +16081,9 @@ version 2005/12/01 or later. \pgfusepathqfill \endpgfpicture } - \dim_zero_new:N \g_@@_tmpc_dim - \dim_zero_new:N \g_@@_tmpd_dim - \dim_zero_new:N \g_@@_tmpe_dim + \dim_gzero_new:N \g_@@_tmpc_dim + \dim_gzero_new:N \g_@@_tmpd_dim + \dim_gzero_new:N \g_@@_tmpe_dim \int_step_inline:nn \c@iRow { \bool_if:NTF \l_@@_in_code_after_bool @@ -16224,6 +16455,15 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\@@_msg_new:nn { empty~preamble } + { + Empty~preamble.\\ + The~preamble~of~your~\@@_full_name_env:\ is~empty.\\ + This~error~is~fatal. + } +% \end{macrocode} +% % % \begin{macrocode} \@@_msg_new:nn { in~first~col } @@ -16471,7 +16711,7 @@ version 2005/12/01 or later. Incompatible~keys.\\ You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~ '\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\ - Maybe~it~will~possible~in~future~version.\\ + However,~you~can~put~several~commands~\token_to_str:N \Block.\\ Your~key~will~be~discarded. } % \end{macrocode} @@ -16512,7 +16752,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { ragged2e~not~loaded } { You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~ - your~column~'\l_@@_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:V + your~column~'\l_@@_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:o \l_keys_key_str'~will~be~used~instead. } % \end{macrocode} @@ -17121,6 +17361,7 @@ version 2005/12/01 or later. create-extra-nodes,~ create-medium-nodes,~ create-large-nodes,~ + custom-line,~ delimiters~(several~subkeys),~ end-of-row,~ first-col,~ |