It looks like siunitx
(by @Joseph Wright) has a limitation regarding complex numbers with exponents:
\documentclass[]{article}
\usepackage[]{siunitx}
\begin{document}
\num{1 + 2 i}\\ %ok, complex number
\num{2e6}\\ %ok, number with exponent
\num{1 + 2e6 i}\\ %not ok, ! siunitx error: "invalid-token-in-exponent"
\end{document}
Is there a workaround for this?
The only way I found is
\num[parse-numbers=false]{1 + (\num[parse-numbers=true]{2e6}) i}
which defeats the purpose.
(I am using siunitx
version 2.5c.)
Note that siunitx
can handle exponents in complex number, but in the case that the exponent is the same for both parts, for example \num{1+2i e10}
, which is a different case.
\num{1 + 2ie6}
but that gives, surprisingly to me,(1 + 2i) × 10⁶
.\num{1 + i2e6}
gives(1+2i)×10^6
, that is fine, that is why I moved thei
to the end, in the hope that it won't be ambiguous (for thesiunitx
parser)C
output (e.g.1.2344234234e-23
to something readable$1.23\times 10^{-23}$
), I just letnum
process the string and even truncate (e.g. uniformly across the document) that for me. For complex numbers I have to do a little more work to separate thereal
andimag
part, and that is where I hit the problem.1e2 + 3e4i
: logically allowable if you permit separate exponents, but much harder for me to process :-) Also, you have to then worry about the interpretation of1+2ie3
: is the exponent only for the second part or the whole number?