5

I am trying to combine two or more values with one SI comment. For example, I would like to write 2 x 5 mL instead of 2 mL x 5 mL. I guess and as I saw before: How can I manage to get something like that?

\documentclass[pagesize=pdftex, paper=a4, parskip, fontsize=12pt, toc=bibnumbered, captions=tableheading, captions=nooneline, BCOR=5mm, headsepline]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman, english]{babel}
\usepackage{amsmath}
\usepackage{upgreek}
\usepackage[version=4]{mhchem}
\usepackage{textcomp}
\usepackage{siunitx}
\sisetup{separate-uncertainty-units=repeat,use-xspace=true, sticky-per=true, range-units=single, range-phrase={\,--\,}, list-units=single, per-mode=power-positive-first, multi-part-units=single, product-units=single} 
%a few other packages 
\begin{document}
I would like to write "\verb|\SI{2x5}{\milli\L}|" to express 2 x 2 mL\\
but the only comment what works so far is:\\
"\verb|\SI{2}{\milli\L}\times\SI{5}{\milli\L}|" but only if you write it in $\SI{2}{\milli\L}\times\SI{5}{\milli\L}$ and you will get 2 mL x 5 mL.  


\end{document}```
1
  • Welcome to TeX.SE.
    – Mico
    Jan 2, 2022 at 19:35

2 Answers 2

2

Using \qtyproduct in combination with product-units=single, which you already used in your preamble, you end up with the following output:

enter image description here

\documentclass{scrbook}
\usepackage{siunitx}
\sisetup{product-units=single} 

\begin{document}
\qtyproduct{2 x 5}{\mL} 
\end{document}
1

I suggest you use the parse-numbers=false option:

\SI[parse-numbers=false]{2\times5}{\milli\L}

enter image description here

If you happen to use a newer version of the siunitx package -- i.e., a version that's more recent than spring 2021 -- you could also write, as @leandriis has suggested,

\qtyproduct{2 x 5}{\mL}

Note that with the newer version, \SI is deprecated and should be replaced with \qty.

1
  • thanks a lot it worked finally and that was what I was looking for.
    – Katrin
    Jan 3, 2022 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.