5

I'm trying to display the sum of two numbers using the siunitx package. Specifically, I'm trying to write out the conversion from Celsius to Kelvin. Ideally, I'd like to display the following equation:

5°C = (5+273) K = 278 K

I see that siunitx has a product-units option that can be used to display products of quantities. For example:


Code

\SI[product-units = brackets]{2 x 3 x 4}{\metre}

Output

(2 × 3 × 4) m


I've also seen that multi-part-units can be used to display numbers with multiple parts (such as uncertainty). For example:


Code

\sisetup{separate-uncertainty}%
\SI[multi-part-units = brackets]{12.3(4)}{\kilo\gram}

Output

(12.3 ± 0.4) kg


So, I'm able to display both the product of two numbers as well as one quantity plus or minus another quantity, but I cannot seem to figure out how to simply display one number plus another number using the siunitx package. Am I missing something obvious, or is this simply not possible? I could generate the desired content without siunitx, but since I am using that package throughout the rest of my document, it would be nice to use it in this case as well for the sake of consistency.

  • 2
    \SI[parse-numbers=false]{(5+273)}{\kelvin} – egreg Sep 24 '14 at 17:19
4

As @egreg mentioned you can tell siunitx to not to bother with the number parsing with parse-numbers=false option. Or if the output is too complicated to be parsed then you can simply skip the numerical part and put the unit with the lowercase version \si{} macro.

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI[parse-numbers=false]{(5+273)}{\kelvin}

$(5+273)\,\si{\kelvin}$
\end{document}

Note the spacing in the second version.

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.