6

Suppose that you want to show that a certain quantity has an exact value, possibly calculable with an infinite number of figures, by adding "..." at the end of the numerical value, as in

ε0 = 8.854187817...×10−12 F/m

or

ε0 = 8.854187817...pF/m.

Trying

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\SI{8.854187817{\ldots}}{\pico\farad\per\metre} 
\end{document}

yields the error

! siunitx error: "invalid-token-in-number"

A possible cumbersome solution is to write

\num{8.854187817}\ldots\si{\pico\farad\per\metre} 

but this wouldn't work with numbers in scientific notation.

Is there any workaround?

5
  • 1
    You can pass the option [input-protect-tokens=\dots] when calling \SI. It's in the documentation.
    – Troy
    May 19 '17 at 13:53
  • 1
    @Troy That is very clever, but I find that using it with a \dots in the abscissa nullifies the scientific-notation=true directive. May 19 '17 at 13:58
  • 1
    @StevenB.Segletes You're absolutely right, but I think in this particular case, one can just state explicitly: \SI[input-protect-tokens=\dots]{8.854187817\dots e-12}{\farad\per\metre} instead of using the 'ability' of scientific-notation=true. You just lose this functionality when invoking \dots. Maybe there's a way around this, but I'm not sure.
    – Troy
    May 19 '17 at 14:02
  • @Troy Ah, nice! If you want to post your comment as an answer, I'll be happy to upvote it ;-) May 19 '17 at 14:11
  • @MassimoOrtolano In the process of doing so. :) Had to expand on it a little thanks to Steven's sharp observation.
    – Troy
    May 19 '17 at 14:12
6

As discussed in the comments, the siunitx package documentation offers an option for parsing \dots, with input-protect-tokens=\dots (c.f. Table 14). Observe its use in the code below.

Here I show how you can use it if you are (1) using it locally (single-use), or (2) using it globally/ in a scoped environment.

Note that you can use this solution for both with scientific notation and without (expressing in pico, milli, giga etc. instead).

\documentclass{article}
\usepackage{siunitx}

\begin{document}
    \textbf{Explicit passing of options -- for local use}

    \(\varepsilon_0 = \SI[input-protect-tokens=\dots]{8.854187817\dots e-12}{\farad\per\metre}\) \par
    \(\varepsilon_0 = \SI[input-protect-tokens=\dots]{8.854187817\dots}{\pico\farad\per\metre}\)

    \medskip
    \textbf{Using SIsetup -- for global/scoped use}

    \sisetup{input-protect-tokens=\dots,scientific-notation=true}
    \(\varepsilon_0 = \SI{8.854187817\dots e-12}{\farad\per\metre}\) \par
    \(\varepsilon_0 = \SI{8.854187817\dots}{\pico\farad\per\metre}\) 

    \medskip
    \textbf{Breaking of }\texttt{scientific-notation=true} % pointed out by Steven in comments

    \SI{0.003\dots}{\farad} % Does not convert to scientific notation automatically
    v.s.
    \SI{3\dots e-3}{\farad} % Use this as a workaround for now..
\end{document}

outputs


Note

A final note here is the astute observation by Steven that scientific-notation=true is 'broken' by this. I attempt to show that in the last example in my code and output. Normally with that option set as true, typing \SI{0.03}{} would yield 3x10^-2 automatically. This is not the case when using with \dots. (Of course, this wasn't in your original question, so I shall leave this as a problem to be solved for another question, perhaps. :-))

I am not aware of a perfect solution to this, but I have proposed a workaround, an inconvenience you would have to bear if you wish to have \dots parsed with your numbers.

PS. I'm not so sure about the spacings though - whether it is acceptable by 'professional' standards. I'll be happy if someone can chip in (just edit this answer, or post a separate answer of your own) regarding this, if this solution introduces wrong spacings between the numbers and units, for example.

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.