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 + 1}
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⁶. – Qrrbrbirlbel Nov 21 '12 at 4:41\num{1 + i2e6}gives(1+2i)×10^6, that is fine, that is why I moved theito the end, in the hope that it won't be ambiguous (for thesiunitxparser) – alfC Nov 21 '12 at 4:43Coutput (e.g.1.2344234234e-23to something readable$1.23\times 10^{-23}$), I just letnumprocess 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 therealandimagpart, and that is where I hit the problem. – alfC Nov 21 '12 at 8:201e2 + 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? – Joseph Wright♦ Nov 21 '12 at 8:23