summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx-quantity.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx-quantity.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx-quantity.dtx23
1 files changed, 17 insertions, 6 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx-quantity.dtx b/macros/latex/contrib/siunitx/siunitx-quantity.dtx
index 353fe94e6e..e4dc93200e 100644
--- a/macros/latex/contrib/siunitx/siunitx-quantity.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-quantity.dtx
@@ -372,18 +372,29 @@
% }
% For printing a single part of a quantity. This is needed for compound
% quantities and so is public: that's also the reason for passing both
-% argument explicitly.
+% argument explicitly. The lazy test here is looking for the case where
+% a |1| has been inserted at the start of a format unit \emph{and} we
+% have some other number to print: the |1| is then removed and there is
+% no space inserted.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_quantity_print:nn #1#2
{
\siunitx_print_number:n {#1}
\tl_if_blank:nF {#2}
{
- \tl_use:N \l_@@_product_tl
- \bool_if:NTF \l_@@_break_bool
- { \penalty \binoppenalty }
- { \nobreak }
- \siunitx_print_unit:n {#2}
+ \bool_lazy_or:nnTF
+ { \tl_if_blank_p:n {#1} }
+ { ! \tl_if_head_eq_charcode_p:nN {#2} { 1 } }
+ {
+ \tl_use:N \l_@@_product_tl
+ \bool_if:NTF \l_@@_break_bool
+ { \penalty \binoppenalty }
+ { \nobreak }
+ \siunitx_print_unit:n {#2}
+ }
+ {
+ \exp_args:No \siunitx_print_unit:n { \use_none:n #2 }
+ }
}
}
\cs_generate_variant:Nn \siunitx_quantity_print:nn { nV , VV , xV }