Skip to content

Commit

Permalink
first brave attempt for issue #179
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjr committed Nov 20, 2024
1 parent 7c32dd9 commit a593bcd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tabularray.sty
Original file line number Diff line number Diff line change
Expand Up @@ -3675,6 +3675,7 @@
\tl_const:Nn \c__tblr_cell_math_style_tl { \relax }
\tl_const:Nn \c__tblr_cell_imath_style_tl { \textstyle }
\tl_const:Nn \c__tblr_cell_dmath_style_tl { \displaystyle }
\box_new:N \l__tblr_measured_cell_box
%% Get cell text, #1: row number, #2: column number
%% If the width of the cell is not set, split it with \\ and compute the width
Expand All @@ -3683,6 +3684,7 @@
{
\group_begin:
\tl_set:Nx \l__tblr_c_tl { \__tblr_spec_item:ne { text } {[#1][#2]} }
\box_clear:N \l__tblr_measured_cell_box
%% when the cell text is guarded by a pair of curly braces,
%% we unbrace it and ignore cmd option of the cell, see issue #90.
\bool_lazy_and:nnTF
Expand Down Expand Up @@ -3729,17 +3731,18 @@
}
\dim_compare:nNnT { \l__tblr_w_tl } < { 0pt } % column width unset
{
\__tblr_save_counters:n { cell }
\bool_if:NT \lTblrMeasuringBool { \__tblr_save_counters:n { cell } }
\bool_if:NTF \l__tblr_cell_math_mode_bool
{
%% Note that font = \boldmath will increase cell width (issue #137)
\hbox_set:Nn \l_tmpa_box { \l__tblr_f_tl \l__tblr_c_tl }
\tl_set:Nx \l__tblr_w_tl { \dim_eval:n { \box_wd:N \l_tmpa_box } }
\hbox_set:Nn \l__tblr_measured_cell_box { \l__tblr_f_tl \l__tblr_c_tl }
\tl_set:Nx \l__tblr_w_tl
{ \dim_eval:n { \box_wd:N \l__tblr_measured_cell_box } }
}
{
\__tblr_get_cell_size_with_box:
}
\__tblr_restore_counters:n { cell }
\bool_if:NT \lTblrMeasuringBool { \__tblr_restore_counters:n { cell } }
}
\tl_put_left:NV \l__tblr_c_tl \l__tblr_f_tl
\tl_set:Nx \l__tblr_cell_fg_tl
Expand Down Expand Up @@ -3793,13 +3796,13 @@
\seq_map_variable:NNn \l_tmpa_seq \l_tmpa_tl
{
\__tblr_remove_braces:N \l_tmpa_tl
\hbox_set:Nn \l_tmpa_box
\hbox_set:Nn \l__tblr_measured_cell_box
{
\l__tblr_f_tl
\__tblr_rescan_cell_tokens:N \l_tmpa_tl
}
\tl_set:Nx \l__tblr_w_tl
{ \dim_max:nn { \l__tblr_w_tl } { \box_wd:N \l_tmpa_box } }
{ \dim_max:nn { \l__tblr_w_tl } { \box_wd:N \l__tblr_measured_cell_box } }
}
}
Expand Down Expand Up @@ -3859,9 +3862,9 @@
\TblrParboxRestore
\cs:w __tblr_halign_command_ \g__tblr_cell_halign_tl : \cs_end:
\__tblr_leave_vmode:
\bool_if:NTF \l__tblr_cell_math_mode_bool
\box_if_empty:NTF \l__tblr_measured_cell_box
{ #1 }
{ \__tblr_rescan_cell_tokens:N #1 }
{ \hbox_unpack_drop:N \l__tblr_measured_cell_box }
}
%% When using verb option, there is an end-of-line character at the end.
Expand Down

0 comments on commit a593bcd

Please sign in to comment.