summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx-table.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx-table.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx-table.dtx58
1 files changed, 34 insertions, 24 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx-table.dtx b/macros/latex/contrib/siunitx/siunitx-table.dtx
index c033090022..269015d857 100644
--- a/macros/latex/contrib/siunitx/siunitx-table.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-table.dtx
@@ -1027,6 +1027,15 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_before_dim}
+% Space reserved for any non-numerical text before the number: as we need
+% to allow for this to be available after setting the integer part, we need
+% to carry it along for a bit.
+% \begin{macrocode}
+\dim_new:N \l_@@_before_dim
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\l_@@_carry_dim}
% Used to \enquote{carry forward} the amount of white space which needs to
% be inserted after the decimal marker.
@@ -1067,14 +1076,19 @@
% \begin{macro}{\@@_print_marker:w}
% \begin{macro}[EXP]{\@@_print_marker_aux:w}
% \begin{macro}{\@@_print_format:nnn}
+% \begin{macro}[EXP]{\@@_print_format:nnnnnn}
% \begin{macro}
% {
-% \@@_print_marker_auxi:w,
-% \@@_print_marker_auxii:w,
-% \@@_print_marker_auxiii:w
+% \@@_print_format_auxi:w ,
+% \@@_print_format_auxii:w ,
+% \@@_print_format_auxiii:w ,
+% \@@_print_format_auxiv:w ,
+% \@@_print_format_auxv:w ,
+% \@@_print_format_auxvi:w ,
+% \@@_print_format_auxvii:w
% }
-% \begin{macro}{\@@_print_format_after:N}
% \begin{macro}{\@@_print_format_box:Nn}
+% \begin{macro}{\@@_print_format_after:N}
% \begin{macro}{\@@_print_none:nnn}
% \begin{macrocode}
\cs_new_protected:Npn \@@_print:nnn #1#2#3
@@ -1157,7 +1171,9 @@
% are a number of alignment points to get right. As for the |marker| approach,
% first we check if the material before the numerical content is of zero
% width. Next we need to format the model and content numbers, before
-% starting an auxiliary chain to pick out the various parts in order.
+% starting an auxiliary chain to pick out the various parts in order. We have
+% to carry the amount of space for the non-numerical material before the cell
+% forward: this may end up being enlarged by unused parts of the integer.
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_format:nnn #1#2#3
{
@@ -1168,12 +1184,7 @@
\box_clear:N \l_@@_before_box
#1
}
- \hbox_set_to_wd:Nnn \l_@@_before_box
- { \box_wd:N \l_@@_tmp_box }
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
+ \dim_set:Nn \l_@@_before_dim { \box_wd:N \l_@@_tmp_box }
\siunitx_number_parse:nN {#2} \l_@@_tmp_tl
\group_begin:
\bool_if:NT \l_@@_auto_round_bool
@@ -1239,16 +1250,11 @@
}
{
\@@_print_format_box:Nn \l_@@_integer_box {#3}
- \hbox_set_to_wd:Nnn \l_@@_before_box
+ \dim_add:Nn \l_@@_before_dim
{
- \box_wd:N \l_@@_before_box
- + \box_wd:N \l_@@_tmp_box
+ \box_wd:N \l_@@_tmp_box
- \box_wd:N \l_@@_integer_box
}
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
}
\@@_print_format_auxii:w #2 \q_mark #4 \q_stop
}
@@ -1259,6 +1265,9 @@
% much \emph{extra} material has been added. To avoid using more boxes
% or re-setting, we do that by recording sizes before and after the change.
% (In effect, \cs{l_@@_tmp_dim} is here \enquote{l_@@_comparator_dim}.)
+% As the integer part is completed here, we are able to finalise the width
+% of the pre-numeral part, reboxing it to have the correct width and possibly
+% to force a single overfull warning if appropriate.
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_format_auxii:w
#1 \q_nil #2 \q_nil #3 \q_mark #4 \q_nil #5 \q_nil #6 \q_stop
@@ -1301,19 +1310,19 @@
\hbox_unpack:N \l_@@_integer_box
\siunitx_print_number:n {#4#5}
}
- \hbox_set_to_wd:Nnn \l_@@_before_box
+ \dim_add:Nn \l_@@_before_dim
{
- \box_wd:N \l_@@_before_box
+ \box_wd:N \l_@@_tmp_box
+ \l_@@_tmp_dim
- \box_wd:N \l_@@_integer_box
}
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
}
}
+ \hbox_set_to_wd:Nnn \l_@@_before_box \l_@@_before_dim
+ {
+ \@@_fil:
+ \hbox_unpack:N \l_@@_before_box
+ }
\@@_print_format_auxiii:w #3 \q_mark #6 \q_stop
}
% \end{macrocode}
@@ -1458,6 +1467,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Standard settings for module options}
%